Melious
API Reference

Files

/v1/files — upload files for batches and vector stores

Upload a file once and reference it by id — as JSONL input for Batches, or to attach to a Vector store for retrieval. 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
assistantsAttach to a vector store for retrieval / file search.
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
}

Deleting a file does not detach it from vector stores it was already attached to — the store keeps its own indexed copy. Detach via the vector store files endpoint.

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.

Vector stores to attach files for semantic search • Batches for the endpoint that consumes JSONL files • Batch workflow for the end-to-end pattern.

On this page