# Plan restrictions

Messenger restrictions of the Bitrix24 plan: whether the full chat history is available and whether collabs and other features are available. The client uses the response to decide what to show the user.

## Get the restrictions

`GET /v1/chats/tariff-restrictions`

The v2 messenger method `im.v2.Tariff.Restriction.get`.

## Parameters

There are no parameters. Any query parameter is rejected with `400 INVALID_PARAMS`.

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/chats/tariff-restrictions" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/chats/tariff-restrictions" \
  -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/chats/tariff-restrictions', {
  headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})

const { data } = await res.json()
const history = data.fullChatHistory
console.log(history.isAvailable ? 'Full history available' : `History for ${history.limitDays} days`)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/chats/tariff-restrictions', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { data } = await res.json()
console.log('Collabs available:', data.collab?.isAvailable)
```

## Response fields

`data` is the restrictions object. The key is the restriction code, the value is its data. Bitrix24 and its modules define the set of codes.

| Field | Type | Description |
|------|-----|---------|
| `data.fullChatHistory.isAvailable` | boolean | `true` — the full chat history is available |
| `data.fullChatHistory.limitDays` | number \| null | How many days of history are available if not all of it; `null` — no limit |
| `data.collab.isAvailable` | boolean | `true` — collabs are available on the plan or can be enabled with a trial |
| `data.collab.isCopyAvailable` | boolean | `true` — copying projects and groups is available on the plan |

## Response example

```json
{
  "success": true,
  "data": {
    "fullChatHistory": { "isAvailable": true, "limitDays": null },
    "collab": { "isAvailable": true, "isCopyAvailable": true }
  }
}
```

## Error response example

400 — a query parameter was passed:

```json
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Query parameter `code` is not accepted by GET /v1/chats/tariff-restrictions. It takes no query parameters."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | A query parameter was passed — the operation accepts none |
| 401 | `TOKEN_MISSING` | The API key has no Bitrix24 tokens configured |
| 403 | `SCOPE_DENIED` | The API key does not have the `im` scope |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error; the portal code is in `error.b24Code` |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable or returned a server error |

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

## Known specifics

- Restriction codes (`fullChatHistory`, `collab`) arrive as is; the fields inside them are converted to camelCase.
- Bitrix24 modules can add their own restrictions — do not rely on a fixed set of codes.

## See also

- [Update state](/docs/chats/service/state)
- [Service methods](/docs/chats/service)
