Melious

Upload a file once and reference it by id as JSONL input for Batches. OpenAI-compatible Files API. Files are compressed and encrypted at rest.

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

Upload a file

POST /v1/files

multipart/form-data upload with two fields.

FieldTypeRequiredDescription
filefileyesThe file to upload (binary).
purposestringyesOne of the purposes below.

Purposes

PurposeUse
assistantsAccepted for OpenAI compatibility. The file is stored but attaches to nothing.
user_dataGeneral-purpose user file.
visionImage input.
batchJSONL input for the Batch API (validated as JSONL on upload).
fine-tuneFine-tuning data.
evalsEvaluation data.

Example:

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

Response:

{
  "id": "file-abc123",
  "object": "file",
  "bytes": 20413,
  "created_at": 1699999999,
  "filename": "handbook.pdf",
  "purpose": "assistants",
  "status": "processed"
}

List files

GET /v1/files?purpose=assistants&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 the upload response). Doesn't return the content — that's a separate endpoint.

Download file content

GET /v1/files/{file_id}/content

Returns the raw bytes (not JSON-wrapped) — the original file you uploaded.

curl https://api.melious.ai/v1/files/file-abc123/content \
  -H "Authorization: Bearer sk-mel-<YOUR_API_KEY>" \
  -o handbook.pdf

For a batch, use this to pull the 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
}

Errors

Errors use the OpenAI envelope { "error": { "message", "type", "param", "code" } }.

  • 400 invalid_request_error — unsupported purpose, malformed multipart, or (for purpose: "batch") content that fails JSONL validation.
  • 400 — upload exceeds 105 MB.
  • 401 authentication_error — missing or invalid API key.
  • 404 invalid_request_error — requested file doesn't exist.

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

On this page