
## Archive a knowledge base

`POST /v1/note/collections/:id/archive`

Archives a knowledge base. Cascades the archive to all its documents — they switch to read-only mode.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` | integer | yes | Knowledge base identifier (path parameter) |

The request body is empty.

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/note/collections/42/archive \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl -X POST https://vibecode.bitrix24.com/v1/note/collections/42/archive \
  -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/note/collections/42/archive', {
  method: 'POST',
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { data } = await res.json()
console.log(data.archived) // true
```

### JavaScript — OAuth application

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.archived` | boolean | `true` on successful archival |

## Response example

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

## Error response example

404 — knowledge base not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Record with ID = `999999` not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `id` is not a positive integer |
| 404 | `ENTITY_NOT_FOUND` | The knowledge base does not exist or is already archived |
| 403 | `BITRIX_ACCESS_DENIED` | No permission to manage the knowledge base |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 403 | `SCOPE_DENIED` | The key is missing the `note` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## Known specifics

- Documents of an archived knowledge base are not returned in the [document tree](/docs/note/documents).

## See also

- [Delete a knowledge base](./delete.md)
- [Documents](/docs/note/documents)
- [Knowledge Base overview](/docs/note)
