
## Input field control

`POST /v1/bots/:botId/text-field`

Enables or disables the text input field in a chat with the bot. Useful when the bot accepts input only via the keyboard (buttons).

## Request fields (body)

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `dialogId` | string | yes | Dialog ID: numeric user ID for direct messages, `chatXXX` for group chats |
| `enabled` | boolean | yes | `true` — enable the input field, `false` — disable it |

## Examples

### curl — personal key

```bash
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/text-field \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "dialogId": "chat123", "enabled": false }'
```

### curl — OAuth app

```bash
curl -X POST https://vibecode.bitrix24.com/v1/bots/42/text-field \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "dialogId": "chat123", "enabled": false }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/text-field', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ dialogId: 'chat123', enabled: false }),
})

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

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/bots/42/text-field', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ dialogId: 'chat123', enabled: false }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data.result` | boolean | `true` on successful change |

## Response example

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

## Error response example

404 — bot not found:

```json
{
  "success": false,
  "error": {
    "code": "BOT_NOT_FOUND",
    "message": "Bot 999 not found. Register it first via POST /v1/bots."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_BOT_ID` | `botId` is not a number |
| 404 | `BOT_NOT_FOUND` | No bot found with this ID |
| 403 | `BOT_ACCESS_DENIED` | The bot belongs to a different API key |
| 502 | `BITRIX_ERROR` | Bitrix24 error (error text in `message`) |
| 403 | `SCOPE_DENIED` | The API key lacks the `imbot` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## See also

- [Typing indicator](/docs/bots/ui/typing) — bot action status
- [Keyboard](/docs/bots/messages/keyboard) — buttons for input without a text field
- [Bot platform](/docs/bots) — overview, quick start
- [Limits and optimization](/docs/optimization) — platform rate limits
