Создание таска
Endpoint
POST /bot/forms/{form_id}/tasks
Создает задачу в форме, к которой у bot-пользователя есть доступ.
Auth
http
Authorization: Bearer <token>
Content-Type: application/jsonPath params
form_id- ID формы, в которой создается задача
Минимальный пример create task
Минимальный рабочий payload:
json
{
"task_items": [
{
"form_field_id": 101,
"form_field_type": "TextField",
"value": "Lead from bot"
}
]
}Пример curl:
bash
curl -X POST \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"task_items": [
{
"form_field_id": 101,
"form_field_type": "TextField",
"value": "Lead from bot"
}
]
}' \
https://public-api.hcapp.ee/bot/forms/12/tasksПример с responsible_ids
Для форм со steps responsible_ids обязателен.
json
{
"responsible_ids": [45],
"task_items": [
{
"form_field_id": 101,
"form_field_type": "TextField",
"value": "Lead with responsible"
}
]
}Пример с files
Сначала загрузите файл через POST /bot/files/upload, затем передайте полученные file_id.
json
{
"files": [9001, 9002],
"task_items": [
{
"form_field_id": 101,
"form_field_type": "TextField",
"value": "Request with attachments"
}
]
}Пример с TableField
json
{
"task_items": [
{
"form_field_id": 104,
"form_field_type": "TableField",
"value": [
{
"position": 1,
"items": [
{
"form_field_id": 201,
"form_field_type": "TextField",
"value": "Product A"
},
{
"form_field_id": 202,
"form_field_type": "NumberField",
"value": "2.5"
}
]
}
]
}
]
}Request body
Основные поля запроса:
responsible_ids: number[]participants_ids: number[]task_items: []files: number[]
Также можно передать:
parent_task_idparent_tasks_idsfinish_parent_taskstagsfiles_data
Эти поля сейчас не влияют на создание задачи через bot API.
Поля request body
responsible_idsсписок ID ответственныхparticipants_idsсписок ID участников, максимум5filesсписокfile_id, максимум10task_itemsсписок полей задачи, максимум50
Каждый item в task_items для простого поля содержит:
json
{
"form_field_id": 101,
"form_field_type": "TextField",
"value": "Lead from bot"
}Для FormField дополнительно можно передать linked_task_id.
Для TableField передается массив строк с position и items.
Поведение responsible_ids
- Если у формы есть steps,
responsible_idsобязателен - Если передан один валидный responsible:
task.responsible_idзаполняется сразу- задача назначается напрямую одному ответственному
- Если передано несколько валидных responsible:
- создается групповое назначение
task.responsible_idостаетсяnull
- Назначения в response не возвращаются
- Уведомления ответственным создаются асинхронно и не влияют на payload ответа
Важная деталь ответа: поле responsible_ids в response строится только из task.responsible_id.
Поэтому при group assignment response не вернет исходный список responsible_ids.
Response body
Успешный ответ:
json
{
"success": true,
"error_message": null,
"data": {
"task_id": 5001,
"form_id": 12,
"title": "Lead #5001 Request with attachments",
"author_id": 77,
"responsible_id": 45,
"responsible_ids": [45],
"created_at": "2026-03-29T10:00:00+00:00",
"last_activity": "2026-03-29T10:00:00+00:00",
"is_finished": false,
"status": "new",
"due_date_at": null,
"step_id": 3,
"items": []
}
}Ошибки
403 Form access not found404 Form not found400 responsible_ids is required for forms with steps400 Responsible users are invalid for this form400 Form field {id} not found400 Field {id} type mismatch: expected ..., got ...400 Table child field {id} not found400 Files not found: [...]413 Payload too large. Max size is 131072 bytes
Ограничения
- JSON payload до
128 KB participants_ids <= 5task_items <= 50files <= 10table rows <= 100row items <= 15