Overview
The Document Chat API allows you to ask questions about your ingested documents and receive answers grounded in your content. The API supports conversational memory, enabling follow-up questions that maintain context.Endpoint
Authentication
Include your API token in the Authorization header:Request
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer YOUR_API_TOKEN | Yes |
Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
question | string | Yes | The question to ask about your documents |
conversation_id | string | No | Conversation identifier to maintain memory context across questions |
reset | boolean | No | When true, starts a new conversation and ignores previous history. Default: false |
file_ids | string[] | No | Restrict search to specific documents by file ID (preferred) |
file_names | string[] | No | Restrict search to specific documents by file name (deprecated, use file_ids) |
output_schema | object (JSON Schema) | No | Optional JSON Schema to request a structured output. When provided, the API returns validated structured data in structured_output and the raw JSON-text candidate in raw_json. |
thinking_level | string | No | Controls model and thinking configuration. Values: "fast", "balanced", "accurate" (default). See Thinking Level for details. |
Thinking Level
Thethinking_level parameter controls the model and thinking configuration used for answering questions:
| Value | Description |
|---|---|
"fast" | Uses a faster model without extended thinking. Best for simple questions where speed is prioritized. |
"balanced" | Uses a more capable model with low thinking. Good balance between quality and speed. |
"accurate" | Default. Uses a more capable model with high thinking. Best for complex questions requiring deep reasoning. |
Example Request
Example with Conversation Memory
Example with Specific Documents (using file_ids)
Example with Specific Documents (using file_names - deprecated)
Example with Thinking Level
Example with Structured Output (JSON Schema)
When you passoutput_schema, the API will attempt to return a schema-conformant JSON object/array in structured_output.
Notes/constraints:
- Supported schemas must be simplified JSON Schema
- Unions must be only with
null(e.g.["string", "null"]) - Complex constructs like
oneOf/anyOf/allOf/$refare not supported
Response
Success Response (200 OK)
| Field | Type | Description |
|---|---|---|
answer | string | The answer to your question. When output_schema is provided, this will be a short status message and the structured data will be in structured_output (and the raw JSON-text candidate in raw_json). |
structured_output | any | Optional structured output validated against the requested output_schema. Present only when output_schema is provided. |
raw_json | string | Optional raw JSON-text produced by the model before validation/correction. Present only when output_schema is provided. |
conversation_id | string | Conversation identifier for follow-up questions |
Example Response
Example Response (Structured Output)
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API token |
| 404 | Not Found - Specified file not found |
| 422 | Unprocessable Entity - Invalid output_schema or structured output validation failed |
| 500 | Internal Server Error |
Usage Examples
Python
JavaScript
Best Practices
- Use conversation memory — Pass
conversation_idfor follow-up questions to maintain context - Be specific — Clear, specific questions get better answers
- Scope when needed — Use
file_namesto focus on specific documents - Use structured output when integrating — Provide
output_schemato get JSON you can reliably parse in code - Reset when changing topics — Set
reset: truewhen switching to unrelated questions

