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

Search templates

POST /v1/doc-templates/search

Returns the document templates in your Bitrix24 account that match the filter passed in the request body. For result sets of up to 5000 records, use GET /v1/doc-templates with parameters in the query string.

Request fields (body)

Field Type Default Description
Fieldfilter Typeobject Default— DescriptionFilter by template fields. Field list — GET /v1/doc-templates/fields.
Filtering syntax. Example: {"filter": {"active": "Y"}}
Fieldselect Typestring[] Default— DescriptionField selection: ["id", "name", "region"]
Fieldsort Typeobject Default— DescriptionSort by field: {"sort": {"id": "desc"}}
Fieldlimit Typenumber Default50 DescriptionNumber of records (up to 5000)
Fieldoffset Typenumber Default0 DescriptionOffset for pagination

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/doc-templates/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "region": "uk", "active": "Y" },
    "limit": 10,
    "select": ["id", "name", "region", "active"]
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/doc-templates/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "region": "uk", "active": "Y" },
    "limit": 10,
    "select": ["id", "name", "region", "active"]
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { region: 'uk', active: 'Y' },
    limit: 10,
    select: ['id', 'name', 'region', 'active'],
  }),
})

const { success, data, meta } = await res.json()
console.log(`Found ${meta.total} templates`)

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { region: 'uk', active: 'Y' },
    limit: 10,
    select: ['id', 'name', 'region', 'active'],
  }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata Typearray DescriptionArray of templates
Fielddata[].id Typenumber DescriptionTemplate identifier
Fielddata[].name Typestring DescriptionName
Fielddata[].active Typestring DescriptionAvailability: Y / N
Fielddata[].code Typestring | null DescriptionSystem code of the template
Fielddata[].region Typestring DescriptionRegion
Fielddata[].sort Typenumber DescriptionOrder in the list
Fielddata[].createTime Typestring DescriptionCreation date (ISO 8601)
Fielddata[].updateTime Typestring DescriptionUpdate date (ISO 8601)
Fielddata[].createdBy Typenumber DescriptionIdentifier of the employee who created it
Fielddata[].updatedBy Typenumber | null DescriptionIdentifier of the employee who changed it
Fielddata[].moduleId Typestring DescriptionSource module of the template
Fielddata[].fileId Typenumber DescriptionDrive file identifier
Fielddata[].bodyType Typestring DescriptionDocument body format
Fielddata[].numeratorId Typenumber DescriptionNumerator identifier
Fielddata[].withStamps Typestring DescriptionStamps and signatures: Y / N
Fielddata[].productsTableVariant Typestring DescriptionProducts table variant in the document
Fielddata[].isDeleted Typeboolean DescriptionWhether the template is marked deleted
Fielddata[].isDefault Typestring DescriptionDefault template: Y / N
Fielddata[].users Typearray DescriptionIdentifiers of employees who have access to the template
Fielddata[].download Typestring DescriptionDocument download URL
Fielddata[].downloadMachine Typestring DescriptionVibe API URL; requires X-Api-Key with documentgenerator scope
Fieldmeta.total Typenumber DescriptionNumber of records matching the filter
Fieldmeta.hasMore Typeboolean DescriptionWhether there are more records beyond limit
Fieldmeta.durationMs Typenumber DescriptionRequest duration in milliseconds

The meta fields sit next to data, not inside it. Page through the results using meta.hasMore: a data length equal to limit does not rule out the last page.

For the full template field schema, see Template fields.

Response example

JSON
{
  "success": true,
  "data": [
    {
      "id": 209,
      "active": "Y",
      "name": "Contract template",
      "code": null,
      "region": "uk",
      "sort": 500,
      "createTime": "2026-05-12T09:03:38.000Z",
      "updateTime": "2026-05-12T09:03:38.000Z",
      "createdBy": 1,
      "updatedBy": null,
      "moduleId": "rest",
      "fileId": 9175,
      "bodyType": "Bitrix\\DocumentGenerator\\Body\\Docx",
      "numeratorId": 1,
      "withStamps": "N",
      "productsTableVariant": "",
      "isDeleted": false,
      "isDefault": "N",
      "users": ["U1"],
      "download": "/bitrix/services/main/ajax.php?action=documentgenerator.api.template.download&SITE_ID=s1&id=209",
      "downloadMachine": "https://vibecode.bitrix24.com/v1/doc-templates/209/download"
    },
    {
      "id": 211,
      "active": "Y",
      "name": "Invoice template",
      "code": null,
      "region": "uk",
      "sort": 500,
      "createTime": "2026-05-12T09:04:38.000Z",
      "updateTime": "2026-05-12T09:04:38.000Z",
      "createdBy": 1,
      "updatedBy": null,
      "moduleId": "rest",
      "fileId": 5901,
      "bodyType": "Bitrix\\DocumentGenerator\\Body\\Docx",
      "numeratorId": 1,
      "withStamps": "N",
      "productsTableVariant": "",
      "isDeleted": false,
      "isDefault": "N",
      "users": ["U1"],
      "download": "/bitrix/services/main/ajax.php?action=documentgenerator.api.template.download&SITE_ID=s1&id=211",
      "downloadMachine": "https://vibecode.bitrix24.com/v1/doc-templates/211/download"
    }
  ],
  "meta": {
    "total": 2,
    "hasMore": false,
    "durationMs": 799
  }
}

Error response example

400 — filter by a nonexistent field. The message lists the fields available for filtering:

JSON
{
  "success": false,
  "error": {
    "code": "UNKNOWN_FILTER_FIELD",
    "message": "Unknown filter field 'bogusField' for entity 'doc-templates'. Available: id, name, numeratorId, region, code, moduleId, active, bodyType, withStamps, sort, users, fileId, file, createdBy, updatedBy, isDeleted, createTime, updateTime, download, downloadMachine, providers, isDefault, productsTableVariant"
  }
}

Errors

HTTP Code Description
HTTP400 CodeUNKNOWN_FILTER_FIELD DescriptionFilter by a nonexistent field; the message lists the available fields
HTTP400 CodeUNKNOWN_SORT_FIELD DescriptionSort by a nonexistent field in sort; the message lists the available fields
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the documentgenerator scope
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured tokens
HTTP429 CodeRATE_LIMITED DescriptionRate limit exceeded: 300 requests per minute per portal. All API keys of the portal share one limit. The current limit is returned in the x-ratelimit-limit header. Retry after the delay in the Retry-After header

For the full list of common API errors, see Errors.

Known specifics

Sorting and pagination happen on the Vibecode side. sort ({"sort": {"field": "asc|desc"}}) and offset/limit are applied on the Vibecode side: the full set is fetched, sorted, and sliced to the requested window. total and hasMore are computed from the collected set.

String sorting is byte-wise. Sorting by string fields (name, region) compares strings byte by byte, with no locale or case awareness. Numeric (id, sort) and datetime (createTime, updateTime) fields sort correctly. Empty values (null / empty string) always sort to the end.

See also