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
ParameterentityTypeId (query) Typenumber Requiredyes DescriptionCRM record type: 2 — deal, 3 — contact, 4 — company. Smart process types: GET /v1/smart-processes. A positive integer, passed once
ParameterentityId (query) Typenumber Requiredyes DescriptionID 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
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.templates Typearray DescriptionTemplates available for the record. An empty array means no matching templates
Fielddata.templates[].id Typenumber DescriptionTemplate ID. Full template record: GET /v1/crm-document-templates/:id
Fielddata.templates[].title Typestring DescriptionTemplate name
Fielddata.templates[].documentCreationUrl Typestring DescriptionRelative path to the page that creates a document from this template for this record in the Bitrix24 web interface, without the Bitrix24 account domain
Fielddata.templates[].isWithStamps Typeboolean DescriptionWhether 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
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo record with this entityId exists for this entityTypeId. The record's existence is checked before templates are requested
HTTP400 CodeINVALID_PARAMS DescriptionentityTypeId or entityId is missing, is not a positive integer or is passed more than once
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 does not support this entityTypeId, for example 999: error.b24Code equals ENTITY_TYPE_NOT_SUPPORTED
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the crm scope
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured tokens
HTTP429 CodeRATE_LIMITED DescriptionBitrix24 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