Multi-Document
Ask across several documents
Endpoint
https://claix.dev/multi-documentSend 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
| Field | Type | Required | Description |
|---|---|---|---|
| file | Binary file | Yes | Repeat the field from 1 to 10 times. files and documents are also accepted. Same formats and size limits as Extraction → Markdown. |
| questions | JSON text | Yes | Array of { question, format }. Maximum 5 questions, 400 characters each. format: string | int | boolean | timestamp | array. |
| window_context | Boolean | No | true keeps each converted document. Omit it or send false to only answer the questions. |
| window_time | Number or text | Required if window_context is true | Minutes: 5, 10, 15, 30, 45, 60, 90, 120, 180, 240, 360, 480, 720, 1440, or infinity. infinity requires Persistent Mode on the account. |
| space_id | Text (UUID) | No | Knowledge 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
- Have your API key ready. You do not need a schema_id.
- Build a POST request to the endpoint URL.
- Add the authentication header.
- Send
multipart/form-datawith 1 to 10filefields and aquestionsJSON array. - To keep the documents, also send
window_context=trueandwindow_time.space_idis optional and only applies in that case. - 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.
| Field | Type | Description |
|---|---|---|
| user_ask | array | The questions that were answered, in the same order they were sent. |
| ia_response | array | One answer per question, in the requested format, or null when the files do not contain the data. |
| documents_processed | number | How many files were converted and used to answer. |
| log_id | string (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
| Code | Category | Retry? |
|---|---|---|
| 200 | Success | — |
| 400 | Client error (malformed document or data) | No — fix the request first |
| 401 | Authentication error | No — fix credentials first |
| 404 | Resource not found | No — fix schema_id first |
| 405 | Incorrect HTTP method | No — fix the method first |
| 413 | File or extracted text too large | No — reduce size first |
| 422 | No extractable data | No — review document/schema first |
| 500 | Internal server error | Yes, with caution |
| 502 | AI service failure | Yes, 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.