Files & Batches
Cancel Batch
Cancel a batch that has not finished.
Request cancellation of a queued or running batch. The response contains its current status: cancellation may still be in progress or may already be complete. A batch that has already finished keeps its existing terminal status. If the returned status is not terminal, retrieve the batch again to check the result. An unknown batch ID returns 404 batch_not_found.
Request
curl -X POST "https://api.tokenlab.sh/v1/batches/batch_abc123/cancel" \
-H "Authorization: Bearer sk-your-api-key"Response
{
"id": "batch_abc123",
"object": "batch",
"status": "cancelling",
"input_file_id": "file_abc123"
}idstring
Batch ID.
statusstring
Current batch status. Do not assume every successful cancellation request returns
cancelling.Authorization
BearerAuth AuthorizationBearer <token>
API Key authentication. Create or manage API keys in Dashboard > API > API Keys.
In: header
Path Parameters
batch_id*string
Response
application/json
application/json
application/json