Skip to content
API referenceCancel a batch

Cancel a batch

POST/v1/batches/{id}/cancel

Cancel a batch.

Compatible with OpenAI's cancel-batch endpoint: asks the provider to cancel an in-progress batch. The returned batch shows its new status (cancelling, then cancelled). With a virtual key, only batches that key created are reachable; any other batch id is a 404.

Authenticate with a BYOK virtual key or with x-provider and x-api-key; a PLATFORM virtual key is a 400. OpenAI credentials only; any other provider is a 422. Without x-retry-count a failed call is retried up to 3 times on 429 and 5xx.

Authorization

  • AuthorizationBearer <slug>.<secret>

    A virtual key's API key (vk-....<secret>), as Authorization: Bearer. What the OpenAI SDK sends from its api_key. Used by the inference endpoints.

  • orx-virtual-keyheader

    A virtual key's API key in the x-virtual-key header, for clients that keep Authorization for something else.

  • orx-api-keyheader

    Direct credentials: the provider's own API key in x-api-key, with the provider named in x-provider (for example openai). On /v1/messages a virtual key is accepted in x-api-key too, which is what the Claude SDK sends.

Path parameters

  • idstringrequired

    the provider's batch id, for example batch_...

Headers

  • x-providerstring

    With direct credentials: the provider x-api-key belongs to, for example openai or anthropic (case and dashes are normalised). Not used with a virtual key.

  • x-retry-countinteger<int32>

    How many times to retry a failed provider call, 0 to 5. Without the header, chat completions, Claude Messages and prompt completions do not retry, and the other endpoints retry up to 3 times. Retries back off exponentially from 1 second and honour a numeric Retry-After. The number made is in the x-retry-count response header.

  • x-retry-status-codesstring

    Comma-separated provider status codes to retry on. Default 429,500,502,503,504,529.

Responses

200application/json
  • idstring

    The provider's batch id, for example batch_....

  • objectstring

    Always batch.

  • endpointstring

    The endpoint every request in the batch is sent to, for example /v1/chat/completions.

  • errorsobject

    The errors with the batch as a whole.

    Child attributes
    • objectstring

      Always list.

    • dataobject[]

      The errors.

      Child attributes
      • codestring

        The provider's error code.

      • messagestring

        A human-readable description of the error.

      • paramstring

        The parameter the error is about. Absent when it is not about a parameter.

      • lineinteger<int32>

        The line of the input file the error is on, from 1. Absent when it is not about a line.

  • input_file_idstring

    The provider's id of the input file.

  • completion_windowstring

    The time the batch has to complete, for example 24h.

  • statusenum<string>

    The batch's state: validating (checking the input file), in_progress (running), finalizing (assembling the results), completed (done; output_file_id is set), failed (failed before running; see errors), expired (did not finish within completion_window), cancelling or cancelled.

    One of "validating", "in_progress", "finalizing", "completed", "failed", "expired", "cancelling", "cancelled"

  • output_file_idstring

    The provider's id of the file with the successful results. Absent until the batch has results.

  • error_file_idstring

    The provider's id of the file with the failed requests' errors. Absent when there are none.

  • created_atinteger<int64>

    When the batch was created, as a Unix timestamp in seconds.

  • in_progress_atinteger<int64>

    When the batch started running, as a Unix timestamp in seconds. Absent until then.

  • expires_atinteger<int64>

    When the batch expires, as a Unix timestamp in seconds.

  • finalizing_atinteger<int64>

    When the batch started finalizing, as a Unix timestamp in seconds. Absent until then.

  • completed_atinteger<int64>

    When the batch completed, as a Unix timestamp in seconds. Absent until then.

  • failed_atinteger<int64>

    When the batch failed, as a Unix timestamp in seconds. Absent unless it failed.

  • expired_atinteger<int64>

    When the batch expired, as a Unix timestamp in seconds. Absent unless it expired.

  • cancelling_atinteger<int64>

    When cancellation started, as a Unix timestamp in seconds. Absent unless it was cancelled.

  • cancelled_atinteger<int64>

    When the batch was cancelled, as a Unix timestamp in seconds. Absent unless it was cancelled.

  • request_countsobject

    How many of the batch's requests have finished so far.

    Child attributes
    • totalinteger<int32>

      Requests in the batch.

    • completedinteger<int32>

      Requests that completed successfully.

    • failedinteger<int32>

      Requests that failed.

  • metadatamap<string, string>

    The key/value pairs you attached when creating the batch. Absent when none were.

NVIDIA Inception Program member

VectorAxis is built by GK Labs, a member of NVIDIA Inception.