Document classification
AI document classification: know what every file is
Short answer
AI document classification identifies what kind of document a file is (invoice, receipt, contract, resume, purchase order or other) from its extracted text. Knowing the type first lets you send each document to the right extraction template, approver or folder, and catch unexpected files before they break a workflow.
Document pipelines usually assume they know what they're receiving. Then someone forwards a contract to the invoice inbox, a scanned receipt arrives as a photo, or a supplier sends a statement instead of an invoice. Classification up front keeps each downstream step simple, because every step only sees the document types it was built for.
Get Early Access to ClassifierHub: 2× credits in your first paid month.
Pipeline: extract text, classify, then route
Convert the file to text with a PDF text extractor or OCR, then classify the first page or two. That's usually enough to identify the type, and it keeps each call small and cheap. Route by type: invoices to accounts payable extraction, contracts to legal review, resumes to your ATS, and other to a person.
curl https://classifierhub.com/v1/decide \
-H "Authorization: Bearer $CLASSIFIERHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "document-classification",
"input": "INVOICE No. 2026-118 Bill to: Meridian BV Consulting services, September Subtotal 4,000.00 VAT 21% Total due 4,840.00 by 30 Oct"
}'
# -> document_type: { "value": "invoice", "confidence": 0.99,
# "probabilities": { "invoice": 0.99, "purchase_order": 0.01, ... } }The ClassifierHub API opens to Early Access members first.
Designing document types
- Describe types by their content ("a bill requesting payment with line items and totals"), not by filename or sender.
- Separate look-alikes explicitly: invoice vs. receipt, quote vs. purchase order, statement vs. invoice.
- Always include other. Unknown documents should stop for review instead of being forced into a type.
- Add yes/no checks for things that change routing, such as "is this document signed?" or "is it addressed to our company?".
Classification vs. extraction
Classification answers "what is this?". Extraction answers "what are the invoice number and total?". They are different jobs. Classify first with a cheap decision, then run extraction only on documents that need it, using a template specific to that type. Mixing both into one large prompt is slower, costlier and harder to debug.
Accuracy tips
Poor OCR is the most common cause of errors, so check extraction quality on scanned documents first. Keep the page order, remove repeated headers and footers, and truncate very long documents: the type is almost always clear from the first page.
Frequently asked questions
Related guides
Last updated . ClassifierHub is an independent product built on top of the Jev decision model, accessed through OpenRouter. It is not affiliated with or endorsed by TypeSafe or OpenRouter.