Batch document extraction: clearing a backlog overnight
Batch document extraction for invoice and form backlogs: vendor batch APIs compared with a private model you run, how to build the job, and how to test it.
Updated
Part of: AI for customs and logistics
Batch document extraction means running one extraction job over a large set of files at once, such as 200,000 archived invoices or a quarter’s worth of claim forms, and collecting the fields from every file when the run ends. Nobody is waiting on a single answer, so speed per document matters less than cost per document, how the run handles failures, and whether the fields are right. You can do it with a frontier API one call at a time, with a vendor’s batch API, or with a private model trained on your own documents that runs overnight in your cloud account, on your servers or hosted privately by us.
Three ways to run a backlog
| Option | How it runs | Turnaround | Where documents go |
|---|---|---|---|
| Frontier API, one call per document | Your code sends each document and waits | As fast as rate limits allow | To the vendor |
| Frontier batch API | You upload a file of requests; the vendor runs them on its schedule | Up to 24 hours per batch | To the vendor, stored until results are collected or expire |
| Private model you own | Your job sends documents to your own endpoint | Set by the capacity you run | Stays in your cloud account, on your servers, or with a private deployment we host |
Calling a frontier API one document at a time is the simplest to start and the most expensive per document. It is also where rate limits hit first: a backlog that needs a million calls will spend much of its time waiting.
What the vendor batch APIs offer
Both main frontier vendors offer a batch tier for work that can wait. The figures below come from each vendor’s own documentation, checked on 27 November 2026. Limits change, so read the current pages before you plan.
| OpenAI Batch API | Anthropic Message Batches | |
|---|---|---|
| Discount | “50% cost discount compared to synchronous APIs” | “50 percent discount on all usage compared to standard API prices” |
| Turnaround | “Each batch completes within 24 hours (and often more quickly)”; 24h is the only completion window | “Most batches completing within 1 hour”; batches expire if processing does not complete within 24 hours |
| Size of one batch | Up to 50,000 requests and a 200 MB input file | Up to 100,000 requests or 256 MB, whichever comes first |
| Unfinished requests | The batch moves to expired; unfinished requests are cancelled and completed ones are billed | Requests that do not finish in 24 hours expire |
| How long results stay | Output and error files expire 30 days after creation by default | Results available for 29 days after creation |
| Data retention note | See OpenAI’s data controls for your plan | “Not eligible” for zero data retention; stores request and response data for up to 29 days |
Sources: OpenAI Batch API guide and Anthropic batch processing guide.
Two details matter for a document backlog. First, Anthropic’s page says processing “might be slowed down based on current demand and your request volume”, and that you might then see more requests expire after 24 hours. Your pipeline has to find expired items and resubmit only those. Second, the retention terms differ from standard calls. If your data policy depends on zero retention, the batch tier may not fit it, so check with your security team. Our guide to batch APIs vs real-time calls covers the timing trade-off in more depth.
Where a private model fits
A trained model for one extraction job changes the shape of the run.
- No vendor queue. The run starts when you start it and goes as fast as the capacity you run. A backlog can go overnight, and the daily flow can use the same model during the day.
- No expiry window. Nothing is cancelled for taking too long. If the run stops, the job picks up from the last finished document, as long as results are stored by document ID (step 4 below).
- Documents stay put. The model runs where your files already are, so the backlog does not have to be uploaded to anyone.
- Predictable cost. On your own servers or cloud account, you pay for set-up and training, then use the model as much as you like, so a second pass over the backlog adds no per-call fee from us, only your own running costs. Hosted by us, you pay per use at a price fixed on the pricing page.
- You own the weights. If you stop working with us, the model stays with you and keeps running.
What we can show on price is measured on contracts, not invoices. On our contract-extraction exam, measured at list price on 102 held-out contracts, per 1,000 documents our Accuracy tier cost $4.50, our Standard tier $3.54, Claude Sonnet $59.06 and Claude Opus $154.49, with Claude billed for the tokens it used through the standard API. A vendor batch discount of 50% would halve the Claude figures. On those same 102 contracts, our Accuracy model scored 0.759 span F1 against 0.641 for Claude Opus and 0.627 for Claude Sonnet. Details are on the benchmark page and the pricing page. Invoices and forms are different documents, with different lengths, so your own price per document has to be measured on your own files. Our guide to LLM cost per document shows how to work it out.
How to build a backlog job
The model is one step. Most of the work is the pipeline around it.
- Inventory the backlog. Count files by type, source and format: native PDFs, scans, photos, email attachments. Each group behaves differently.
- Remove duplicates. The same invoice often exists as an email attachment and a scan. Hash the files and extract each one once.
- Fix the output schema. Write down every field, its type and its format, such as dates as YYYY-MM-DD and amounts as decimals with a currency code. A schema the model must fill makes every answer checkable.
- Give every document an ID. Store results by document ID, so a rerun skips finished documents and a retry never pays for work you already have.
- Run checks on every result. Net plus tax must equal gross, dates must be valid, tax numbers must have the right length, and an invoice number must not repeat for the same supplier.
- Route failures to people. Any document that fails a check, or that the model is unsure of, goes to a review queue with the file open beside the fields.
- Log the run. Record the model version, the start and end time, the count finished, the count flagged and the count failed. You will need it when someone asks how a field got into the ledger.
Our guide to high-throughput document processing covers how to measure documents per hour once the pipeline is in place.
A worked example (hypothetical numbers)
Every number in this section is invented to show the arithmetic. Replace them with your own.
Say a finance team inherits 120,000 supplier invoices from an acquisition and needs header fields from all of them for a migration.
- After removing duplicates, 104,000 files remain.
- Suppose the model passes every check on 94% of them. That leaves 6,240 invoices in the review queue.
- If a reviewer spends 2 minutes on each flagged invoice, review takes 208 hours.
- Keying all 104,000 by hand at 3 minutes each would take 5,200 hours.
The saving depends on two numbers you only get from a test: how often the model is right, field by field, and how often it is wrong without being flagged. An invoice with a wrong total that passes every check is the expensive case, so count those separately.
Test on a small set before the backlog
- Run five documents end to end. From the source folder to the stored fields, before anything else.
- Collect a checked sample. A few hundred documents from across the backlog, with every field checked by a person. Include scans and the oldest formats.
- Split by supplier or source. Test documents never come from a supplier the model trained on, so the score shows how it handles a new layout. See how to build a test set.
- Score your current process. Manual keying, an OCR tool or a frontier API, on the same held-out set.
- Score ours, field by field. Correct, wrong value, not found and invented, per field. Match amounts to the cent.
- Ship only if it wins. If ours does not beat what you use today, nothing ships.
- Run a slice before the whole. Process one month of the backlog, review it, then start the rest.
Every project starts with a free AI cost audit, which maps the document work you do today and its cost, and picks the one job worth testing. For invoice fields in particular, see invoice data extraction for accounting firms.
Questions
What is batch document extraction?
It means running the same extraction job over a large set of documents at once, such as a backlog of invoices or forms, and collecting the fields from every file when the run finishes. Nobody waits on a single answer, so the job can run overnight or over a weekend.
Are OpenAI and Anthropic batch APIs cheaper?
Both vendors' own documentation lists a 50% discount on batch requests compared with their standard calls. In exchange, results can take up to 24 hours, and requests that do not finish in that window expire.
Does a batch API keep my documents?
Read the vendor's current documentation. Anthropic's batch page says batch processing stores request and response data for up to 29 days after creation and is not eligible for zero data retention. OpenAI's batch page says output and error files expire 30 days after creation by default.
When does a private model make more sense than a batch API for extraction?
When the backlog is large or recurring, the documents should not leave your network, or you want a fixed run you can start whenever you like. A model you own runs in your cloud account, on your servers or hosted privately by us, with no vendor queue or expiry window.
How should we test before running the whole backlog?
Run five documents end to end, then score a few hundred checked documents field by field against your current process. Only start the full backlog once the model beats that process on the fields that matter.