Chat
Ask natural-language questions about your documents. The API retrieves relevant context from a collection and generates an answer with citations.
Create a chat completion
POST /v1/chat/completions| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | yes | Your question |
collection_id | string | yes | The collection to search |
session_id | string | no | Continue an existing session (omit to start a new one) |
model | string | no | "quick" (default) or "deep" for more thorough answers |
curl https://docld.com/api/v1/chat/completions \
-H "Authorization: Bearer docld_..." \
-H "Content-Type: application/json" \
-d '{
"message": "What is the total on the January invoice?",
"collection_id": "c1a2b3c4-..."
}'Response
{
"id": "chatcmpl_abc123def456",
"object": "chat.completion",
"message": "The total on the January invoice is $1,500.00.",
"citations": [
{
"document_id": "f47ac10b-...",
"document_name": "invoice-jan.pdf",
"page": 1,
"text": "Total: $1,500.00"
}
],
"session_id": "sess_xyz789",
"model": "gpt-5-mini-2025-08-07",
"created": 1710000000
}Citations
Each citation points to a specific document and page that was used to generate the answer. Use these to show provenance in your UI.
Sessions
If you omit session_id, a new session is created and its ID returned. Pass it back on subsequent requests to maintain conversational context.
Last updated on