Berkas & batch

Mengambil Batch Pesan

Mengambil status dan jumlah permintaan dari sebuah Batch Pesan.

GET
/v1/messages/batches/{message_batch_id}

Gambaran Umum

Mengembalikan status, jumlah permintaan, dan stempel waktu dari Batch Pesan yang dibuat oleh organisasi Anda. Lakukan polling pada endpoint ini hingga processing_status bernilai ended, kemudian ambil hasilnya.

Catatan

  • processing_status bernilai in_progress, canceling, atau ended.
  • results_url bernilai null sampai batch tersebut selesai.
  • Batch yang tidak ada atau telah dihapus akan mengembalikan 404. Batch yang belum siap dibaca dapat mengembalikan 409; coba lagi nanti.

Contoh

Permintaan

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

Contoh respons

Respons

200 OK
{
  "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"
}

Bidang penting

processing_statusstring
in_progress, canceling, atau ended.
request_countsobject
Jumlah permintaan yang sedang processing, succeeded, errored, canceled, atau expired.
ended_atstring|null
Waktu saat pemrosesan berakhir, atau null.
cancel_initiated_atstring|null
Waktu saat permintaan pembatalan diterima, atau null.
results_urlstring|null
URL hasil, atau null.

Otorisasi

BearerAuth
AuthorizationBearer <token>

Autentikasi API Key. Buat atau kelola API key di Dashboard > API > API Keys.

Lokasi: header

Parameter path

message_batch_id*string

Pengidentifikasi batch pesan

Respons

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json