
# Sites

Managing sites on the Bitrix24 platform: create, get, update, delete, search, aggregate. A site is a container of pages of one type: `PAGE` — landing page, `STORE` — online store, `KNOWLEDGE` — Knowledge Base 2.0. Each site has its own domain or subdomain in the Bitrix24 account, a symbolic code, a template, and a set of pages.

Knowledge Base 2.0 is created and managed through the same methods with an additional `scope: "KNOWLEDGE"` parameter (see [create](./sites/create.md)).

Bitrix24 API: `landing.site.*`
Scope: `landing`

## Operations

- [Create site](./sites/create.md) — `POST /v1/sites`
- [List sites](./sites/list.md) — `GET /v1/sites`
- [Get site](./sites/get.md) — `GET /v1/sites/:id`
- [Update site](./sites/update.md) — `PATCH /v1/sites/:id`
- [Delete site](./sites/delete.md) — `DELETE /v1/sites/:id`
- [Search sites](./sites/search.md) — `POST /v1/sites/search`
- [Site fields](./sites/fields.md) — `GET /v1/sites/fields`
- [Aggregate sites](./sites/aggregate.md) — `POST /v1/sites/aggregate`

## Key fields

### Writable fields

Accepted on [create](./sites/create.md) and [update](./sites/update.md).

| Field | Type | Description |
|------|-----|---------|
| `title` | string | Site name, up to 255 characters |
| `code` | string | Symbolic site code in the URL. If left empty on create, it is generated from `title`. If the code consists only of digits, the `site` prefix is added |
| `type` | string | Site type: `PAGE` — landing page, `STORE` — online store, `KNOWLEDGE` — Knowledge Base 2.0. For `KNOWLEDGE`, `scope: "KNOWLEDGE"` is required on create and update. In responses, sites created outside the API may carry other values too — see "What to know before you start" |
| `active` | boolean | Read-only: cannot be set through the API, and a request that includes it is rejected with `400 READONLY_FIELD`. A new site is inactive and becomes active through `POST /v1/sites/:id/publication` or when published in the Bitrix24 interface |
| `domainId` | number | Domain identifier. If not provided on create, the address is generated from `code` |
| `description` | string \| null | Site description, up to 255 characters. Returns `null` if not set |
| `xmlId` | string \| null | External identifier, up to 255 characters. Returns `null` if not set |
| `landingIdIndex` | number \| null | Home page identifier. Set only on update — after the pages are created. `null` if no home page is assigned |
| `landingId404` | number \| null | Identifier of the 404 error page. Set only on update. If not assigned — `0` or `null` |
| `landingId503` | number \| null | Identifier of the 503 error page. Set only on update. If not assigned — `0` or `null` |

### Read-only

Returned in the response but not accepted on create and update.

| Field | Type | Description |
|------|-----|---------|
| `id` | number | Site identifier |
| `deleted` | string | Trash flag: `"Y"` / `"N"`. Available in the filter (`filter[deleted]=Y`) |
| `createdById` | number | Identifier of the user who created the site |
| `modifiedById` | number | Identifier of the user who last modified the site |
| `dateCreate` | datetime | Creation date. Bitrix24 locale format, not ISO 8601 — see "What to know before you start" |
| `dateModify` | datetime | Last modification date. Bitrix24 locale format, not ISO 8601 |
| `tplId` | number | Site template identifier |
| `tplCode` | string \| null | Symbolic code of the site template. `null` if the template has no code |
| `smnSiteId` | string \| null | Identifier of the linked "Site Management" site of type `SMN`. `null` for regular sites |
| `lang` | string \| null | Site language code, for example `en`. `null` if the language is not set |
| `special` | string | Bitrix24 service flag: `"Y"` / `"N"` |
| `version` | number | Version of the internal site structure |

Full field list — [`GET /v1/sites/fields`](./sites/fields.md).

## What to know before you start

