## Update a quick reply

`PATCH /v1/openline-configs/:lineId/quick-replies/:id`

Replaces the text of an Open Channel quick reply and, if needed, moves it to another section or removes it from its section.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `lineId` (path) | integer | yes | Open Channel ID. List: [`GET /v1/openline-configs`](/docs/openlines/config/list) |
| `id` (path) | integer | yes | ID of a quick reply in this channel. List: `data.replies[].id` in the [`GET /v1/openline-configs/:lineId/quick-replies`](/docs/openlines/quick-replies/list) response |

## Request fields (body)

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

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `text` | string | yes | The full new reply text. A string of whitespace only is not accepted |
| `sectionId` | integer | no | ID of a section in 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's section does not change; `0` removes the reply from its section |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies/7277" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, an operator will reply within a minute",
    "sectionId": 123
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies/7277" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, an operator will reply within a minute",
    "sectionId": 123
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies/7277', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Hello, an operator will reply within a minute',
    sectionId: 123,
  }),
})
const { data } = await res.json()
console.log(data.name, data.sectionId)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/openline-configs/3/quick-replies/7277', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Hello, an operator will reply within a minute',
    sectionId: 123,
  }),
})
const { data } = await res.json()
console.log(data.name, data.sectionId)
```

## Response fields

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

## Response example

```json
{
  "success": true,
  "data": {
    "id": 7277,
    "name": "Hello, an operator will reply within a minute",
    "text": "Hello, an operator will reply within a minute",
    "sectionId": 123,
    "canEdit": true,
    "rating": 1
  }
}
```

## Error response example

404 — the channel from the path has no reply with this `id`:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Quick reply not found in this line"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `MISSING_REQUIRED_FIELDS` | `text` was not passed, is empty, or consists of whitespace |
| 400 | `INVALID_PARAMS` | `lineId` or `id` is not a positive integer |
| 400 | `INVALID_PARAMS` | `sectionId` is not a non-negative integer |
| 400 | `INVALID_PARAMS` | `sectionId` is not `0`, differs from the reply's current section and is not among `data.sections` of this channel. The reply is not changed |
| 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` | The key user has no permission to view the channel's quick replies |
| 403 | `BITRIX_ACCESS_DENIED` | Bitrix24 denied access to the key user when saving |
| 404 | `ENTITY_NOT_FOUND` | Message `Quick reply not found in this line`: the channel from the path has no reply with this `id`, including when the reply belongs to another channel |
| 404 | `ENTITY_NOT_FOUND` | Message `Record 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 update may have been saved: check the [list of replies](/docs/openlines/quick-replies/list) before retrying |

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

## See also

- [List quick replies](/docs/openlines/quick-replies/list)
- [Create a quick reply](/docs/openlines/quick-replies/create)
- [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)
