
# 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, `STORE` — online store, `KNOWLEDGE` — Knowledge Base 2.0. Each site has its own domain or subdomain on the 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`

## 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, `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 you need to know before working" |
| `active` | boolean | Not set through the API — accepted without error but not saved. A new site is inactive and is activated on publication in the Bitrix24 account 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 you need to know before working" |
| `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 `ru`. `null` if the language is not set |
| `special` | string | Bitrix24 service flag: `"Y"` / `"N"` |
| `version` | number | Version of the internal site structure |

## What you need to know before working

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 and a `nullable` flag on the fields that can arrive with a `null` value. The `type` field additionally carries a label, a description and an `enum` of allowed values. Next to the field map the endpoint returns an `aggregatable` list — the fields available for grouping in aggregation. The list with descriptions is given in the "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 local 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 with a fixed template, rely on the account's regional settings.
7. **The `type` field is broader in responses than on create.** Through the API, sites of types `PAGE`, `STORE`, `KNOWLEDGE` are created. In responses, sites built by other means may carry other values — `VIBE` (a site from the builder) and `SMN` (a link with 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 content. |

## 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) — general principles of working with entities
- [Filtering syntax](/docs/filtering)
- [Batch](/docs/batch) — bulk operations
- [Entity reference](/docs/entities-index)
