## 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 |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Document ID, a positive integer. Documents of a record: [`GET /v1/crm-documents`](/docs/entities/documents/crm-list) |

## Examples

### curl — personal key

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

### curl — OAuth application

```bash
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 |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data.id` | string | Document ID |
| `data.title` | string | Document title |
| `data.number` | string | Document number |
| `data.templateId` | string | Template ID. Templates for a record: [`GET /v1/crm-document-templates/available`](/docs/entities/crm-document-templates/available) |
| `data.entityTypeId` | string | Type of the CRM record the document is attached to. Values are in the "CRM record types" list on the [`GET /v1/crm-documents`](/docs/entities/documents/crm-list) page |
| `data.entityId` | string | ID of the CRM record the document is attached to |
| `data.values` | object | Template field values passed on creation and update, along with service keys |
| `data.stampsEnabled` | boolean | Stamps and signatures flag, see "Known specifics" |
| `data.changeStampsEnabled` | boolean | Whether stamps and signatures can be enabled: `false` if the template has none |
| `data.changeStampsDisabledReason` | string \| null | Why stamps cannot be enabled. `null` if they can |
| `data.qrCodeEnabled` | boolean | Whether the QR code is enabled in the document |
| `data.changeQrCodeEnabled` | boolean | Whether the QR code can be enabled: `false` if the template has none |
| `data.changeQrCodeDisabledReason` | string \| null | Why the QR code cannot be enabled. `null` if it can |
| `data.products.currencyId` | string | Currency of the document's products |
| `data.products.totalSum` | string \| number | Total of the document's products as a string, for example `"0.00"`. The number `0` if the `entityId` record does not exist |
| `data.products.totalRows` | number | Number of product rows in the document |
| `data.publicUrl` | string \| null | Public link to the document. `null` until the link is enabled via [`POST /v1/crm-documents/:id/public-url`](/docs/entities/documents/crm-public-url) |
| `data.isTransformationError` | boolean | Whether converting the document to PDF and image failed |
| `data.emailDiskFile` | number | ID of the DOCX file copy on Drive. File: [`GET /v1/files/:id`](/docs/entities/files) |
| `data.pullTag` | string | Service tag of the document |
| `data.createTime` | string | Creation date in ISO 8601 format |
| `data.updateTime` | string | Modification date in ISO 8601 format |
| `data.createdBy` | string | Creator ID. List: [`GET /v1/users`](/docs/entities/users) |
| `data.updatedBy` | string \| null | ID of the last editor. `null` if the document has not been modified. List: [`GET /v1/users`](/docs/entities/users) |
| `data.downloadUrl` | string | Link to the DOCX file for an employee in the browser |
| `data.pdfUrl` | string | Link to the PDF for an employee in the browser. The field is absent while the PDF is being generated |
| `data.imageUrl` | string | Link to the image for an employee in the browser. The field is absent while the image is being generated |
| `data.downloadUrlMachine` | string | URL of [`/v1/crm-documents/:id/download`](/docs/entities/documents/download). Requires `X-Api-Key` with the `crm` scope |
| `data.pdfUrlMachine` | string | URL of [`/v1/crm-documents/:id/pdf`](/docs/entities/documents/pdf). The field is absent while the PDF is being generated |
| `data.imageUrlMachine` | string | URL of [`/v1/crm-documents/:id/image`](/docs/entities/documents/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 |
|------|-----|---------|
| 400 | `INVALID_PARAMS` | `id` is not a positive integer, for example `abc` or `0`. Message: `id must be a positive integer` |
| 404 | `ENTITY_NOT_FOUND` | No document with this `id` exists, or it was deleted |
| 502 | `BITRIX_INVALID_RESPONSE` | Bitrix24 responded without a document |
| 403 | `BITRIX_ACCESS_DENIED` | No access to the CRM record the document is attached to, including when the record does not exist. Message: `Access denied` |
| 403 | `SCOPE_DENIED` | The key lacks the `crm` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | No tokens are mapped to the key: an OAuth application key was called without a user session |

Full list of common API errors: [Errors](/docs/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](/docs/entities/documents/crm-create) and [update](/docs/entities/documents/crm-update) responses.

## See also

- [Documents by CRM entity](/docs/entities/documents/crm-list)
- [Create a CRM document](/docs/entities/documents/crm-create)
- [Update a CRM document](/docs/entities/documents/crm-update)
- [Delete a CRM document](/docs/entities/documents/crm-delete)
- [Download document PDF](/docs/entities/documents/pdf)
- [Documents](/docs/entities/documents)
