Cancel Batch

Supported Providers
  • OpenAI

Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.

post
Authorizations
Path parameters
batch_idstringRequired

The ID of the batch to cancel.

Responses
200
Batch is cancelling. Returns the cancelling batch's details.
application/json
post
curl https://api.portkey.ai/v1/batches/batch_abc123/cancel \
  -H "x-portkey-api-key: $PORTKEY_API_KEY" \
  -H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
  -H "Content-Type: application/json" \
  -X POST
200

Batch is cancelling. Returns the cancelling batch's details.

{
  "id": "text",
  "object": "batch",
  "endpoint": "text",
  "errors": {
    "object": "text",
    "data": [
      {
        "code": "text",
        "message": "text",
        "param": "text",
        "line": 1
      }
    ]
  },
  "input_file_id": "text",
  "completion_window": "text",
  "status": "validating",
  "output_file_id": "text",
  "error_file_id": "text",
  "created_at": 1,
  "in_progress_at": 1,
  "expires_at": 1,
  "finalizing_at": 1,
  "completed_at": 1,
  "failed_at": 1,
  "expired_at": 1,
  "cancelling_at": 1,
  "cancelled_at": 1,
  "request_counts": {
    "total": 1,
    "completed": 1,
    "failed": 1
  },
  "metadata": {}
}

Last updated

Was this helpful?