# Cancel a Batch Job

Cancels an existing batch job.

#### Cancel a batch job

#### Cancel a batch job

## Request

```curl
curl -X POST https://api.stripe.com/v2/core/batch_jobs/batchv2_AbCdEfGhIjKlMnOpQrStUvWxYz/cancel \
  -H "Authorization: Bearer <<YOUR_SECRET_KEY>>" \
  -H "Stripe-Version: 2026-03-25.preview"
```

### Response

```json
{
  "id": "batchv2_AbCdEfGhIjKlMnOpQrStUvWxYz",
  "object": "v2.core.batch_job",
  "created": "2026-03-09T20:55:31.000Z",
  "maximum_rps": 10,
  "metadata": {},
  "skip_validation": false,
  "status": "cancelling",
  "status_details": {}
}
```

#### Cancel a batch job (already cancelled)

#### Cancel a batch job (already cancelled)

## Request

```curl
curl -X POST https://api.stripe.com/v2/core/batch_jobs/batchv2_AbCdEfGhIjKlMnOpQrStUvWxYz/cancel \
  -H "Authorization: Bearer <<YOUR_SECRET_KEY>>" \
  -H "Stripe-Version: 2026-03-25.preview"
```

### Response

```json
{
  "id": "batchv2_AbCdEfGhIjKlMnOpQrStUvWxYz",
  "object": "v2.core.batch_job",
  "created": "2026-03-09T20:55:31.000Z",
  "maximum_rps": 10,
  "metadata": {},
  "skip_validation": false,
  "status": "canceled",
  "status_details": {
    "canceled": {
      "output_file": {
        "content_type": "application/jsonlines",
        "download_url": {
          "expires_at": "2026-03-09T22:05:31.000Z",
          "url": "https://stripeusercontent.com/files/download/..."
        },
        "size": "2048"
      },
      "success_count": "30",
      "failure_count": "5"
    }
  }
}
```

## Returns

## Response attributes

- `id` (string)
  Unique identifier for the `batch_job`.

- `object` (string, value is "v2.core.batch_job")
  String representing the object’s type. Objects of the same type share the same value of the object field.

- `created` (timestamp)
  Timestamp at which the `batch_job` was created.

- `livemode` (boolean)
  Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.

- `maximum_rps` (integer)
  The maximum requests per second defined for the `batch_job`.

- `metadata` (map)
  The metadata of the `batch_job`.

- `skip_validation` (boolean)
  Whether validation runs before executing the `batch_job`.

- `status` (enum)
  The current status of the `batch_job`.
Possible enum values:
  - `batch_failed`
    The batch job failed to complete because of an error.

  - `canceled`
    The batch job was canceled.

  - `cancelling`
    The batch job is in the process of being canceled.

  - `complete`
    The batch job successfully finished.

  - `in_progress`
    Validation succeeded and the batch job is in progress.

  - `ready_for_upload`
    The batch job was initialized and the user can upload the input file now.

  - `timeout`
    The batch job timed out.

  - `upload_timeout`
    The input file wasn’t uploaded in time.

  - `validating`
    Input file was uploaded and validation is in progress.

  - `validation_failed`
    The batch job failed validation and was never processed.

- [`status_details`](https://docs.stripe.com/api/v2/core/batch-jobs/cancel.md?query=status_details&api-version=2026-03-25.preview) (object, nullable)
  Additional details about the current state of the `batch_job`.

## Error Codes

| HTTP status code | Code | Description |
| --- | --- | --- |
| 400 | batch_api_non_cancellable_job | Returned when a `batch_job` was found but can’t be canceled. |
| 404 | batch_job_not_found | Returned when no `batch_job` was found for the given ID. |
