> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zerodrift.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Download a Batch File

> Get a fresh link to a batch result file: JSONL, spreadsheet, audit workbook or PDF report.

Returns a link to one of a batch's files. It's the same link as `files.{kind}` on [Get a Batch](https://docs.zerodrift.com/api-reference/batches/get-batch.md). Use it when the earlier link has expired. Read-only API keys are allowed.

## Path Parameters

**batch\_id** `string` *required*

The batch.

**kind** `string` *required*

Which file:

* `jsonl`: one line per message with its `custom_id`, `metadata` and `result`.
* `xlsx`: the results as a spreadsheet.
* `workbook`: the audit workbook.
* `pdf`: the audit report.

`workbook` and `pdf` exist once the batch's `report_status` is `ready`.

## Response

**url** `string`

A link to the file, valid for an hour.

**expires\_at** `string`

When the link stops working.

```bash cURL theme={null}
curl https://api.zerodrift.ai/api/v3/batches/BATCH_ID/files/xlsx \
  -H "x-api-key: YOUR_API_KEY"
```

```json 200 OK (example) theme={null}
{
  "api_version": "v3",
  "url": "https://example-bucket.s3.amazonaws.com/batch-results/batch_3f2b8c1e9d0a4b7f8e6d5c4b3a291807/results.xlsx?X-Amz-Algorithm=...",
  "expires_at": "2026-10-05T13:45:00Z"
}
```

```json 404 Not Found theme={null}
{
  "api_version": "v3",
  "error": {
    "code": "file_not_found",
    "message": "batch 'batch_e511e74dd1ea49ba8c5f4293a68427be' has no xlsx file to download"
  }
}
```

## Errors

| Status | Code | Meaning |
| - | - | - |
| `400` | `invalid_file_kind` | `kind` isn't `jsonl`, `xlsx`, `workbook` or `pdf`. |
| `404` | `batch_not_found` | No batch with this ID is yours. |
| `404` | `file_not_found` | The batch hasn't ended with results, the file wasn't built, or it was deleted at `files_deleted_at`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.