Melious
API Reference

Files

/v1/files — upload and manage batch input/output files

Upload the JSONL files that Batches run against, and download batch results. OpenAI-compatible Files API, scoped to purpose: "batch".

Base path: /v1/files Auth: Bearer token or x-api-key. Requires any inference scope. Max upload size: 105 MB.

Files is only for batch I/O today. Other OpenAI Files purposes (fine-tune, assistants, vision) aren't implemented — we don't have the endpoints they feed.

Upload a file

POST /v1/files

multipart/form-data upload.

FieldTypeRequiredDescription
filefileyesJSONL file (one JSON object per line).
purposestringyesMust be "batch".

Example:

curl https://api.melious.ai/v1/files \
  -H "Authorization: Bearer sk-mel-<YOUR_API_KEY>" \
  -F purpose="batch" \
  -F file=@requests.jsonl

Response:

{
  "id": "file_abc123",
  "object": "file",
  "bytes": 12345,
  "created_at": 1699999999,
  "filename": "requests.jsonl",
  "purpose": "batch"
}

List files

GET /v1/files?purpose=batch&limit=20&after=<cursor>&order=desc
Query paramTypeDefaultDescription
purposestringanyFilter by purpose.
limitinteger20Max 100.
afterstringnoneCursor for pagination.
orderstring"desc""asc" or "desc" by created_at.

Response:

{
  "object": "list",
  "data": [ /* file objects */ ],
  "has_more": false
}

Retrieve file metadata

GET /v1/files/{file_id}

Returns the file object (same shape as upload response). Doesn't return the content — that's a separate endpoint.

Download file content

GET /v1/files/{file_id}/content

Returns the raw JSONL content with Content-Type: application/jsonl. Not JSON-wrapped — the bytes are the file.

Example:

curl https://api.melious.ai/v1/files/file_abc123/content \
  -H "Authorization: Bearer sk-mel-<YOUR_API_KEY>" \
  -o results.jsonl

Use this to pull batch output once output_file_id is set on the batch object.

Delete a file

DELETE /v1/files/{file_id}

Response:

{
  "id": "file_abc123",
  "object": "file",
  "deleted": true
}

Deleting a file that's still referenced by an active batch doesn't cancel the batch, but may affect output retrieval depending on timing — wait for the batch to finish, download the output file, then delete both.

Errors

  • VALIDATION_4016 — upload exceeds 105 MB.
  • VALIDATION_4007purpose is not "batch".
  • INFERENCE_3302 — requested file doesn't exist.
  • INFERENCE_3303 — file content fails JSONL validation.
  • AUTH_1015 — missing inference scope.

Batches for the endpoint that consumes these files • Batch workflow for the end-to-end pattern.

On this page