API referenceBatchesCancel a batch

Cancel a batch

⚠️
Preview — this feature is being built; the design below is the spec.
POST https://app.syntic.ai/v1/batches/{batch_id}/cancel

Stop starting new requests in a batch. Requests already running finish; the batch moves to canceling, then canceled, and the results file contains every line that finished. Unstarted lines appear with result.type: "canceled" and are not billed.

For how this fits into a full workflow, see Batches.

Headers

HeaderRequiredValue
AuthorizationYesBearer <key>: a private inference key (sk_live_...). See Authentication.

Path parameters

ParameterTypeDescription
batch_idstringThe batch id.

Response

200 OK, Content-Type: application/json

{
  "id": "batch_01JBXF3P8K",
  "object": "batch",
  "status": "canceling",
  "input_file_id": "file_01JBXF1Z",
  "output_file_id": null,
  "error_file_id": null,
  "request_counts": {
    "total": 5000,
    "succeeded": 3120,
    "failed": 4,
    "canceled": 0
  },
  "created_at": 1791820800,
  "started_at": 1791820860,
  "ends_by": 1791907200,
  "completed_at": null,
  "metadata": {
    "job": "october-tickets"
  }
}

Examples

curl -sS -X POST https://app.syntic.ai/v1/batches/batch_01JBXF3P8K/cancel \
  -H "Authorization: Bearer $SYNTIC_API_KEY"

Errors

Errors use the error envelope and carry a request_id. Codes specific to this operation:

StatustypecodeWhen
404not_found_errorbatch_not_foundUnknown id or another workspace’s batch.
409conflict_errorbatch_not_cancelableThe batch already reached a final state.
401authentication_errorinvalid_api_keyThe key is missing, unknown, revoked or expired.
429rate_limit_errorrate_limitedToo many requests; wait for Retry-After. See Rate-limit headers.
Was this page helpful?