## Create a quick reply

`POST /v1/openline-configs/:lineId/quick-replies`

Adds a quick reply to an Open Channel — a prepared text that the operator inserts into a conversation with a client.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `lineId` (path) | integer | yes | Open Channel ID. List: [`GET /v1/openline-configs`](/docs/openlines/config/list) |

## Request fields (body)

The body is passed flat, without a `fields` wrapper.

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `text` | string | yes | Reply text. A string of whitespace only is not accepted |
| `sectionId` | integer | no | ID of a section of the same channel from `data.sections` in the [`GET /v1/openline-configs/:lineId/quick-replies`](/docs/openlines/quick-replies/list) response. Without the field the reply is created without a section, and `sectionId` in the response is `0` |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Delivery within the city takes one to two business days",
    "sectionId": 127
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Delivery within the city takes one to two business days",
    "sectionId": 127
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Delivery within the city takes one to two business days',
    sectionId: 127,
  }),
})
const { data } = await res.json()
console.log('Reply ID:', data.id)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Delivery within the city takes one to two business days',
    sectionId: 127,
  }),
})
const { data } = await res.json()
console.log('Reply ID:', data.id)
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data` | object | The created quick reply. Same fields as a `data.replies[]` record in the [quick reply list](/docs/openlines/quick-replies/list) |
| `data.id` | integer | ID of the created reply. Needed to [update](/docs/openlines/quick-replies/update) and [delete](/docs/openlines/quick-replies/delete) it |
| `data.name` | string | Reply name — the first 100 characters of `text` |
| `data.text` | string | Reply text |
| `data.sectionId` | integer | Section ID. `0` means the reply has no section |
| `data.canEdit` | boolean | Whether the key's user can edit the reply |
| `data.rating` | number \| string | Reply rating. A new reply has `1` |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 7279,
    "name": "Delivery within the city takes one to two business days",
    "text": "Delivery within the city takes one to two business days",
    "sectionId": 127,
    "canEdit": true,
    "rating": 1
  }
}
```

## Error response example

400 — `text` was not passed or contains only whitespace:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FIELDS",
    "message": "text must be a non-empty string"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `MISSING_REQUIRED_FIELDS` | `text` was not passed, is empty, or consists of whitespace |
| 400 | `INVALID_PARAMS` | `lineId` is not a positive integer |
| 400 | `INVALID_PARAMS` | `sectionId` is not a non-negative integer |
| 400 | `INVALID_PARAMS` | `sectionId` is not `0` and is not among `data.sections` of this channel. The reply is not created |
| 400 | `INVALID_PARAMS` | The request body is not a JSON object |
| 400 | `INVALID_JSON_BODY` | The request body cannot be parsed as JSON |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not passed |
| 401 | `TOKEN_MISSING` | The key has no valid authorization in Bitrix24 |
| 403 | `SCOPE_DENIED` | The key lacks the `imopenlines` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode |
| 403 | `BITRIX_ACCESS_DENIED` | `sectionId` is passed, but the channel's quick replies are unavailable to the key user: no permission to view them, or the plan does not include them |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access to the key's user |
| 404 | `ENTITY_NOT_FOUND` | There is no Open Channel with this `lineId` |
| 422 | `BITRIX_ERROR` | Bitrix24 returned an error. The text is in `message` |
| 429 | `RATE_LIMITED` | The method's own limit was exceeded. The overall platform ceiling is 120 requests per minute per portal and is split across platform replicas, so the code may arrive before the 120th request. The effective value is in the `x-ratelimit-limit` header |
| 502 | `OPENLINE_OPERATOR_FAILED` | Bitrix24 returned a response of an unexpected shape |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time. The reply may have been created: check the [list of replies](/docs/openlines/quick-replies/list) before retrying |

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

## Known specifics

**The name comes from the text only.** The `name` field in the request body is ignored, and the reply name is built from `text`.

## See also

- [List quick replies](/docs/openlines/quick-replies/list)
- [Update a quick reply](/docs/openlines/quick-replies/update)
- [Delete a quick reply](/docs/openlines/quick-replies/delete)
- [Open Channel quick replies](/docs/openlines/quick-replies)
- [List Open Channel configurations](/docs/openlines/config/list)
