Untuk agen AI: markdown halaman ini — /docs-content-en/entities/crm-document-templates/download.md indeks dokumentasi — /llms.txt
Artikel dokumentasi saat ini tersedia dalam bahasa Inggris.
Download a CRM document template
GET /v1/crm-document-templates/:id/download
Downloads the source .docx file of a CRM document template through Vibecode: the platform adds Bitrix24 authorization to the request for you.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id (path) |
number | yes | Template ID. List: GET /v1/crm-document-templates |
The request has no body.
Examples
curl — personal key
curl -H "X-Api-Key: YOUR_API_KEY" \
"https://vibecode.bitrix24.com/v1/crm-document-templates/87/download" \
-o template-87.docx
curl — OAuth application
curl -H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
"https://vibecode.bitrix24.com/v1/crm-document-templates/87/download" \
-o template-87.docx
JavaScript — personal key
const res = await fetch(
'https://vibecode.bitrix24.com/v1/crm-document-templates/87/download',
{ headers: { 'X-Api-Key': 'YOUR_API_KEY' } }
)
if (!res.ok) {
const body = await res.json()
throw new Error(body.error?.code ?? String(res.status))
}
const blob = await res.blob()
JavaScript — OAuth application
const res = await fetch(
'https://vibecode.bitrix24.com/v1/crm-document-templates/87/download',
{
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
}
)
if (!res.ok) {
const body = await res.json()
throw new Error(body.error?.code ?? String(res.status))
}
const blob = await res.blob()
Response headers
On success, the response has HTTP status 200 OK, and the body contains the bytes of the .docx file.
| Header | Example value | Description |
|---|---|---|
Content-Type |
application/vnd.openxmlformats-officedocument.wordprocessingml.document |
Content type that Bitrix24 returned for the template file |
Content-Disposition |
attachment; filename="template-87.docx" |
File name for saving. Built from the template id as template-<id>.docx; the template name is not part of it |
Response example
HTTP/1.1 200 OK
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: attachment; filename="template-87.docx"
Transfer-Encoding: chunked
<binary .docx content, 10872 bytes, starts with PK>
Error response example
404 — template not found:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "CRM template not found."
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS |
id is not a positive integer. Message: Template ID must be a positive integer. |
| 404 | ENTITY_NOT_FOUND |
No template with this id exists, or it does not belong to the CRM module. Message: CRM template not found. |
| 404 | ENTITY_NOT_FOUND |
The template exists but has no download URL. Message: CRM template download not found. |
| 502 | DOWNLOAD_FAILED |
Bitrix24 did not return the file: it responded with an error code, for example Bitrix24 returned 403, or returned a URL outside the portal or without HTTPS |
| 422 | BITRIX_ERROR |
Bitrix24 rejected the request to read the template. The reason is in error.message |
| 403 | SCOPE_DENIED |
The key lacks the crm scope |
| 401 | TOKEN_MISSING |
The key has no configured tokens |
| 429 | RATE_LIMITED |
Bitrix24 rate-limited requests to the portal. Retry after the delay in the Retry-After header |
Full list of common API errors — Errors.
Known specifics
A read-only key works. Downloading does not count as a write, so a key without write permission gets the file the same way as a full-access key.
The downloadMachine field points here. In the responses of GET /v1/crm-document-templates/:id and GET /v1/crm-document-templates, this field contains the URL of this endpoint.