لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/entities/documents/crm-get.md فهرس التوثيق — /llms.txt

مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.

Get a CRM document

GET /v1/crm-documents/:id

Returns a document created for a CRM record by its ID, with its number, template field values and file links. A read-only key is accepted.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionDocument ID, a positive integer. Documents of a record: GET /v1/crm-documents

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/crm-documents/1961" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/crm-documents/1961" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-documents/1961', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log(data.number, data.pdfUrlMachine ?? 'PDF is still being generated')

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-documents/1961', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

Response fields

The IDs id, templateId, entityTypeId, entityId, createdBy and updatedBy are returned as strings.

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.id Typestring DescriptionDocument ID
Fielddata.title Typestring DescriptionDocument title
Fielddata.number Typestring DescriptionDocument number
Fielddata.templateId Typestring DescriptionTemplate ID. Templates for a record: GET /v1/crm-document-templates/available
Fielddata.entityTypeId Typestring DescriptionType of the CRM record the document is attached to. Values are in the "CRM record types" list on the GET /v1/crm-documents page
Fielddata.entityId Typestring DescriptionID of the CRM record the document is attached to
Fielddata.values Typeobject DescriptionTemplate field values passed on creation and update, along with service keys
Fielddata.stampsEnabled Typeboolean DescriptionStamps and signatures flag, see "Known specifics"
Fielddata.changeStampsEnabled Typeboolean DescriptionWhether stamps and signatures can be enabled: false if the template has none
Fielddata.changeStampsDisabledReason Typestring | null DescriptionWhy stamps cannot be enabled. null if they can
Fielddata.qrCodeEnabled Typeboolean DescriptionWhether the QR code is enabled in the document
Fielddata.changeQrCodeEnabled Typeboolean DescriptionWhether the QR code can be enabled: false if the template has none
Fielddata.changeQrCodeDisabledReason Typestring | null DescriptionWhy the QR code cannot be enabled. null if it can
Fielddata.products.currencyId Typestring DescriptionCurrency of the document's products
Fielddata.products.totalSum Typestring | number DescriptionTotal of the document's products as a string, for example "0.00". The number 0 if the entityId record does not exist
Fielddata.products.totalRows Typenumber DescriptionNumber of product rows in the document
Fielddata.publicUrl Typestring | null DescriptionPublic link to the document. null until the link is enabled via POST /v1/crm-documents/:id/public-url
Fielddata.isTransformationError Typeboolean DescriptionWhether converting the document to PDF and image failed
Fielddata.emailDiskFile Typenumber DescriptionID of the DOCX file copy on Drive. File: GET /v1/files/:id
Fielddata.pullTag Typestring DescriptionService tag of the document
Fielddata.createTime Typestring DescriptionCreation date in ISO 8601 format
Fielddata.updateTime Typestring DescriptionModification date in ISO 8601 format
Fielddata.createdBy Typestring DescriptionCreator ID. List: GET /v1/users
Fielddata.updatedBy Typestring | null DescriptionID of the last editor. null if the document has not been modified. List: GET /v1/users
Fielddata.downloadUrl Typestring DescriptionLink to the DOCX file for an employee in the browser
Fielddata.pdfUrl Typestring DescriptionLink to the PDF for an employee in the browser. The field is absent while the PDF is being generated
Fielddata.imageUrl Typestring DescriptionLink to the image for an employee in the browser. The field is absent while the image is being generated
Fielddata.downloadUrlMachine Typestring DescriptionURL of /v1/crm-documents/:id/download. Requires X-Api-Key with the crm scope
Fielddata.pdfUrlMachine Typestring DescriptionURL of /v1/crm-documents/:id/pdf. The field is absent while the PDF is being generated
Fielddata.imageUrlMachine Typestring DescriptionURL of /v1/crm-documents/:id/image. The field is absent while the image is being generated

Response example

JSON
{
  "success": true,
  "data": {
    "changeStampsEnabled": false,
    "changeStampsDisabledReason": "The template has no stamps or signatures",
    "changeQrCodeEnabled": false,
    "qrCodeEnabled": false,
    "changeQrCodeDisabledReason": "The template has no QR code",
    "products": {
      "currencyId": "USD",
      "totalSum": "0.00",
      "totalRows": 0
    },
    "downloadUrl": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=crm.documentgenerator.document.download&SITE_ID=s1&id=1961",
    "publicUrl": null,
    "title": "Addresses A463//10/2026",
    "number": "A463//10/2026",
    "id": "1961",
    "createTime": "2026-10-08T17:43:04+00:00",
    "createdBy": "1317",
    "updateTime": "2026-10-08T17:43:04+00:00",
    "updatedBy": null,
    "stampsEnabled": true,
    "isTransformationError": false,
    "values": {
      "productsTableVariant": "",
      "stampsEnabled": true,
      "_creationMethod": "rest"
    },
    "templateId": "87",
    "pullTag": "TRANSFORMDOCUMENT1961",
    "imageUrl": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=crm.documentgenerator.document.getImage&SITE_ID=s1&id=1961",
    "pdfUrl": "https://example.bitrix24.com/bitrix/services/main/ajax.php?action=crm.documentgenerator.document.getPdf&SITE_ID=s1&id=1961",
    "emailDiskFile": 10365,
    "entityId": "8781",
    "entityTypeId": "2",
    "downloadUrlMachine": "https://vibecode.bitrix24.com/v1/crm-documents/1961/download",
    "imageUrlMachine": "https://vibecode.bitrix24.com/v1/crm-documents/1961/image",
    "pdfUrlMachine": "https://vibecode.bitrix24.com/v1/crm-documents/1961/pdf"
  }
}

Error response example

404 — no document with this id exists, or it was deleted:

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

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS Descriptionid is not a positive integer, for example abc or 0. Message: id must be a positive integer
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo document with this id exists, or it was deleted
HTTP502 CodeBITRIX_INVALID_RESPONSE DescriptionBitrix24 responded without a document
HTTP403 CodeBITRIX_ACCESS_DENIED DescriptionNo access to the CRM record the document is attached to, including when the record does not exist. Message: Access denied
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the crm scope
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeTOKEN_MISSING DescriptionNo tokens are mapped to the key: an OAuth application key was called without a user session

Full list of common API errors: Errors.

Known specifics

Downloading before the file is ready. While the pdfUrlMachine and imageUrlMachine fields are absent, downloading the PDF or image returns 409 DOCUMENT_NOT_READY. Retry this method or the download itself every few seconds until the field appears.

stampsEnabled does not show whether the file has stamps. For a document generated from a template, the method returns stampsEnabled: true even when the document was created or updated with stampsEnabled: false and the file was generated without stamps. The stamps flag the file was actually generated with is returned in the create and update responses.

See also