Skip to main content

Cancel Batch

Cancel an in-progress extraction batch. Only batches in accumulating or submitted status can be cancelled. Completed batches cannot be rolled back.

POST/v1/batches/:id/cancel

Response

Response fields

idstringBatch UUID.
statusstringAlways `cancelled` on success.
providerstringInference provider.
item_countintegerTotal number of items in the batch.
succeeded_countintegerNumber of items that completed before cancellation.
errored_countintegerNumber of items that errored.
expired_countintegerNumber of items that expired.
submitted_atstring | nullISO 8601 timestamp when the batch was submitted.
completed_atstring | nullNull for cancelled batches.
created_atstringISO 8601 creation timestamp.
updated_atstringISO 8601 timestamp of the cancellation.
links.selfstringURL to this batch.

Response

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "cancelled",
  "provider": "anthropic",
  "item_count": 37,
  "succeeded_count": 0,
  "errored_count": 0,
  "expired_count": 0,
  "submitted_at": null,
  "completed_at": null,
  "error_message": null,
  "created_at": "2024-10-02T08:10:00.000Z",
  "updated_at": "2024-10-02T09:15:00.000Z",
  "links": { "self": "/v1/batches/a1b2c3d4-e5f6-7890-abcd-ef1234567890" }
}

Errors

Error responses

400bad_requestBatch is already completed, failed, or cancelled and cannot be cancelled.
401unauthorizedMissing or invalid API key.
404not_foundNo batch with this ID exists for your organization.
429rate_limitedToo many requests. Retry after the period indicated in the Retry-After header.