Document question answering API that returns the page behind every answer
Build cited document answers into your own product, portal or internal tool. The ChatDocument REST API uploads documents into a space, answers questions from that space only and runs extractions across many files, returning JSON with the document and page for every statement.
The same strict answers, from your own code
The API uses the same pipeline as the ChatDocument app: retrieval from the documents of one space, an answer written only from those passages, and a check in code that every cited passage exists on its page and contains the quoted text. When the documents do not answer the question, the response says so in a dedicated field and lists the closest passages, so your interface can show an honest reply instead of a guess.
- Upload PDF, Word, Excel, PowerPoint, text and Markdown files, or web pages by URL
- Ask questions and receive the answer with structured citations
- Run extractions with your own columns and fetch the table as JSON, XLSX or CSV
Three calls cover most integrations
Upload sends a file to a space with a POST to /v1/spaces/{space}/documents and returns a document identifier and its indexing status. Ask sends a question to a space with a POST to /v1/spaces/{space}/ask and returns the answer, a list of citations with document, page and quoted text, and a flag that tells you whether the documents contained an answer. Extract starts a run with a POST to /v1/spaces/{space}/extractions with your columns and document list, and the results are read from the run with a GET when it finishes.
The requests and responses above are illustrative. The full reference with every field sits in the API section of your workspace settings.
POST /v1/spaces/spc_7Kx2Lm9Q/documents
Authorization: Bearer cd_live_xxxxxxxxxxxx
Content-Type: multipart/form-data
[email protected]
{"document_id": "doc_41Rz8", "status": "indexing", "pages": 22}
POST /v1/spaces/spc_7Kx2Lm9Q/ask
Authorization: Bearer cd_live_xxxxxxxxxxxx
Content-Type: application/json
{"question": "What is the notice period for termination?"}
{
"answer": "Either party may terminate with 60 days written notice.",
"found_in_documents": true,
"citations": [
{
"document": "Master services agreement.pdf",
"page": 9,
"quote": "either party may terminate this Agreement upon sixty (60) days prior written notice"
}
],
"questions_used": 1
}
POST /v1/spaces/spc_7Kx2Lm9Q/extractions
Authorization: Bearer cd_live_xxxxxxxxxxxx
Content-Type: application/json
{"columns": [{"name": "Renewal date", "instruction": "date of the next renewal"}, {"name": "Liability cap", "instruction": "maximum liability as written"}], "documents": ["doc_41Rz8", "doc_93Kp2"]}
{
"extraction_id": "ext_5Tq1",
"status": "done",
"rows": [
{"document": "doc_41Rz8", "Renewal date": {"value": "2027-03-01", "page": 9}, "Liability cap": {"value": "12 months of fees", "page": 14}},
{"document": "doc_93Kp2", "Renewal date": {"value": null, "found_in_documents": false}, "Liability cap": {"value": "uncapped for data breach", "page": 6}}
],
"questions_used": 2
}
Connect in four steps
- 1In workspace settings, create an API key. Keys belong to one workspace and can be revoked at any time.
- 2Create a space for the documents your integration may use, or reuse an existing one.
- 3Upload documents through the API, the app or a connected drive folder.
- 4Call ask or extract from your backend and display the answer with its citations in your interface.
curl https://chatdocument.ai/api/v1/ask \
-H "Authorization: Bearer $CHATDOCUMENT_KEY" \
-d space=support-docs \
-d question="What is the notice period?"
API keys in workspace settings
The workspace settings page listing two API keys with their creation dates and last use, and a button to revoke each.
Business and Enterprise, counted like the app
API access comes with Business and Enterprise. API questions count toward the plan exactly like questions asked in the app: one cited answer is 1 question, each document row of an extraction is 1 question, a comparison is 3 questions. Business pools 7,000 questions a month with 800 a day and 30,000 new pages, Enterprise pools 20,000 questions with 2,000 a day and 100,000 new pages. Extractions run up to 250 documents per run on Business and 1,000 on Enterprise. Pages count once per billing period, a scanned page counts as 3. Prices on chat with PDF pricing.
What teams build on the API
- AI support answers from documentation: cited answers inside your own support console.
- Due diligence AI: automated extraction across every file a client uploads to your portal.
- RAG as a service: retrieval, grounding and refusals handled for you, without running your own index.
FAQ
Do API questions count toward my plan
Yes. Every API answer, extraction row and comparison counts toward the monthly and daily limits of your plan, the same as in the app.
Are API keys tied to a user or a workspace
To a workspace. Any owner of the workspace can create and revoke keys, and each key reaches only that workspace.
How do I know the documents did not contain an answer
The response has a field that says whether the answer was found in the documents. When it was not, the response lists the closest passages checked, with pages.
Is my content used to train AI models
No. Documents sent through the API are handled like documents in the app: never used to train models, and processed by AI model providers bound by contract not to train on your content.
Ship cited answers in your product
Create your account on Business or Enterprise, create a key and make your first call.