Skip to content

Finish tasks

Endpoint

POST /bot/forms/{form_id}/tasks/finish

Finishes one or more open tasks in a form.

Auth

http
Authorization: Bearer <bot_token>
Content-Type: application/json

The bot must have access to the form with permission to close tasks.

Path params

  • form_id - form ID containing the tasks

Request body

json
{
  "task_ids": [123, 456]
}

task_ids must contain from 1 to 1,000 unique positive integers.

Example

bash
curl -X POST \
  -H "Authorization: Bearer <bot_token>" \
  -H "Content-Type: application/json" \
  -d '{"task_ids":[123,456]}' \
  https://public-api.hcapp.ee/bot/forms/12/tasks/finish

Response body

json
{
  "success": true,
  "error_message": null,
  "data": {
    "finished_task_ids": [123, 456]
  }
}

Only tasks that belong to the specified form and were open when the request was processed are returned in finished_task_ids. Already-finished and unknown task IDs are omitted.

Finishing a task updates its activity time, creates a system comment, and triggers the normal post-finish processing.

Errors

  • 401 - missing, invalid, expired, or revoked bot token.
  • 403 No rights - the bot does not have permission to close tasks in the form.
  • 422 - task_ids is empty, contains more than 1,000 values, contains duplicates, or contains a non-positive ID.
  • 429 - rate limit exceeded.

The endpoint uses the standard bot update rate limit.