## Bot commands in a chat

`GET /v1/chats/:dialogId/commands`

Returns commands available to an active chat member. The method is undocumented in the B24 reference; the response shape was measured. READONLY uses the existing-context guard: an employee personal key may read, while an application key may receive 403 WRITE_BLOCKED_READONLY_KEY before dispatch.

**Scope:** `im`. Authentication: `X-Api-Key`; an OAuth application also sends `Authorization: Bearer USER_SESSION_TOKEN`.

Bitrix24 method: `im.v2.Chat.Command.list`.

## Example

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

### OAuth application

```bash
curl -X GET "https://vibecode.bitrix24.com/v1/chats/chat42/commands" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/commands', {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_API_KEY"
  }
})
const result = await response.json()
```

### JavaScript — OAuth

```javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/chats/chat42/commands', {
  "method": "GET",
  "headers": {
    "X-Api-Key": "YOUR_APP_KEY",
    "Authorization": "Bearer USER_SESSION_TOKEN"
  }
})
const result = await response.json()
```

## Response

```json
{
  "success": true,
  "data": {
    "commands": [
      {
        "id": 73,
        "botId": 7,
        "command": "/echo",
        "category": "Example",
        "common": "Y",
        "context": "",
        "title": "Echo",
        "params": "text",
        "extranet": "N"
      }
    ],
    "users": [
      {
        "id": 7,
        "name": "Example Bot",
        "bot": true
      }
    ]
  }
}
```

## Errors

| Status | Code | Meaning |
|---|---|---|
| 400 | `INVALID_PARAMS` | Invalid id or parameter shape, empty required input |
| 401 | `MISSING_API_KEY` | API key missing |
| 403 | `SCOPE_DENIED` | im scope required |
| 403 | `BITRIX_ACCESS_DENIED` | B24 refused access |
| 422 | `BITRIX_ERROR` | B24 business refusal; message preserved |
| 429 | `RATE_LIMIT_EXCEEDED` | Request limit |
| 502 | `BITRIX_UNAVAILABLE` | Unreadable answer or B24 failure |
| 503 | `SERVICE_UNAVAILABLE` | Service temporarily unavailable |

[All errors](/docs/errors).

## Request parameters

| Field | Type | Location | Description |
|---|---|---|---|
| `dialogId` | string | path | me / chatN / positive user id |

## Response fields

| Field | Type |
|---|---|
| `commands` | array |
| `users` | array |
