Search and export extracted document data across all cases
Documents
The documents endpoints provide cross-case search and bulk export of extraction results. They operate on documents that have already been processed through the pipeline within cases.
Endpoints
Search Documents
GET /v1/documents/search
Requires scope: read. Full-text and filtered search across extraction results from all cases.
Query parameters:
tenant_idstringFilter to documents belonging to this tenant.
document_typestringFilter by document type ID (e.g. "pan_card", "aadhaar").
statusstringFilter by processing status: pending, processing, done, failed.
querystringText search within extracted field values.
limitnumberNumber of results to return. Default 50, max 200.
offsetnumberNumber of records to skip for pagination. Default 0.
Example request:
GET /v1/documents/search?tenant_id=acme-corp&document_type=pan_card&status=done&limit=20
Response (200): Array of Document Search Result objects.
doc_idstringsession_idstringsession_goalstring"kyc_verification").filenamestringdocument_typestringconfidencestringstatusstringextractedobjectcreated_atstringExample response:
[
{
"doc_id": "a1b2c3d4-...",
"session_id": "e5f6a7b8-...",
"session_goal": "kyc_verification",
"filename": "pan_front.jpg",
"document_type": "pan_card",
"confidence": "0.98",
"status": "done",
"extracted": {
"name": "John Doe",
"pan_number": "ABCDE1234F",
"date_of_birth": "1990-01-15",
"fathers_name": "James Doe"
},
"created_at": "2026-03-25T10:30:00Z"
}
]
Export Documents as CSV
GET /v1/documents/export
Requires scope: read. Exports extraction results as a CSV file. The CSV columns are dynamically determined from the union of all extracted fields found across the returned documents.
Query parameters:
tenant_idstringFilter to documents belonging to this tenant.
document_typestringFilter by document type ID.
limitnumberMaximum number of records to export. Default 1000, max 10000.
Only documents with status = "done" are included in the export.
Response (200):
Content-Type: text/csv
Content-Disposition: attachment; filename="extraction_export.csv"
CSV structure:
The header row always starts with these fixed columns:
doc_id, session_id, document_type, filename, created_at
Followed by one column per unique extracted field name found across all returned documents. Fields missing from a given document are exported as empty strings.
Example:
doc_id,session_id,document_type,filename,created_at,name,pan_number,date_of_birth
a1b2c3d4,...,e5f6a7b8,...,pan_card,pan_front.jpg,2026-03-25T10:30:00Z,John Doe,ABCDE1234F,1990-01-15
Returns 404 if no matching documents are found.