---
title: "Cancel batch"
method: POST
path: "/batches/{batch_id}/cancel"
tags: ["Batch"]
---

# Cancel batch

`POST /batches/{batch_id}/cancel`

Cancels a batch that is currently in progress. You can only cancel batches that are in `validating` or `in_progress` status. The batch status will change to `cancelling` for up to 10 minutes before transitioning to `cancelled`. At that point, partial results (if any) will be available in the output file, and any unfinished requests will be listed in the errors file.

## Path parameters

- `batch_id` string, required

## Response `200`

Success. The Batch object matching the specified ID.

- BatchObject
  - `id` string — The batch identifier.
  - `object` string — The object type, which is always `batch`.
  - `endpoint` string — The endpoint used by the batch.
  - `errors` object — The error object containing the error code and message.
    - `object` string — The object type, which is always `list`.
    - `data` object[] — An array of error objects.
      - `code` string — An error code identifying the error type.
      - `line` integer, nullable — The line number in the input file where the error occurred, if applicable.
      - `message` string — A human-readable message providing more details about the error.
      - `param` string, nullable — The parameter that caused the error, if applicable.
  - `input_file_id` string — The ID of the input file for the batch.
  - `completion_window` string — The time frame within which the batch should be processed.
  - `model` string — The model used by the endpoint.
  - `status` string — The current status of the batch.
  - `output_file_id` string — The ID of the file containing the outputs of successfully executed requests.
  - `error_file_id` string — The ID of the file containing the outputs of requests with errors.
  - `request_counts` object — The request counts for different statuses within the batch.
    - `total` integer — The total number of requests in the batch.
    - `completed` integer — The number of requests that have been completed successfully.
    - `failed` integer — The number of requests that have failed.
  - `metadata` object — Set of key-value pairs attached to batch. This can be useful for storing additional information about the batch in a structured format.
  - `created_at` string — RFC 3339 datetime string for when the batch was created.
  - `in_progress_at` string — RFC 3339 datetime string for when the batch started processing.
  - `finalizing_at` string — RFC 3339 datetime string for when the batch started finalizing.
  - `completed_at` string — RFC 3339 datetime string for when the batch was completed.
  - `failed_at` string — RFC 3339 datetime string for when the batch failed.
  - `expected_completion_at` string — RFC 3339 datetime string for when the batch is expected to complete.
  - `cancelling_at` string — RFC 3339 datetime string for when the batch started canceling.
  - `cancelled_at` string — RFC 3339 datetime string for when the batch was canceled.

## Other responses

- `4XX` — Client error <p> This indicates an issue with the request format or frequency. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes) guide. </p>
- `5XX` — Server Error <p> This indicates our servers are experiencing high traffic or having an unexpected issue. Please see our [Error Codes](https://docs.voyageai.com/docs/error-codes) guide. </p>

---

[API](https://skmtc.net/voyageai/apis/voyage-api.md) · [All operations](https://skmtc.net/voyageai/apis/voyage-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/voyageai/voyage-api/versions/b5a3e09c43ce/schema)