1. **The request body is flat.** On create and update, pass fields directly at the root of the JSON: `{"title": "...", "code": "..."}`. The `fields` wrapper is not needed.
2. **Only an empty site can be deleted.** If a site has at least one page (including pages in the trash), `DELETE /v1/sites/:id` returns a `BITRIX_ERROR` with the description "Site contains pages". First delete the pages, then the site itself.
3. **Visibility depends on user permissions.** List and aggregate return only the sites the API key owner has "view" permission for. If there are sites on the account but the response is empty, check the permissions of the user the key was issued for.
4. **Trash — `filter[deleted]=Y`.** By default, deleted sites are not returned. To get sites in the trash, add `deleted=Y` to the filter. Values are `Y` or `N`.
5. **Full field list — [`GET /v1/sites/fields`](./sites/fields.md).** The endpoint returns a map of all 22 fields with type, the `readonly` flag, a label, a description and a `nullable` flag on the fields that can arrive with a `null` value. The `type` field additionally carries an `enum` of allowed values. Alongside the field map, the endpoint returns an `aggregatable` list — the fields available for grouping in aggregation. The list with descriptions is given in the "Key fields" section above.
6. **Date format is locale-dependent, not ISO 8601.** The `dateCreate` and `dateModify` fields arrive as a string in the account's locale format: on the RU locale — `DD.MM.YYYY HH:MM:SS` (`30.12.2021 12:30:52`), on the EN locale — `MM/DD/YYYY hh:mm:ss am/pm` (`04/22/2020 02:39:17 pm`). The value is returned as is, without conversion to ISO. `new Date(value)` returns `Invalid Date` or swaps the day and month — do not parse the date with a fixed pattern. Rely on the account's regional settings instead.
7. **The `type` field is broader in responses than on create.** The API creates sites of types `PAGE`, `STORE` and `KNOWLEDGE`. In responses, sites built by other means may carry other values — `VIBE` (a site from the builder) and `SMN` (a link to the "Site Management" module). These two types are returned read-only. The full value set is now covered by the schema — [`GET /v1/sites/fields`](./sites/fields.md) returns them in `type.enum` with labels.
8. **A missing value is `null` or `0`.** A value may be absent on eight fields — they carry `nullable` in the schema. The string fields `description`, `xmlId`, `tplCode`, `smnSiteId`, `lang` arrive as `null`. The numeric page identifiers `landingIdIndex`, `landingId404`, `landingId503` arrive as `0` or `null`. Check both options.
9. **Filter by `code` — with slashes.** In the filter, the `code` value is compared with the stored form wrapped in slashes: `filter[code]=/my-code/` finds the site, bare `filter[code]=my-code` does not. Use the `code` value the site returns in the response.

## Related entities

| Entity | Endpoint | Purpose |
|----------|----------|-----------|
| Pages | [`GET /v1/pages`](/docs/entities/pages) | Site pages. Get the list of pages with `filter[siteId]=:id` before deleting a site, or to edit its content. |

## Typical scenario

Launching a new site with a home page:

1. Create the site: [`POST /v1/sites`](./sites/create.md) with the `title` field. The site is created inactive. Its identifier is returned in `data.id`.
2. Create pages: [`POST /v1/pages`](/docs/entities/pages/create) with `title` and the `siteId` of the new site.
3. Set the home page: [`PATCH /v1/sites/:id`](./sites/update.md) with the `landingIdIndex` field.
4. Publish the site: [`POST /v1/sites/:id/publication`](./sites/publication.md). Its unpublished pages are published together with the site.
5. Get the public address: [`GET /v1/sites/:id/public-url`](./sites/public-url.md).

## Limits

| Limit | Value |
|-------|----------|
| Maximum records per request | 5000 (`limit ≤ 5000`) |
| Pagination | via `offset` — the `[offset, offset + limit)` window |
| `offset` | supported, together with `limit` it defines the result window |
| Batch requests | up to 50 operations in [`POST /v1/batch`](/docs/batch) |
| Rate limit | shared across the Vibecode API — see [Limits and optimization](/docs/optimization) |

## See also

- [Entity API](/docs/entity-api)
- [Filtering syntax](/docs/filtering)
- [Batch](/docs/batch)
- [API reference](/docs/api-reference)

## Site actions

- [Publish site](/docs/entities/sites/publication)
- [Unpublish site](/docs/entities/sites/unpublish)
- [Move site to trash](/docs/entities/sites/trash)
- [Restore site](/docs/entities/sites/restore)
- [Site public URL](/docs/entities/sites/public-url)
- [Site preview](/docs/entities/sites/preview)
- [Site settings](/docs/entities/sites/settings)
- [Full site export](/docs/entities/sites/export)
- [My site permissions](/docs/entities/sites/my-permissions)
- [Site permissions](/docs/entities/sites/permissions)
- [Reset site permissions](/docs/entities/sites/permissions-delete)

## Site folders

- [Site folders](/docs/entities/sites/folders)

## System pages

- [System pages](/docs/entities/sites/system-pages)

## Knowledge-base bindings

- [menu-bindings: list](/docs/entities/sites/menu-bindings/list)
- [menu-bindings: bind](/docs/entities/sites/menu-bindings/bind)
- [menu-bindings: unbind](/docs/entities/sites/menu-bindings/unbind)
- [group-binding: list](/docs/entities/sites/group-binding/list)
- [group-binding: bind](/docs/entities/sites/group-binding/bind)
- [group-binding: unbind](/docs/entities/sites/group-binding/unbind)
