Skip to main content

Complete a task

Completing a task finishes a document that waits for a person, as it is, like Complete task in the app.

POST https://api.send.ai/v2/{team_id}/project/{project_id}/task/{task_id}/complete

Scope: Tasks › Edit.

Request​

The request has no body: the API cannot change the data of a document, only complete it.

curl -X POST "https://api.send.ai/v2/tK3vQ9xLm2Rf8WbN0aZp/project/p3irz/task/task_Zp4Rk2Wn8Qx1Lc7Vb3M/complete" \
-H "Authorization: Bearer $SENDAI_API_KEY"

What completing does​

What happens depends on the step of the task:

  • A task such as Orders: The document is completed with its data. Validation errors block it, as in the app; warnings do not. Once every document of the upload is done, the actions run and the upload moves to Processed.
  • The Router: The document follows the route of the class it has, to a task, a folder or the Bin.

Completing sends the TASK_COMPLETED notification. See Events.

Response​

The answer holds the task in payload, in the same shape as Get a task, with "message": "Task processing started". The work is done by the time the answer comes.

Errors​

StatusErrorCause
400Cannot process the task while there are errorsThe document has validation errors; it stays in review.
400No label selectedA Router document has no class yet.