Stop a running or pending batch and refund credits for unprocessed items
pending or running. Credits reserved for items that have not yet started are refunded automatically. Items already being processed will complete normally.
| Field | Type | Description |
|---|---|---|
status | "cancelled" | Confirms the batch was cancelled |
cancelledItems | number | Number of pending items that were stopped. Items already running are not counted |
creditsRefunded | number | Credits returned to your balance. Calculated as cancelledItems × reservedCreditsPerItem |
running when you cancelled will finish processing and consume their credits. Only pending items are cancelled and refunded.| Code | Reason |
|---|---|
401 | Missing x-api-key header |
403 | Invalid or expired API key |
404 | No batch found with this ID, or it belongs to a different user |
409 | The batch is already in a terminal state (completed, failed, or cancelled) and cannot be cancelled |
The batch ID to cancel