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

Task templates

A task template is a preset from which Bitrix24 creates tasks with a predefined title, description, creator and responsible person. The methods in this subsection create templates, read them as a list or one at a time, and change template fields.

Bitrix24 API: tasks.template.add, tasks.template.list, tasks.template.get, tasks.template.update Scope: task

Create a task template

POST /v1/task-templates

Creates a task template in Bitrix24. Template fields are passed in the fields object with their Bitrix24 names, without renaming.

Request fields (body)

Field Type Required Description
Fieldfields Typeobject Requiredyes DescriptionTemplate fields. Passed to Bitrix24 unchanged
Fieldfields.TITLE Typestring Requiredyes DescriptionTitle of the template and of the future task
Fieldfields.CREATED_BY Typenumber Requiredyes DescriptionCreator ID. List: GET /v1/users
Fieldfields.RESPONSIBLE_ID Typenumber Requiredyes DescriptionResponsible person ID. List: GET /v1/users
Fieldfields.DESCRIPTION Typestring Requiredno DescriptionTask description
Fieldfields.PRIORITY Typenumber Requiredno DescriptionPriority: 0 — low, 1 — normal, 2 — high. Defaults to 1
Fieldparams Typeobject Requiredno DescriptionAdditional Bitrix24 parameters. Passed unchanged

The body must not contain keys other than fields and params.

Examples

curl — personal key

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/task-templates" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": {
      "TITLE": "Weekly status report",
      "CREATED_BY": 1,
      "RESPONSIBLE_ID": 1
    }
  }'

curl — OAuth application

Terminal
curl -X POST "https://vibecode.bitrix24.com/v1/task-templates" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "fields": {
      "TITLE": "Weekly status report",
      "CREATED_BY": 1,
      "RESPONSIBLE_ID": 1
    }
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/task-templates', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fields: {
      TITLE: 'Weekly status report',
      CREATED_BY: 1,
      RESPONSIBLE_ID: 1,
    },
  }),
})

const { success, data } = await res.json()
if (success && data > 0) {
  console.log('Template ID:', data)
}

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/task-templates', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fields: {
      TITLE: 'Weekly status report',
      CREATED_BY: 1,
      RESPONSIBLE_ID: 1,
    },
  }),
})

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

Response fields

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue if the request was accepted
Fielddata Typenumber DescriptionID of the created template. 0 — the template was not created: fields lacks TITLE, CREATED_BY or RESPONSIBLE_ID. The response status is still 200, so check that data is greater than zero

Response example

JSON
{
  "success": true,
  "data": 75
}

Error response example

400 — the body has no fields object:

JSON
{
  "success": false,
  "error": {
    "code": "INVALID_PARAMS",
    "message": "Expected fields and only fields, params"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionThe body is not a JSON object, has no fields object, contains keys other than fields and params, or params is not an object
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no Bitrix24 tokens
HTTP403 CodeSCOPE_DENIED DescriptionThe key does not have the task scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is in read-only mode. error.details.switchUrl holds the URL of the section where the mode is changed
HTTP422 CodeBITRIX_ERROR DescriptionBitrix24 rejected the call. The text is in error.message
HTTP429 CodeRATE_LIMITED DescriptionRequest rate exceeded. The effective cap is in the x-ratelimit-limit header

Full list of common API errors — Errors.

See also