Multi-Document

Multi-Document

Send up to 10 files, convert each one to Markdown, and answer typed questions across them.

Multi-Document

Ask across several documents

Endpoint

POSThttps://claix.dev/multi-document

Send up to 10 files in one call, together with the same typed questions used by Query space. Each file is converted to Markdown and the answers are built by crossing those texts. There is no schema_id and the files do not need to be stored beforehand.

The accepted formats are the same as Extraction → Markdown: PDF, Excel/CSV, Word and text, HTML/XML, images and audio. If any file fails to convert, the whole request fails and no answer is returned.

It is meant for server-to-server integrations (backends, scripts, n8n, Zapier, Make). Do not call it from an end-user browser: it requires a secret API key.

1. Authentication

Every request must include your API key. It is a personal server credential, separate from any session token, and it should be treated with the same care as a database password.

Option A — dedicated header (recommended):

x-api-key: <TU_API_KEY>

Option B — standard Authorization header:

Authorization: Bearer <TU_API_KEY>

Either one is enough. If you send both, x-api-key takes priority.

Before processing the files, the system checks that:

  • The API key exists and is active.
  • The linked account is active (not suspended).

If that fails, the request is rejected with 401 and the files are not processed.

2. Request format

Method: POST · Content-Type: multipart/form-data

FieldTypeRequiredDescription
fileBinary fileYesRepeat the field from 1 to 10 times. files and documents are also accepted. Same formats and size limits as Extraction → Markdown.
questionsJSON textYesArray of { question, format }. Maximum 5 questions, 400 characters each. format: string | int | boolean | timestamp | array.
window_contextBooleanNotrue keeps each converted document. Omit it or send false to only answer the questions.
window_timeNumber or textRequired if window_context is trueMinutes: 5, 10, 15, 30, 45, 60, 90, 120, 180, 240, 360, 480, 720, 1440, or infinity. infinity requires Persistent Mode on the account.
space_idText (UUID)NoKnowledge space owned by the API key. Only when window_context is true. The kept documents are attached to that space.

3. How to build the request

  1. Have your API key ready. You do not need a schema_id.
  2. Build a POST request to the endpoint URL.
  3. Add the authentication header.
  4. Send multipart/form-data with 1 to 10 file fields and a questions JSON array.
  5. To keep the documents, also send window_context=true and window_time. space_id is optional and only applies in that case.
  6. Check the HTTP status: only 200 means success. Then read ia_response.

4. Request examples

See the panel on the right for cURL, JavaScript, Node.js, Python, PHP and n8n. Switch language with the selector and copy the snippet. “Conservar los documentos” adds window_context, window_time and space_id.

5. Successful response format

200 OK · Content-Type: application/json

Answers stay aligned with the questions and use the requested format, or null when the data is not in the files. If source verification is enabled for knowledge-space queries, each answer is { value, source }.

{
  "user_ask": [
  { "question": "¿Qué proveedor factura más en total?", "format": "string" },
  { "question": "¿El importe del contrato coincide con la factura?", "format": "boolean" }
],
  "ia_response": [
    "Suministros Omega S.A.",
    true
  ],
  "documents_processed": 2,
  "log_id": "7c2e1a90-4b3d-4f8a-9e21-6d5c8b0a1f34"
}

When window_context is true, the converted files are kept and their ids are listed on that call in the logs panel. They are not an extra field in this JSON. If you do not keep the files, the logs show that they were not stored.

FieldTypeDescription
user_askarrayThe questions that were answered, in the same order they were sent.
ia_responsearrayOne answer per question, in the requested format, or null when the files do not contain the data.
documents_processednumberHow many files were converted and used to answer.
log_idstring (UUID)Identifies the call in the logs panel.

6. Error codes

{
  "error": "Descripción legible del problema.",
  "detalle": "Información técnica adicional (solo presente en algunos casos).",
  "log_id": "7c2e1a90-4b3d-4f8a-9e21-6d5c8b0a1f34"
}

400 — questions is missing, empty, longer than 5 items, a question is over 400 characters, or a format is not string, int, boolean, timestamp or array. Also: no files, more than 10 files, an unsupported format, invalid window_time, space_id without window_context, or infinity without Persistent Mode.

401 — Authentication failed: key missing, unknown, disabled, or the account is suspended.

404 — space_id does not exist for this account.

413 — A file is over the size limit of its format.

422 — A file could not be turned into readable Markdown. The whole request fails.

502 — The model call failed (transient; retry with backoff).

405 — Method other than POST. · 500 — Internal error.

7. Code summary

CodeCategoryRetry?
200Success—
400Client error (malformed document or data)No — fix the request first
401Authentication errorNo — fix credentials first
404Resource not foundNo — fix schema_id first
405Incorrect HTTP methodNo — fix the method first
413File or extracted text too largeNo — reduce size first
422No extractable dataNo — review document/schema first
500Internal server errorYes, with caution
502AI service failureYes, recommended with backoff

8. Best practices

  • Check the HTTP status before reading ia_response.
  • Keep questions to 5 and files to 10. One failed conversion rejects the whole call.
  • Kept document ids show up in the logs panel only when window_context is true. If you omit it, the files are not stored.
  • Retry automatically only on 500 and 502, never on 4xx unless you change the request.
  • Do not put your API key in a frontend or a public repository.

Request examples

curl -X POST "https://claix.dev/multi-document" \
  -H "x-api-key: <TU_API_KEY>" \
  -F "file=@./factura.pdf" \
  -F "file=@./contrato.docx" \
  -F 'questions=[  { "question": "¿Qué proveedor factura más en total?", "format": "string" },  { "question": "¿El importe del contrato coincide con la factura?", "format": "boolean" }]'