Tools API
Each tool agents use is also an endpoint of its own. Call one, and the result comes back in the same response. Nothing needs to be set up in the app first.
All requests need a Bearer token, as for the rest of the API:
Authorization: Bearer dg_your_api_keyTools
| Tool | Endpoint | What it does |
|---|---|---|
| Read a document | POST /api/v1/documents/read | The text of a document: a PDF page by page (scanned pages are read with OCR), a spreadsheet or CSV as rows, a Word or text file as text. |
| Extract data | POST /api/v1/documents/extract | Reads a document into the fields you ask for, with the page each value came from. |
| Classify | POST /api/v1/documents/classify | Sorts a document, or text you send, into your categories, with a reason for each. |
| Compare | POST /api/v1/documents/compare | Checks two to five documents against each other, field by field and line by line. |
| Split a PDF | POST /api/v1/documents/split | Splits one PDF into separate documents, by page ranges, a number pattern or a description. |
| Generate an image | POST /api/v1/images/generate | A new picture made by AI from a description. |
| Edit an image | POST /api/v1/images/edit | Changes a picture as described, keeping the rest of it. |
To make documents from your templates, use renders instead.
Sending files
A file goes in the request body as its name and either its bytes or a link:
{ "file": { "name": "invoice.pdf", "content_base64": "JVBERi0xLjcK..." } }{ "file": { "name": "invoice.pdf", "url": "https://example.com/invoice.pdf" } }A link must start with https://. Each file can be up to 25 MB.
What comes back
The tool's result, as described on its reference page, plus credits_used: what the call cost, including any AI it used. A file a tool makes, such as a picture or part of a split PDF, comes with a url that works for 24 hours.
For example, extracting two fields:
curl https://automette.com/api/v1/documents/extract \
-H "Authorization: Bearer dg_your_api_key" \
-H "Content-Type: application/json" \
-d '{"file": {"name": "invoice.pdf", "url": "https://example.com/invoice.pdf"}, "instructions": "The invoice number and total"}'{
"data": { "invoice_number": "INV-104", "total": "1250.00" },
"pages": { "invoice_number": 1, "total": 1 },
"missing": [],
"credits_used": 0.0042
}Errors
An error comes back as { "error": "...", "code": "..." }:
| Status | code | Meaning |
|---|---|---|
| 401 | The API key is missing or not valid. | |
| 402 | no_credits | Not enough credits for this call. |
| 404 | not_found | Something the request names does not exist. |
| 422 | invalid_input | A parameter is missing or not valid, or a file is over 25 MB. error says which. |
| 500 | service_error | A problem on Automette's side. Try again in a little while. |
Last updated on