# Cancel a batch (/docs/api-reference/batches/cancel)

> Items that haven't started rendering are canceled (failed documents with error code canceled); renders already running finish.

`POST https://druckling-nine.vercel.app/v1/batches/{id}/cancel`

Items that haven't started rendering are canceled (`failed` documents with error code `canceled`); renders already running finish. A canceled batch has no ZIP. 409 once the batch has finished.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

## Response 200: OK

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "object": {
      "const": "batch"
    },
    "status": {
      "enum": [
        "queued",
        "running",
        "completed",
        "failed",
        "canceled"
      ],
      "type": "string",
      "description": "`queued` → `running` → `completed` (ZIP ready), `failed` (nothing rendered, or the ZIP couldn't be built) or `canceled`."
    },
    "template": {
      "type": "string"
    },
    "version": {
      "type": "number"
    },
    "filename_pattern": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "counts": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number"
        },
        "pending": {
          "type": "number"
        },
        "rendered": {
          "type": "number"
        },
        "failed": {
          "type": "number"
        },
        "canceled": {
          "type": "number"
        }
      },
      "required": [
        "total",
        "pending",
        "rendered",
        "failed",
        "canceled"
      ],
      "description": "Items by outcome; `pending` is queued or rendering."
    },
    "zip_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Signed download URL of the ZIP with every rendered file (PDFs, or XML e-invoices), once the batch completed and while the ZIP is retained."
    },
    "zip_size_bytes": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ]
    },
    "zip_expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the ZIP is deleted (the file retention period)."
    },
    "error": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "test_mode": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "finished_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "object",
    "status",
    "template",
    "version",
    "filename_pattern",
    "counts",
    "zip_url",
    "zip_size_bytes",
    "zip_expires_at",
    "error",
    "test_mode",
    "created_at",
    "finished_at"
  ]
}
```