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

# List Files

> Lists uploaded files for batch workflows and supported file-backed compatibility modes.

## Overview

This endpoint primarily serves TokenLab's OpenAI-compatible Batch API, including uploaded batch inputs and generated output or error files.

When the request opts into Anthropic Files compatibility mode, the same route can also list Anthropic-style files available to the bound workspace.

Without Anthropic headers, the list can include both batch files and TokenLab image/reference files. Use `purpose=batch`, `purpose=batch_output`, `purpose=user_data`, or `purpose=vision` to narrow the list.

## Notes

* Batch input files must use `purpose=batch`.
* Use `purpose=batch_output` to focus on generated output files.
* `completion_window` is currently `24h`.
* Output ordering is not guaranteed; always match by `custom_id`.
* Streaming is not supported inside batch items.

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.tokenlab.sh/v1/files?purpose=batch&limit=20" \
    -H "Authorization: Bearer sk-your-api-key"
  ```
</RequestExample>

## Request / Response

Use the interactive OpenAPI panel above for the exact schema.

## Operational Tips

* Use `custom_id` for idempotent downstream reconciliation.
* Expect `output_file_id` and `error_file_id` only after the worker finalizes the batch.
* Batch pricing may differ from synchronous pricing because `isBatchRequest=true` discount rules apply.

## Response example

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "object": "list",
    "data": [{ "id": "file_abc123", "object": "file", "purpose": "batch" }]
  }
  ```
</ResponseExample>

## Important fields

<ResponseField name="object" type="string">Response object type.</ResponseField>
<ResponseField name="data" type="array">Returned list or payload for this response.</ResponseField>
