TokenLab

Files & Batches

List Message Batches

Lists the Message Batches that your organization created.

GET
/v1/messages/batches

Overview

Return the Message Batches that your organization created through this API, newest first. The list shows the status TokenLab last recorded for each batch. To check one batch now, retrieve it.

Notes

  • limit is 1 to 1000 and defaults to 20.
  • To page, pass after_id (older batches) or before_id (newer batches) with a batch ID from the list. Do not send both. TokenLab returns 400 for an unknown ID or for any other query parameter.
  • Deleted batches are not listed.
  • has_more is true when more batches follow.

Example

Request

cURL
curl -X GET "https://api.tokenlab.sh/v1/messages/batches?limit=20" \
  -H "x-api-key: sk-your-api-key" \
  -H "anthropic-version: 2023-06-01"

Response example

Response

200 OK
{
  "data": [
    {
      "id": "msgbatch_01ABC123",
      "type": "message_batch",
      "processing_status": "ended",
      "request_counts": { "processing": 0, "succeeded": 2, "errored": 0, "canceled": 0, "expired": 0 },
      "ended_at": "2026-11-01T10:20:00Z",
      "created_at": "2026-11-01T10:00:00Z",
      "expires_at": "2026-11-02T10:00:00Z",
      "cancel_initiated_at": null,
      "archived_at": null,
      "results_url": "https://api.tokenlab.sh/v1/messages/batches/msgbatch_01ABC123/results"
    }
  ],
  "first_id": "msgbatch_01ABC123",
  "last_id": "msgbatch_01ABC123",
  "has_more": false
}

Important fields

dataarray
Message batches, newest first.
first_idstring|null
ID of the first batch in data.
last_idstring|null
ID of the last batch in data.
has_moreboolean
More batches 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

before_id?string

Return batches before this batch id. Cannot be combined with after_id.

after_id?string

Return batches after this batch id. Cannot be combined with before_id.

limit?integer

Maximum number of batches to return

Range1 <= value <= 1000
default20

Response

application/json

application/json

application/json

application/json

application/json

application/json

application/json