For AI agents: markdown of this page — /docs-content-en/entities/documents/get.md documentation index — /llms.txt
Get document
GET /v1/documents/:id
Returns a document by identifier with all fields, including links to the ready file, PDF, and image.
Parameters
| Parameter | Type | Req. | Description |
|---|---|---|---|
id (path) |
number | yes | Document identifier |
Examples
curl — personal key
curl "https://vibecode.bitrix24.com/v1/documents/51" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl "https://vibecode.bitrix24.com/v1/documents/51" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/51', {
headers: {
'X-Api-Key': 'YOUR_API_KEY',
},
})
const { success, data } = await res.json()
console.log('Document:', data.title, '—', data.number)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/documents/51', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
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
{
"success": true,
"data": {
"id": 51,
"title": "Supply contract 2026-001",
"number": "2026-001",
"templateId": 53,
"provider": "Bitrix\\DocumentGenerator\\DataProvider\\Rest",
"value": "ORDER-1024",
"fileId": 241,
"pdfId": 245,
"imageId": 243,
"createTime": "2026-03-18T17:27:48+00:00",
"updateTime": "2026-03-18T17:27:48+00:00",
"createdBy": 503,
"updatedBy": null,
"values": {
"DocumentNumber": "2026-001",
"ClientName": "Acme LLC"
},
"stampsEnabled": false,
"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",
"imageUrl": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=documentgenerator.api.document.getimage&id=51",
"downloadUrlMachine": "https://example.bitrix24.com/rest/documentgenerator.api.document.getfile.json?token=t0k3n",
"pdfUrlMachine": "https://example.bitrix24.com/rest/documentgenerator.api.document.getpdf.json?token=t0k3n",
"imageUrlMachine": "https://example.bitrix24.com/rest/documentgenerator.api.document.getimage.json?token=t0k3n"
}
}
Error response example
404 — document not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "Document not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 404 | ENTITY_NOT_FOUND |
No document with that id was found |
| 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.