
## Restore a page

`POST /v1/pages/:id/restore`

Restores a trashed page. The page remains unpublished.

Requires the `landing` scope. Write actions refuse a READONLY key.

## Request parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | integer | yes | Page ID from [List pages](/docs/entities/pages/list). |
| `scope` | string | no | Query: KNOWLEDGE, GROUP or MAINPAGE; omit for an ordinary site. |

The body is empty. mark is not accepted; use the separate inverse action.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/42/restore" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/pages/42/restore" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### JavaScript — personal key

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/42/restore", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

### JavaScript — OAuth application

```javascript
const response = await fetch("https://vibecode.bitrix24.com/v1/pages/42/restore", {
  method: "POST",
  headers: {"X-Api-Key": "YOUR_APP_KEY", "Authorization": "Bearer USER_SESSION_TOKEN", "Content-Type": "application/json"},
  body: JSON.stringify({}),
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.message)
console.log(result.data)
```

## Response fields

| Field | Type | Description |
|---|---|---|
| `success` | boolean | true |
| `data` | object | Operation result. |
| `data.id` | integer | Freshly read page ID. |
| `data.siteId` | integer | Page site. |
| `data.folderId` | integer \| null | Folder; null at root. |
| `data.title` | string | title |
| `data.code` | string | Page address code. |
| `data.active` | boolean | Whether the page is published. |
| `data.deleted` | string Y/N | Y means in trash; N means not in trash. |

```json
{
  "success": true,
  "data": {
    "id": 42,
    "siteId": 10,
    "folderId": null,
    "title": "Example",
    "code": "example",
    "active": false,
    "deleted": "N"
  }
}
```

## Errors

| HTTP | Code | Condition |
|---|---|---|
| 400 | `INVALID_PAGE_ID` | id is not a positive safe integer. |
| 400 | `INVALID_PARAMS` | Invalid body shape or parameter value. |
| 400 | `INVALID_SCOPE` | Invalid scope. |
| 401 | `TOKEN_MISSING` | No Bitrix24 credentials. |
| 403 | `SCOPE_DENIED` | The key lacks landing. |
| 403 | `BITRIX_ACCESS_DENIED` | The Bitrix24 user lacks permission. |
| 404 | `ENTITY_NOT_FOUND` | Page not found. |
| 422 | `BITRIX_ERROR` | Bitrix24 business refusal; its message is preserved. |
| 422 | `BITRIX_NO_EFFECT` | Bitrix24 did not confirm the action or return the expected result. |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | A READONLY key cannot write to the portal. |

[All system errors](/docs/errors).

400 — invalid scope:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_SCOPE",
    "message": "scope must be KNOWLEDGE, GROUP or MAINPAGE, or omitted."
  }
}
```

## See also

- [Pages](/docs/entities/pages)
- [Page templates](/docs/entities/page-templates)
