inference.eu

POST /v1/files

Files API: upload and manage files, stored in the EU

The files endpoints store the inputs and outputs of work that does not fit in a single request. You upload a JSONL file of requests for a batch job, download the results when it finishes, and delete both when you are done. The endpoints follow the OpenAI files API, and files are stored in European data centres.

  1. 01API format: OpenAI
  2. 02EU data centres
  3. 03Covered by one DPA
POST /v1/files
# Upload a JSONL file of requests for a batch job
curl https://api.inference.eu/v1/files \
  -H "Authorization: Bearer $INFERENCE_EU_API_KEY" \
  -F purpose="batch" \
  -F file="@ticket-classification.jsonl"

# {"id": "file-7f3c2a", "object": "file", "bytes": 482113, "created_at": 1793620800,
#  "filename": "ticket-classification.jsonl", "purpose": "batch"}

What the endpoints do

POST /v1/files uploads a file as multipart/form-data with two fields: file and purpose. Use purpose batch for batch input, or user_data for files a tool such as code execution should read. The response is a file object with an id, bytes, filename, purpose and created_at. You refer to the file by its id everywhere else.

GET /v1/files lists your files, GET /v1/files/{file_id} returns one file object, GET /v1/files/{file_id}/content downloads the contents, and DELETE /v1/files/{file_id} removes it. Batch output and error files appear in the same list with purpose batch_output.

Preparing a batch input file

A batch input file is JSON Lines: one request per line, each with a custom_id you choose, a method of POST, the url such as /v1/chat/completions or /v1/embeddings, and a body that is exactly what you would send to that endpoint. All lines in one file should target the same endpoint.

Make custom_id meaningful, for example a ticket number or document id, because results can come back in any order and you match them using that value. Validate the file before upload: every line must be valid JSON, and a single malformed line can make the whole batch fail validation.

Storage, retention and clean-up

Files are stored in European data centres, are only accessible with keys from your organisation, and are never used to train models. Treat them like any other copy of your data: delete input files once the batch has completed and you have downloaded the results, and delete output files once they are processed.

A short clean-up step at the end of each job is enough, and it keeps the list readable as well as limiting how much sensitive data sits in storage. How long files are kept if you do not delete them depends on your contract, and we confirm it with you.

Errors and edge cases

An upload without purpose, or with a value that is not supported, returns a 400 error. Files above the maximum size also return an error; split large inputs into several files and batches. The size limit depends on your plan, and we confirm it with you.

Requesting a file id that does not exist, or that belongs to another organisation, returns 404. Downloading the content of a file still being written, such as batch output before the batch has finished, is not possible; wait until the batch status is completed. Deleting a file that a running batch uses can make that batch fail, so delete inputs only afterwards.

Files: 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