For AI agents: markdown of this page — /docs-content-en/entities/crm-document-templates/available.md documentation index — /llms.txt

Get templates for a CRM record

GET /v1/crm-document-templates/available

Returns the CRM document templates that can be applied to a specific deal, contact, company or smart process item. The response includes templates bound to the record type and, for a deal, to its funnel.

Parameters

Parameter Type Required Description
entityTypeId (query) number yes CRM record type: 2 — deal, 3 — contact, 4 — company. Smart process types: GET /v1/smart-processes. A positive integer, passed once
entityId (query) number yes ID of a record of the given type, for example a deal from GET /v1/deals, a contact from GET /v1/contacts, a company from GET /v1/companies or a smart process item from GET /v1/items/:entityTypeId. A positive integer, passed once

Examples

curl — personal key

Terminal
curl "https://vibecode.bitrix24.com/v1/crm-document-templates/available?entityTypeId=2&entityId=575" \
  -H "X-Api-Key: YOUR_API_KEY"

curl — OAuth application

Terminal
curl "https://vibecode.bitrix24.com/v1/crm-document-templates/available?entityTypeId=2&entityId=575" \
  -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-document-templates/available?entityTypeId=2&entityId=575', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Templates for the deal:', data.templates.map(t => t.title))

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/crm-document-templates/available?entityTypeId=2&entityId=575', {
  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.templates array Templates available for the record. An empty array means no matching templates
data.templates[].id number Template ID. Full template record: GET /v1/crm-document-templates/:id
data.templates[].title string Template name
data.templates[].documentCreationUrl string Relative path to the page that creates a document from this template for this record in the Bitrix24 web interface, without the Bitrix24 account domain
data.templates[].isWithStamps boolean Whether the document includes stamps and signatures

Response example

Deal 575 is in the funnel with ID 1. Three of the four templates are shown.

JSON
{
  "success": true,
  "data": {
    "templates": [
      {
        "id": 87,
        "title": "Addresses",
        "documentCreationUrl": "/bitrix/components/bitrix/crm.document.view/slider.php?providerClassName=Bitrix%5CCrm%5CIntegration%5CDocumentGenerator%5CDataProvider%5CDeal&value=575&templateId=87",
        "isWithStamps": true
      },
      {
        "id": 249,
        "title": "Demo product sale",
        "documentCreationUrl": "/bitrix/components/bitrix/crm.document.view/slider.php?providerClassName=Bitrix%5CCrm%5CIntegration%5CDocumentGenerator%5CDataProvider%5CDeal&value=575&templateId=249",
        "isWithStamps": false
      },
      {
        "id": 251,
        "title": "Array format check",
        "documentCreationUrl": "/bitrix/components/bitrix/crm.document.view/slider.php?providerClassName=Bitrix%5CCrm%5CIntegration%5CDocumentGenerator%5CDataProvider%5CDeal&value=575&templateId=251",
        "isWithStamps": false
      }
    ]
  }
}

Error response example

404 — no CRM record with this entityId:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "CRM record not found."
  }
}

Errors

HTTP Code Description
404 ENTITY_NOT_FOUND No record with this entityId exists for this entityTypeId. The record's existence is checked before templates are requested
400 INVALID_PARAMS entityTypeId or entityId is missing, is not a positive integer or is passed more than once
422 BITRIX_ERROR Bitrix24 does not support this entityTypeId, for example 999: error.b24Code equals ENTITY_TYPE_NOT_SUPPORTED
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

Items in this response differ from the template record. Here id is a number and the name is in the title field. In the template list and when getting a template, id is a string and the name is in the name field. When matching templates from the two responses, cast id to the same type.

See also