How to send documents using the API
Get your API key
Go to your account settings and create a new API key. Copy the key — you'll need it for every request. Keep it secret like a password.
Send a document for classification
Make a POST request to the classify endpoint with your file attached. DocExtract will figure out what kind of document it is and return the document type.
Trigger extraction
Once classified, send the document to the extract endpoint. You can also specify a template ID if you already know the document type. DocExtract will pull out the data and return it as structured JSON.
Handle the response
The API returns the extracted fields as key-value pairs. You can save this data to your database, send it to another system, or display it however you want.
Error handling
If something goes wrong, the API returns clear error messages. Check the status code and message to understand what happened and how to fix it.