## Assign a system page

`PUT /v1/sites/:id/system-pages/:type`

Assigns a site page to a system role, for example making it the cart or the personal account page. If the role is already taken, the new page replaces the previous one.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Site ID. List: [`GET /v1/sites`](/docs/entities/sites/list) |
| `type` (path) | string | yes | Role: `mainpage`, `catalog`, `personal`, `cart`, `order`, `payment`, `compare`, `feedback`. What each one means — [System pages](/docs/entities/sites/system-pages) |
| `scope` (query) | string | no | Internal landing scope: `KNOWLEDGE` / `GROUP` / `MAINPAGE`. Specify it if the site belongs to the corresponding scope. Otherwise `404 ENTITY_NOT_FOUND` is returned. Omit it for an ordinary site |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `pageId` | number | yes | ID of a page on the same site. List of the site's pages: [`GET /v1/pages?filter[siteId]=:id`](/docs/entities/pages/list) |

The body accepts no other fields: an extra field returns `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl -X PUT "https://vibecode.bitrix24.com/v1/sites/223/system-pages/personal" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pageId": 2373}'
```

### curl — OAuth application

```bash
curl -X PUT "https://vibecode.bitrix24.com/v1/sites/223/system-pages/personal" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"pageId": 2373}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/223/system-pages/personal', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ pageId: 2373 }),
})

const { success, data } = await res.json()
console.log('Site roles:', data.map((row) => `${row.type} → ${row.pageId}`))
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/sites/223/system-pages/personal', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ pageId: 2373 }),
})

const { success, data } = await res.json()
```

## Response fields

The response contains all of the site's bindings after the change, not only the assigned one.

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data` | array | All of the site's bindings |
| `data[].type` | string | Role: `mainpage`, `catalog`, `personal`, `cart`, `order`, `payment`, `compare`, `feedback`. What each one means — [System pages](/docs/entities/sites/system-pages) |
| `data[].pageId` | number | ID of the page assigned to the role. Get the page: [`GET /v1/pages/:id`](/docs/entities/pages/get) |
| `data[].title` | string | Page title |
| `data[].deleted` | boolean | The page is in the trash |
| `data[].active` | boolean | The page is published |

## Response example

```json
{
  "success": true,
  "data": [
    {
      "type": "cart",
      "pageId": 2371,
      "title": "Docs test cart",
      "deleted": false,
      "active": false
    },
    {
      "type": "personal",
      "pageId": 2373,
      "title": "Docs test personal",
      "deleted": false,
      "active": false
    }
  ]
}
```

## Error response example

400 — the page belongs to another site:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Page must belong to this site"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `Page must belong to this site` — the page with `pageId` is on another site |
| 400 | `INVALID_PARAMS` | `Unknown system-page type` — `type` is not in the list of roles |
| 400 | `INVALID_PARAMS` | `pageId must be a positive safe integer` — `pageId` is not a positive integer |
| 400 | `INVALID_PARAMS` | `id must be a positive safe integer` — `id` is not a positive integer |
| 400 | `INVALID_PARAMS` | `Unsupported body field` — the body contains a field the method does not accept |
| 400 | `INVALID_PARAMS` | `Body must be a JSON object` — the body is not a JSON object, for example an array was sent |
| 400 | `INVALID_PARAMS` | `Unsupported query parameter` — a query parameter the method does not accept was sent |
| 400 | `MISSING_REQUIRED_FIELDS` | The body has no `pageId` |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 404 | `ENTITY_NOT_FOUND` | `Entity not found or not visible` — a site with this ID was not found, is not accessible to the user or belongs to another scope |
| 404 | `ENTITY_NOT_FOUND` | `Page not found or not visible` — the page with `pageId` was not found or is not accessible to the user |
| 409 | `LANDING_MODULE_NOT_ENABLED` | The Sites module is unavailable on this Bitrix24 account. Ask a Bitrix24 account administrator to enable it — until then a retry returns the same refusal |
| 422 | `BITRIX_ERROR` | `Bitrix24 did not save the binding change; site settings permission may be missing` — the binding is absent after the write. Check whether the user has permission to change site settings |
| 422 | `BITRIX_ERROR` | `Bitrix24 did not confirm the binding change` — Bitrix24 did not confirm the write |
| 422 | `BITRIX_ERROR` | `Bitrix24 returned invalid system pages` — Bitrix24 returned the list of bindings in an unexpected shape |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is read-only. The request is refused before any call to the Bitrix24 account |
| 403 | `SCOPE_DENIED` | The API key does not have the `landing` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## Known specifics

- **One page can hold several roles.** Assigning a page to a second role does not remove it from the first: it appears twice in the response, with different `type` values.
- **Repeated assignment is safe.** Assigning the same page to the same role again returns `200` with the same set of bindings.
- **Publishing is not required.** An unpublished page can be assigned too: it has `active: false` in the response.

## See also

- [System pages](/docs/entities/sites/system-pages)
- [List site system pages](/docs/entities/sites/system-pages-list)
- [Get a system page URL](/docs/entities/sites/system-pages-url)
- [Remove a system page](/docs/entities/sites/system-pages-delete-delete)
- [Remove all site system pages](/docs/entities/sites/system-pages-delete)
- [List pages](/docs/entities/pages/list)
