Skip to main content

Cancel Job

Cancel a pending or processing job. Returns the final job state with status set to failed and an error message indicating cancellation.

Cancel a job that is currently pending or processing. The job is immediately marked as failed with an error message indicating it was cancelled via the API. Any results that were already processed are preserved and can still be retrieved via the results endpoint.

Cancellation is best-effort. If the job completes between your cancel request and the server processing it, you will receive a 409 conflict error. Already-completed or already-failed jobs cannot be cancelled.
POST/v1/jobs/:id/cancel

Response

Response fields

idstringJob UUID.
namestring | nullOptional human-readable job name.
statusstringAlways "failed" after cancellation.
errorobjectError details: { code: "job_failed", message: "Cancelled via API" }.
completed_atstringISO 8601 timestamp of cancellation.
linksobjectRelated resource URLs (self, dashboard).

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "name": "Q4 Invoice Run",
  "status": "failed",
  "progress": null,
  "estimated_seconds_remaining": null,
  "schema": { "id": "sch_uuid_1", "name": "Invoice" },
  "document_count": 48,
  "completed_documents": 12,
  "grid_stats": null,
  "current_phase": null,
  "error": {
    "code": "job_failed",
    "message": "Cancelled via API"
  },
  "created_at": "2024-09-14T10:32:00.000Z",
  "started_at": "2024-09-14T10:32:05.000Z",
  "completed_at": "2024-09-14T10:33:10.000Z",
  "links": {
    "self": "/v1/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "dashboard": "https://app.talonic.com/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Pair this with GET /v1/jobs/:id/results to retrieve any rows that were processed before cancellation. The completed_documents field in the response tells you how many documents finished before the job was stopped, so you can decide whether the partial results are usable or if a new job is needed.

Errors

Error responses

400validation_errorInvalid job ID format. Must be a UUID.
401unauthorizedMissing or invalid API key.
404not_foundNo job with this ID exists for your organization.
409conflictJob is already completed or failed and cannot be cancelled.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.