## Remove a page's system roles

`DELETE /v1/pages/:id/system-pages`

Releases every site system role the page is assigned to in a single call. The page itself stays on the site, and the roles of other pages do not change. Moving a page to the trash does not release its roles, so release them with this method before moving the page.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Page ID. List: [`GET /v1/pages`](/docs/entities/pages/list) |
| `scope` (query) | string | no | Site area: `KNOWLEDGE` — knowledge base, `GROUP` — workgroup pages, `MAINPAGE` — main pages. Omit the parameter for pages of all other sites |

No request body is needed.

## Examples

### curl — personal key

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/pages/42/system-pages" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/pages/42/system-pages" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/pages/42/system-pages', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/pages/42/system-pages', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data` | array | Site bindings after the page's roles are removed. The array keeps the roles of other pages on the site. Empty array if there are no other 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

The roles of page `42` are removed, and the site keeps the `cart` role of page `43`:

```json
{
  "success": true,
  "data": [
    {
      "type": "cart",
      "pageId": 43,
      "title": "Cart",
      "deleted": false,
      "active": true
    }
  ]
}
```

## Error response example

422 — before the call, the page had no roles on its own site:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Bitrix24 acknowledged the removal, but cross-site roles cannot be verified without a prior own-site binding"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 404 | `ENTITY_NOT_FOUND` | `Entity not found or not visible` — no page with this ID exists, the user cannot access it, or it belongs to a different area: the wrong `scope` was passed |
| 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 passed |
| 400 | `INVALID_PARAMS` | `Unsupported query parameter` — a query string parameter the method does not accept was passed |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 409 | `PORTAL_ADDRESS_CHANGED` | The self-hosted Bitrix24 has moved to a new address, but the key's webhook was issued for the old one. Reissue the key's webhook |
| 422 | `BITRIX_ERROR` | `Bitrix24 acknowledged the removal, but cross-site roles cannot be verified without a prior own-site binding` — before the call, the page had no roles on its own site. The removal request was still sent to the Bitrix24 account |
| 422 | `BITRIX_ERROR` | `Bitrix24 did not save the binding change; site settings permission may be missing` — after the write, the page still holds a role on its own site. 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 format |
| 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 Bitrix24 access tokens |

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

## Known specifics

- **A repeated call returns `422`, not `200`.** A second call on the same page, once it has no roles left, gets `422 BITRIX_ERROR`, unlike [removing all site roles](/docs/entities/sites/system-pages-delete), which returns `200` on a site with no bindings. Check the result with the site role list [`GET /v1/sites/:id/system-pages`](/docs/entities/sites/system-pages-list) and look for the page's `pageId` in it.

## See also

- [System pages](/docs/entities/sites/system-pages)
- [List site system pages](/docs/entities/sites/system-pages-list)
- [Assign a system page](/docs/entities/sites/system-pages-set)
- [Remove a system page](/docs/entities/sites/system-pages-delete-delete)
- [Remove all site system pages](/docs/entities/sites/system-pages-delete)
- [Move to trash](/docs/entities/pages/trash)
