## Update an inventory document

`PATCH /v1/catalog-documents/:id`

Changes the header fields of an inventory document that is not yet conducted.

Pass only the fields to change, flat at the JSON root, without a `fields` wrapper.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Document ID. List: [`GET /v1/catalog-documents`](/docs/entities/catalog-documents/list) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `responsibleId` | number | no | Responsible employee. List: [`GET /v1/users`](/docs/entities/users/list) |
| `title` | string | no | Document title |
| `docNumber` | string | no | Document number |
| `commentary` | string | no | Comment |
| `dateDocument` | datetime | no | Document date |
| `total` | number | no | Document total. Not calculated from the document items: the field holds the passed value |
| `siteId` | string | no | Bitrix24 site ID |
| `modifiedBy` | number | no | Employee who last modified the document. List: [`GET /v1/users`](/docs/entities/users/list) |
| `statusBy` | number | no | Employee who last changed the conducting status. List: [`GET /v1/users`](/docs/entities/users/list) |
| `dateModify` | datetime | no | Last modification date |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/catalog-documents/299" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Stock correction — warehouse 11",
    "commentary": "Recount after stocktaking"
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/catalog-documents/299" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Stock correction — warehouse 11",
    "commentary": "Recount after stocktaking"
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-documents/299', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Stock correction — warehouse 11',
    commentary: 'Recount after stocktaking',
  }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-documents/299', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Stock correction — warehouse 11',
    commentary: 'Recount after stocktaking',
  }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | `true` on successful update |
| `data` | object | The full document after the update. All fields — [Inventory document fields](/docs/entities/catalog-documents/fields) |
| `data.dateModify` | datetime | Modification date, ISO 8601 in UTC |
| `meta.warnings` | array | Returned only if the body contains a field that is not among the document fields. Each item has `code: "UNRECOGNIZED_WRITE_FIELD"`, `field` with the field name, and `message`. On a route that wraps the field map itself, an object under `fields` is rejected with `400 NESTED_FIELDS_ENVELOPE` when the schema does not declare `fields`; pass fields flat at the JSON root. |

## Response example

```json
{
  "success": true,
  "data": {
    "commentary": "Recount after stocktaking",
    "createdBy": 1,
    "currency": "USD",
    "dateCreate": "2026-10-12T13:20:16.000Z",
    "dateDocument": null,
    "dateModify": "2026-10-12T13:20:23.000Z",
    "dateStatus": "2026-10-12T13:20:16.000Z",
    "docNumber": null,
    "docType": "S",
    "id": 299,
    "modifiedBy": 1,
    "responsibleId": 1,
    "siteId": "s1",
    "status": "N",
    "statusBy": null,
    "title": "Stock correction — warehouse 11",
    "total": null
  }
}
```

## Error response example

422 — the document is conducted:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Cannot modify a conducted document",
    "b24Code": "0"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No document with this `id` |
| 422 | `BITRIX_ERROR` | The document is conducted — message `Cannot modify a conducted document`. [Cancel conducting](/docs/entities/catalog-documents/cancel) first |
| 400 | `READONLY_FIELD` | The body contains a field that cannot be changed: `docType`, `currency`, `createdBy`, `status`, `id`, `dateCreate`, `dateStatus`. The field name is in `error.message` |
| 400 | `EMPTY_UPDATE_BODY` | The request body is empty |
| 400 | `NO_RECOGNIZED_UPDATE_FIELDS` | The body contains no updatable field, including when the fields are wrapped in `fields` |
| 400 | `INVALID_PARAMS` | `id` in the path is not a non-negative integer |
| 400 | `INVALID_PARAMS` | The field value has the wrong type: a non-numeric string in a numeric field, for example `"total": "abc"`, or an object or array instead of a number or string. The field name is in `error.message` |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key works in read-only mode |
| 403 | `SCOPE_DENIED` | The API key does not have the `catalog` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is not passed |
| 401 | `INVALID_API_KEY` | The passed API key is not found |

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

## See also

- [Inventory documents](/docs/entities/catalog-documents)
- [Get an inventory document](/docs/entities/catalog-documents/get)
- [Cancel conducting of an inventory document](/docs/entities/catalog-documents/cancel)
- [Inventory document fields](/docs/entities/catalog-documents/fields)
- [Update an inventory document item](/docs/entities/catalog-document-elements/update)
- [Batch](/docs/batch)
