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. Full list is in the field reference.

Parameters

Parameter Type Required Description
id (path) number yes Document identifier

Request fields (body)

Parameter Type Description
title string Document title
number string Document number
stampsEnabled boolean Stamps and signatures on the document
values object Values for the template's label fields

Examples

curl — personal key

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/documents/51" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Supply contract 2026-001 (rev.)",
    "stampsEnabled": true
  }'

curl — OAuth application

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/documents/51" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Supply contract 2026-001 (rev.)",
    "stampsEnabled": true
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/51', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Supply contract 2026-001 (rev.)',
    stampsEnabled: true,
  }),
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/51', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Supply contract 2026-001 (rev.)',
    stampsEnabled: true,
  }),
})

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": {
    "id": 51,
    "title": "Supply contract 2026-001 (rev.)",
    "number": "2026-001",
    "templateId": 53,
    "provider": "Bitrix\\DocumentGenerator\\DataProvider\\Rest",
    "value": "ORDER-1024",
    "createTime": "2026-03-18T17:27:48+00:00",
    "updateTime": "2026-03-20T09:14:11+00:00",
    "createdBy": 503,
    "updatedBy": 503,
    "values": { "DocumentNumber": "2026-001" },
    "stampsEnabled": true,
    "publicUrl": "https://example.bitrix24.com/~aBcDeF",
    "downloadUrl": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=documentgenerator.api.document.getfile&id=51",
    "pdfUrl": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=documentgenerator.api.document.getpdf&id=51"
  }
}

Error response example

404 — document not found:

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

Errors

HTTP Code Description
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