> ## 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.

# Ambil Batch

> Mengambil status terkini, jumlah, dan file hasil untuk sebuah batch.

## Ikhtisar

Endpoint ini adalah bagian dari Batch API yang kompatibel dengan OpenAI dari TokenLab. Pekerjaan batch menggunakan file JSONL yang diunggah, dijalankan secara asinkron, dan dapat mengembalikan file output/error nanti.

## Catatan

* File input batch harus menggunakan `purpose=batch`.
* `completion_window` saat ini adalah `24h`.
* Urutan output tidak dijamin; selalu cocokkan berdasarkan `custom_id`.
* Streaming tidak didukung di dalam item batch.

## Contoh

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.tokenlab.sh/v1/batches/batch_abc123" \
    -H "Authorization: Bearer sk-your-api-key"
  ```
</RequestExample>

## Permintaan / Respons

Gunakan panel OpenAPI interaktif di atas untuk skema yang tepat.

## Tips Operasional

* Gunakan `custom_id` untuk rekonsiliasi downstream yang idempotent.
* Harapkan `output_file_id` dan `error_file_id` hanya setelah pekerja menyelesaikan batch.
* Harga batch mungkin berbeda dari harga sinkron karena aturan diskon `isBatchRequest=true` berlaku.

## Contoh respons

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "id": "batch_abc123",
    "object": "batch",
    "status": "completed",
    "input_file_id": "file_abc123",
    "output_file_id": "file_out123",
    "error_file_id": null,
    "request_counts": { "total": 100, "completed": 98, "failed": 2 }
  }
  ```
</ResponseExample>

## Field penting

<ResponseField name="request_counts" type="object">Daftar atau payload yang dikembalikan respons ini.</ResponseField>
<ResponseField name="output_file_id" type="string|null">Identifier file yang dipakai API terkait.</ResponseField>
<ResponseField name="error_file_id" type="string|null">Identifier file yang dipakai API terkait.</ResponseField>
