> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/document-ai/developer-documentation/classification-1/synchronous-document-classification.md).

# Synchronous document classification

```json
{"openapi":"3.1.0","info":{"title":"Document AI API","version":"1.0.0"},"tags":[{"name":"Classification"}],"servers":[{"description":"UAT","url":"https://api-docai-uat.uptiq.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"in":"header","name":"X-Api-Key","type":"apiKey"}},"schemas":{"ClassifySyncRequest.981af89":{"properties":{"content":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Base64-encoded file content","title":"Content"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Additional context to guide the classification","title":"Context"},"custom_document_types":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Custom document types to classify against. If provided, classification is restricted to these types.","title":"Custom Document Types"},"custom_document_types_url":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"URL to a JSON file containing custom document types. Merged with custom_document_types if both provided.","title":"Custom Document Types Url"},"entities":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"default":null,"description":"Entity ID-to-name mapping for Excel workbook classification: {entityId: entityName, ...}","title":"Entities"},"file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Public URL to file","title":"File Url"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Custom metadata","title":"Metadata"},"model":{"anyOf":[{"enum":["gpt-4.1","gpt-5.1","gemini-3","openrouter/z-ai/glm-5.2","openrouter/deepseek/deepseek-v4-pro"],"type":"string"},{"type":"null"}],"default":"gemini-3","description":"LLM model for classification. Must be one of the supported models.","title":"Model"},"use_custom_types_only":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":false,"description":"If true, only custom_document_types are valid classification results. Requires custom_document_types or custom_document_types_url to be provided.","title":"Use Custom Types Only"}},"title":"ClassifySyncRequest","type":"object"},"ClassifySyncResponse.981af89":{"properties":{"_id":{"description":"Classification document ID","title":"Id","type":"string"},"additionalClassifications":{"anyOf":[{"items":{"$ref":"#/components/schemas/ClassifySyncResponse.981af89.ClassifySyncResult"},"type":"array"},{"type":"null"}],"default":null,"description":"Additional classification results beyond the primary result (for multi-type documents)","title":"Additionalclassifications"},"isZipFile":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"True if this is a ZIP archive with child documents","title":"Iszipfile"},"requestId":{"description":"Request ID","title":"Requestid","type":"string"},"result":{"anyOf":[{"$ref":"#/components/schemas/ClassifySyncResponse.981af89.ClassifySyncResult"},{"items":{"$ref":"#/components/schemas/ClassifySyncResponse.981af89.ClassifySyncResult"},"type":"array"},{"items":{"$ref":"#/components/schemas/ClassifySyncResponse.981af89.ClassifyZIPChildResult"},"type":"array"},{"type":"null"}],"default":null,"description":"Classification result: single result for PDF/image, array for Excel, or array of child results for ZIP","title":"Result"},"status":{"default":"success","enum":["success","error"],"title":"Status","type":"string"}},"required":["requestId","_id"],"title":"ClassifySyncResponse","type":"object"},"ClassifySyncResponse.981af89.ClassifySyncResult":{"properties":{"category":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Document category","title":"Category"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"default":null,"description":"Classification confidence score (0.0–1.0)","title":"Confidence"},"entity":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Entity name (for Excel workbooks)","title":"Entity"},"pageNumber":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Page number where classification applies (PDF)","title":"Pagenumber"},"sheetName":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Sheet name (for Excel workbooks)","title":"Sheetname"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Classified document type","title":"Type"}},"title":"ClassifySyncResult","type":"object"},"ClassifySyncResponse.981af89.ClassifyZIPChildResult":{"properties":{"_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Child classification ID","title":"Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Error message if status is 'error'","title":"Error"},"fileName":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Original filename in ZIP","title":"Filename"},"fileType":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Detected file type","title":"Filetype"},"index":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Child index","title":"Index"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Classification result dict","title":"Result"},"status":{"description":"Processing status","enum":["success","error"],"title":"Status","type":"string"}},"required":["status"],"title":"ClassifyZIPChildResult","type":"object"},"ValidationError.6a07bef":{"description":"Model of a validation error response.","items":{"$ref":"#/components/schemas/ValidationError.6a07bef.ValidationErrorElement"},"title":"ValidationError","type":"array"},"ValidationError.6a07bef.ValidationErrorElement":{"description":"Model of a validation error response element.","properties":{"ctx":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"title":"Error context"},"loc":{"items":{"type":"string"},"title":"Missing field name","type":"array"},"msg":{"title":"Error message","type":"string"},"type":{"title":"Error type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationErrorElement","type":"object"}}},"paths":{"/classify/sync":{"post":{"description":"","operationId":"post__classify_sync","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifySyncRequest.981af89"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifySyncResponse.981af89"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError.6a07bef"}}},"description":"Bad Request"},"401":{"description":"Authentication required — the `X-Api-Key` header is missing or invalid."},"500":{"description":"Returned instead of `400` when the request body is missing or invalid. Known defect — see the API Reference."}},"summary":"Synchronous document classification","tags":["Classification"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.uptiq.ai/document-ai/developer-documentation/classification-1/synchronous-document-classification.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
