Skip to main content
A
Docs

Docs API reference

Endpoints, request examples and errors for the Docs API: processing, OCR, classification, extraction and search.

Authentication

Send a token as Authorization: Bearer <token>. Read API conventions.

Endpoints

MethodPathPurposeRole
POST/api/v1/docs/processUpload a document, read its text, find key values and split it into passagesAny
POST/api/v1/docs/batchProcess more than one documentAny
POST/api/v1/docs/uploadUpload a documentAny
POST/api/v1/docs/ocrRead the text of a documentAny
POST/api/v1/docs/classifyClassify a documentAny
POST/api/v1/docs/extractExtract fields from a documentAny
POST/api/v1/docs/validateCheck extracted fieldsAny
GET/api/v1/docs/documentsList documentsAny
GET/api/v1/docs/documents/searchSearch documentsAny
GET/api/v1/docs/documents/{document_id}Get a document and its resultsAny
GET/api/v1/docs/documents/{document_id}/textGet the text of a documentAny
DELETE/api/v1/docs/documents/{document_id}Delete a documentAny
POST/api/v1/docs/documents/{document_id}/export-to-chatSend the text to a Chat knowledge baseadmin
POST/api/v1/docs/process-and-ingestProcess a document and send it to Chat in one stepadmin
GET/api/v1/docs/statsProcessing statisticsAny
GET/api/v1/docs/healthHealth checkNone

Process a document

curl https://docs.example.gov/api/v1/docs/process \
  -H "Authorization: Bearer $TOKEN" \
  -F "file=@trade-licence.pdf"

The response has the document identifier, the text, the language, a confidence value, the values found and the passages. Values found include dates, Hijri dates, document numbers, reference numbers, national IDs, phone numbers, email addresses and amounts.

Errors

StatusCause
400No file name, or a file type that is not supported
400Run the earlier step first
403Your role cannot send documents to Chat
404The document does not exist
413The file is larger than 50 MB
503The connection to Chat is not set up