TokenLab

Files & Batches

List Files

List uploaded batch and image-reference files.

GET
/v1/files

List batch and image-reference files. Filter with purpose=batch, purpose=batch_output, purpose=user_data, or purpose=vision.

With Anthropic Files headers, the same API lists Anthropic-format files in the current Workspace.

Example

Request

cURL
curl -X GET "https://api.tokenlab.sh/v1/files?purpose=batch&limit=20" \
  -H "Authorization: Bearer sk-your-api-key"

Filters

  • For batch and image-reference files, limit is 1–10000 (default 10000), with after for pagination. In Anthropic Files mode, limit is 1–1000 (default 20); use either after_id or before_id, not both.
  • purpose can be batch, batch_output, user_data, or vision.
  • user_data and vision return TokenLab-created image reference files when available.

Response example

Response

200 OK
{
  "object": "list",
  "data": [{ "id": "file_abc123", "object": "file", "purpose": "batch" }],
  "first_id": "file_abc123",
  "last_id": "file_abc123",
  "has_more": false
}

Important fields

objectstring
Always list.
dataarray
Files.
has_moreboolean
More results are available when has_more is true.

Authorization

BearerAuth
AuthorizationBearer <token>

API Key authentication. Create or manage API keys in Dashboard > API > API Keys.

In: header

Query Parameters

limit?integer
Range1 <= value <= 1000
default20
after?string
after_id?string

Anthropic Files cursor. Return files after this public file id. Requires the Anthropic Files beta header and cannot be combined with before_id.

before_id?string

Anthropic Files cursor. Return files before this public file id. Requires the Anthropic Files beta header and cannot be combined with after_id.

scope_id?string

Reserved Anthropic Files scope cursor. TokenLab currently returns an explicit unsupported error rather than silently ignoring this value.

purpose?string

Optional file purpose filter. batch and batch_output cover Batch API files; user_data and vision cover TokenLab image/reference file bindings. Anthropic Files API mode is selected by Anthropic headers rather than this query parameter.

Value in

  • "batch"
  • "batch_output"
  • "user_data"
  • "vision"

Headers

anthropic-beta?string

Include files-api-2025-04-14 to use Anthropic Files API mode.

Response

application/json

application/json