inference.eu

POST /v1/batches

Batch API: run large jobs asynchronously, processed in the EU

The batch endpoint runs many requests as one background job. You upload a JSONL file of chat completions or embeddings requests, create a batch, and collect a results file when it finishes. It is the right tool for work nobody is waiting on: classifying a ticket backlog, embedding a document archive, or running an evaluation set overnight.

  1. 01API format: OpenAI
  2. 02EU data centres
  3. 03Covered by one DPA
POST /v1/batches
# ticket-classification.jsonl, one request per line:
# {"custom_id": "ticket-1042", "method": "POST", "url": "/v1/chat/completions",
#  "body": {"model": "gpt-oss-120b", "messages": [{"role": "user", "content": "Classify: ..."}]}}

curl https://api.inference.eu/v1/batches \
  -H "Authorization: Bearer $INFERENCE_EU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_file_id": "file-7f3c2a",
    "endpoint": "/v1/chat/completions",
    "completion_window": "24h",
    "metadata": {"job": "ticket-backlog-2026-11"}
  }'

# Check progress
curl https://api.inference.eu/v1/batches/batch_91d0e4 \
  -H "Authorization: Bearer $INFERENCE_EU_API_KEY"

What the endpoint does

POST /v1/batches creates a job from a file you have already uploaded with purpose batch. Pass its input_file_id, the endpoint that every line targets, such as /v1/chat/completions, /v1/responses or /v1/embeddings, and completion_window, which is 24h. Optional metadata lets you tag the job with your own labels.

The response is a batch object with an id and a status. The job runs in the background, separate from your interactive traffic, so a large backlog does not compete with requests your users are waiting for. The requests and results never leave European data centres.

Status and results

Poll GET /v1/batches/{batch_id} to follow progress. status moves from validating to in_progress and finalizing, then ends as completed, failed, expired or cancelled. request_counts shows total, completed and failed so you can display progress.

When the batch is completed, output_file_id points to a JSONL file. Each line has the custom_id from your input and a response with the status_code and the normal response body. Lines are not in input order, so match on custom_id. Failed requests go to a separate file referenced by error_file_id. POST /v1/batches/{batch_id}/cancel stops a job, and GET /v1/batches lists your jobs.

A batch workflow that holds up in production

Generate the input file from your database, with a custom_id that is the record's primary key. Validate every line locally, upload the file, create the batch, and store the batch id against the job in your own system. A scheduled task checks the status every few minutes rather than holding a connection open.

When the batch completes, download the output, write the results back by custom_id, and collect any errors into a new, smaller input file to retry. Then delete the input and output files. Running a test batch of fifty lines first catches prompt or schema problems before you spend a large job on them.

Errors and edge cases

A batch that fails validation, because of malformed JSON, a missing custom_id, duplicate ids or lines that target a different endpoint, ends with status failed and an errors list naming the problem and line. Fix the file and submit a new batch.

Individual requests can fail inside an otherwise successful batch, for example when one prompt exceeds the context window; those appear in the error file and do not stop the rest. If a batch is not finished within the window it becomes expired, and results for completed requests are still available. Batch size limits and throughput depend on your plan, and we confirm them with you.

Batches: common questions

The questions buyers, developers and legal teams ask us most. Something missing? Ask us directly.

Ask a question

Move your AI workloads to EU infrastructure

Tell us which models you use and roughly how much traffic you have. We reply within one working day with pricing and next steps.

  • Reply within one working day
  • Pricing for your volume
  • DPA ready to sign