Documents arrive as PDFs, scans, photos of paper, and email attachments in a hundred layouts. Somewhere downstream, a person reads each one and keys fields into an ERP, a claims system, or a contract database. This is one of the most reliable early wins for Claude in an enterprise because the task is well-bounded, the value is measurable in hours, and the output can be checked mechanically.
The problem: unstructured in, structured out
Traditional template-based extraction breaks whenever a supplier changes their invoice layout. Claude reads documents the way a person does — by understanding them — so one prompt can handle many layouts. Its vision capability, available on all four platforms (Bedrock, Vertex AI, Foundry, and Claude Platform on AWS), means scanned and photographed documents work too, not just digital text. The job of your pipeline is to turn "a PDF arrived" into "validated fields landed in the target system, or a human was asked."
A reference design
The pipeline has four stages, and only one of them is a model call. First, deterministic code ingests the document, converts pages to images or text, and identifies the document type. Second, Claude extracts fields against a fixed schema you define — telling it explicitly to return null for anything it cannot find, which is the single most effective instruction against invented values. Third, deterministic validation checks everything code can check: line items summing to the total, dates parsing and being in plausible ranges, vendor names matching your master data, duplicate detection. Fourth, records that pass go through; records that fail any check, or contain null in a required field, queue for human review with the original document alongside.
from anthropic import AnthropicVertex
client = AnthropicVertex(project_id="my-project", region="global")
msg = client.messages.create(
model="claude-sonnet-5",
max_tokens=1024,
system="Extract from the invoice as JSON with keys: invoice_number, "
"vendor, currency, total, due_date (ISO 8601). "
"Use null for any field not present. Return only JSON.",
messages=[{"role": "user", "content": invoice_text}],
)
print(msg.content[0].text)
The same call pattern works on the other platforms by swapping the client class; on Bedrock the model ID gains an anthropic. prefix. For clean invoices, Haiku 4.5 is often sufficient at a third of Sonnet's list input price; route poor scans and complex contracts to Sonnet 5 or Opus 4.8 instead of upgrading everything.
Where humans review
Do not aim for zero human involvement; aim for humans seeing only the documents that need them. Low-stakes, validation-passing records can flow straight through. High-stakes documents — contracts above a value threshold, anything feeding a payment — deserve a human confirmation step regardless of how clean the extraction looks. Summarization work (contract abstracts, clause flagging) is different in kind: it informs a human decision rather than feeding a system, so its review gate is simply that a qualified person reads it before relying on it.
Rollout advice and pitfalls
Start with one document type and build a labeled test set — a few dozen real documents with hand-verified correct values — before writing the pipeline. Measure per-field accuracy on that set, and re-measure after every prompt or model change. One platform note for high-volume overnight workloads: the Batch API is not available on Bedrock or Vertex AI (it is on Claude Platform on AWS, and not on Foundry either), so on those platforms you will run batches as ordinary rate-limited requests — plan quotas accordingly, as covered in Batch vs. Real-Time.
The classic pitfalls: trusting extraction without validation (the pipeline works for a month, then a new layout quietly shifts a column); prompts that pressure the model to always produce a value instead of null; forgetting that documents contain personal data, which your privacy review should cover; and building for every document type at once instead of proving one end-to-end.
Where to go next
For scanned and image-based documents, read Vision: Processing Images, Screenshots, and Scanned Documents. For making the JSON contract robust, see Structured Outputs: Getting JSON You Can Actually Parse. The feature matrix shows which pipeline features exist on which platform.