For AI agents: markdown of this page — /docs-content-en/entities/documents/update.md documentation index — /llms.txt

Update document

PATCH /v1/documents/:id

Updates fields of an existing document — pass only the fields you change. System fields (dates, author, file links) are read-only. The full list is in the field reference.

Parameters

Parameter Type Required Description
id (path) number yes Document identifier. List: GET /v1/documents

Request fields (body)

Field Type Required Description
values object no Values of the template's label fields as "label — value" pairs
values.DocumentNumber string no Document number. The number field is filled from this label
stampsEnabled boolean no Stamps and signatures. false turns stamps off. true does not turn them on: the response comes back with stampsEnabled: false. Stamps are turned on when the field is omitted, so to keep them off, pass stampsEnabled: false in every request

The request accepts the title, number, templateId, value and fileId fields without an error but does not change them. A document gets its title at creation and keeps it after updates.

Examples

curl — personal key

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/documents/2001" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "values": { "DocumentNumber": "2026-002" },
    "stampsEnabled": false
  }'

curl — OAuth application

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/documents/2001" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "values": { "DocumentNumber": "2026-002" },
    "stampsEnabled": false
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/2001', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    values: { DocumentNumber: '2026-002' },
    stampsEnabled: false,
  }),
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/2001', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    values: { DocumentNumber: '2026-002' },
    stampsEnabled: false,
  }),
})

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

Response fields

Field Type Description
success boolean Always true on success
data object The document object with all fields — see Document fields

Response example

JSON
{
  "success": true,
  "data": {
    "downloadUrl": "/bitrix/services/main/ajax.php?action=documentgenerator.api.document.getfile&SITE_ID=s1&id=2001&ts=1791526169",
    "publicUrl": null,
    "title": "TEST VibeDocs A B-001",
    "number": "2026-002",
    "id": 2001,
    "createTime": "2026-10-08T18:12:02.000Z",
    "createdBy": 1317,
    "updateTime": "2026-10-09T06:09:29.000Z",
    "updatedBy": 1317,
    "stampsEnabled": false,
    "isTransformationError": false,
    "value": "VIBE-DOCS-B-1",
    "values": {
      "productsTableVariant": "",
      "_creationMethod": "rest",
      "DocumentNumber": "2026-002"
    },
    "templateId": 237,
    "provider": "Bitrix\\DocumentGenerator\\DataProvider\\Rest",
    "pullTag": "TRANSFORMDOCUMENT2001",
    "emailDiskFile": 10609,
    "downloadUrlMachine": "https://vibecode.bitrix24.com/v1/documents/2001/download"
  }
}

Error response example

404 — document not found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Document not found"
  }
}

Errors

HTTP Code Description
400 READONLY_FIELD The body contains a read-only field — including the PDF conversion state (isTransformationError, transformationErrorCode, transformationErrorMessage, transformationCancelReason) and the subscription tag pullTag. The check runs before the call to Bitrix24, so this error is returned even for a non-existent id
404 ENTITY_NOT_FOUND No document with the given id exists
403 SCOPE_DENIED The key is missing the documentgenerator scope
401 MISSING_API_KEY The X-Api-Key header was not provided

Full list of common API errors — Errors.

See also