How to classify documents
Classify labels a whole document, or each page, against the categories you define. Without categories, it suggests a document type. Use it to route or triage documents before processing them.
Quick start
Classify takes the same document input, plus the categories you want to choose between. It labels the whole document, or each page. Without categories, it suggests a document type.
Classify options
config.scope:document(one decision for the file, the default) orpage(one decision per page, returned indecisions).config.categories: up to 20 entries, each with atypeand adescription. Names are yours to choose and must be unique. Omit them to let the API suggest a document type.config.unmatched_behavior:suggest_type(the default) returns asuggested_typewhen no category fits;otherreturnstype: "other"instead.config.prompt: your own instruction text, up to 8,000 characters.output.include_evidence:truereturns the pages, text blocks, and region that support each decision.language: a BCP-47 code such asen-IN. Omit it for the Indic default, as for Digitise.reasoning_input:auto(the default) ortext_only.
Write each category description so it separates that category from the others, for example “A supplier bill with totals and payment details” rather than “financial document”.
Choose which pages to read
Use one of config.max_pages (the first N pages), config.target_pages (such as [1, 6, 8]), or config.inspection. Combining them is rejected.
count must be at least 1. Page ranges are 1-based and inclusive. For adaptive, initial can be first, last, head_tail, or explicit, and max_pages must cover the initial selection.
Reading only some pages is faster, but a bundle of several documents can look like one. In testing, a PDF holding an invoice followed by two receipts classified as Invoice when only the first page was read, and as mixed when every page was read. Use all, or split the file first.
Classify results
When no category matches, the job still completes: you get classification_status: "unknown" and reason_code: "no_matching_type", and, with suggest_type, the document’s own type in suggested_type. With scope: "page", result holds a decisions list with one entry per page instead of a single decision.
Results are short by default. Add ?include=details to the results request for the inspected pages and provenance.
Split, then classify
Classify reads the pages you point it at, so a bundle of several documents can look like one. Split first, then classify each child document by its document_ref. To classify one child document, send a JSON body instead of a file:
Classify shares its request behaviours (multiple documents, Idempotency-Key, execution: "auto", capabilities) with Split. See Request behaviours.