Document classification API Know what each file is, and get its fields
When files arrive mixed, POST each one to /v1/classify and learn which of your document types it is, with a score from 0 to 1. Add extract=true and the matched type's fields come back in the same call.
curl "https://api.100sands.com/v1/classify?extract=true" \
-H "Authorization: Bearer $SANDS_API_KEY" \
-F [email protected]
{
"result": "matched",
"documentType": { "id": 42, "name": "Company registry extract" },
"score": 0.94,
"candidates": [
{ "id": 42, "name": "Company registry extract", "score": 0.94 },
{ "id": 57, "name": "Supplier invoice", "score": 0.18 }
],
"pages": 3,
"extraction": {
"id": "ext_9Pw4Lc",
"documentType": { "id": 42, "name": "Company registry extract" },
"version": 2,
"fields": { "companyName": "Harbor Lane Logistics Ltd", "companyNumber": "51-482913-6" }
}
}What you get
Your own document types
It compares each file with every document type of yours that has a live version. There is nothing else to set up.
A score to act on
matched, ambiguous or none, with a score from 0 to 1 and up to 5 candidates, best first.
Fields in the same call
With extract=true, a matched file also comes back with its fields, exactly as the extract endpoint returns them.
Tell look-alikes apart
When two types look alike, add a phrase in the app that only one of them contains, such as a supplier's name.
Follows your changes
When a document type gets a new live version, classification uses it straight away.
Works with your automation
Send files from the API, or route them in Zapier or Make by the type they match.
What the result means
- matched
- One type fits. documentType names it, with its score.
- ambiguous
- Two or more types fit about as well as each other. They are at the top of candidates.
- none
- No document type fits the file well enough.
- extract=true
- With a match, also the type's fields. If that part fails, the classification is still returned, with the error.
Limits
- Uses document types that have a live version
- Up to 5 candidates, best first
- Each classified file counts as one document
- PDF and HTML files that contain text, up to 50 MB
Price
Classification is in every plan. Free: 100 documents a month. Starter: $20 a month for 20,000. Pro: $79 a month for 100,000.
Compare the plansQuestions
How does it know which type a file is?
It compares the file with each of your document types that has a live version, and scores how well each one fits, from 0 to 1. The best fits come back as candidates.
Do I need to train a model?
No. Classification uses the document types you already set up. A new document type takes part as soon as it has a live version.
What if two document types look the same?
The result is ambiguous and both are at the top of candidates. If they are really the same document, keep one. If not, add a phrase in the app that only one type's documents contain.
Can I get the fields at the same time?
Yes. Add extract=true and, when the file matches, the result also holds its fields, as /v1/document-types/{id}/extract returns them.
Blog
Related
Try it on your own documents
100 documents a month free. No credit card.