## Clear page template areas

`DELETE /v1/pages/:id/template-areas`

Removes the page's own bindings from all layout areas in one call. The pages that were placed in the areas stay on the site, and the site's areas do not change.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `id` (path) | number | yes | Page ID. List: [`GET /v1/pages`](/docs/entities/pages/list) |
| `scope` (query) | string | no | Internal landing scope: `KNOWLEDGE` / `GROUP` / `MAINPAGE`. Specify it if the page's site belongs to the corresponding scope. Otherwise `404 ENTITY_NOT_FOUND` is returned. Omit it for an ordinary site |

No request body is needed: a body with any field returns `400 INVALID_PARAMS`.

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
curl -X DELETE "https://vibecode.bitrix24.com/v1/pages/2381/template-areas" \
  -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/2381/template-areas', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Areas cleared:', success && Object.keys(data.areas).length === 0)
```

### JavaScript — OAuth application

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

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

## Response fields

The method responds with `200` and a body, not `204`: the response carries the page's bindings after clearing.

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data.areas` | object | The page's area bindings after clearing. Always an empty object `{}` on success. For the format of a non-empty object, see [Get page template areas](/docs/entities/pages/template-areas-list) |

## Response example

```json
{
  "success": true,
  "data": {
    "areas": {}
  }
}
```

## Error response example

409 — another write to this page's areas is in progress at the same time:

```json
{
  "success": false,
  "error": {
    "code": "TEMPLATE_AREAS_BUSY",
    "message": "Another template-area update is in progress; retry"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 409 | `TEMPLATE_AREAS_BUSY` | Another API request is changing this page's areas at the same time. Retry once that write completes |
| 404 | `ENTITY_NOT_FOUND` | A page with this ID was not found, is not accessible to the user, or belongs to a different scope: 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 parameter the method does not accept was passed |
| 400 | `INVALID_SCOPE` | `scope` is not `KNOWLEDGE`, `GROUP` or `MAINPAGE` |
| 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 template areas; settings permission may be missing` — the page still has bindings after clearing. Check whether the user has permission to change page settings |
| 422 | `BITRIX_ERROR` | `Bitrix24 did not confirm the template-area change` — Bitrix24 did not confirm the write |
| 422 | `BITRIX_ERROR` | `Bitrix24 returned invalid template areas` — Bitrix24 returned the areas in an unexpected shape |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key works in read-only mode. The request is rejected before it reaches 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

- **Repeated clearing is safe.** A call on a page without bindings responds with `200` and an empty `data.areas`.

## See also

- [Page template areas](/docs/entities/pages/template-areas)
- [Get page template areas](/docs/entities/pages/template-areas-list)
- [Update page template areas](/docs/entities/pages/template-areas-update)
- [Clear site template areas](/docs/entities/sites/template-areas-delete)
