- A Datalab account with an API key (new accounts include $5 in free credits)
- Python 3.10+ installed
- The Datalab SDK:
pip install datalab-python-sdk - Your
DATALAB_API_KEYenvironment variable set
When to Use Fast vs Balanced
Use fast when speed and cost matter most. Use balanced when you need to trust every field and want metadata to power downstream decisions.
Schema size on short documents
For shorter documents (under 20 pages), balanced mode limits how large your schema can be. Documents of 20+ pages have no schema-size limit. If a schema is too large for a short document, the request fails with a clear error telling you your field count and your options — and you aren’t charged.Count your fields
A field is one value you get back — a string, number, date, true/false, or one choice from a fixed list. Objects and lists are containers, not fields — count the fields inside them. A list of repeated items counts its fields once, no matter how many rows the document has. 4 fields:How many fields can I use?
About 25 fields is a comfortable limit for any schema on a short document. Larger schemas often work too — especially flat ones without deep nesting — but the more fields you add, and the more deeply they’re nested (lists of objects several levels down), the more likely you are to reach the limit. You don’t have to guess: if a schema is too large for a short document, the request fails with a clear error (and you aren’t charged), so it’s safe to try a larger one. If you need a bigger schema on a short document:- Split it into multiple extractions — for example, header fields in one request and a large list in another.
- Use
fastmode — it supports larger schemas and costs less, without the per-field verification metadata. - Trim and flatten — drop fields you don’t use and reduce nesting.
This applies only to balanced mode on documents under 20 pages. Documents of 20+ pages support schemas of any size.
Quick Start
extraction_mode controls the extraction pipeline (fast or balanced). This is separate from mode, which controls the document parsing stage (fast, balanced, or accurate). You can combine them independently — for example, mode="fast" with extraction_mode="balanced".extraction_mode is not yet exposed in the Python SDK’s ExtractOptions. To set it explicitly, use the cURL or Python requests examples above. When omitted, the team’s configured default applies (see Changelog — 6/4/2026 for default rules).Response Format
In balanced mode, each extracted field includes three sibling keys. The_citations sibling is the same format as fast mode for compatibility — balanced mode adds _meta with richer metadata on top:
_citations key is shared with fast mode — if you switch between modes, citation-consuming code continues to work. The _meta key is balanced-mode-only and contains the full audit trail.
Field Metadata
Each_meta object contains:
Extraction Status
Verification Status
In practice, most fields will be
PASS or FAIL_UNRESOLVABLE after verification. The other statuses indicate cases where the verifier flagged an issue that could not be fully resolved automatically.
Building Workflows with Verification Metadata
The per-field metadata enables automated quality gates:Common Workflow Patterns
- Auto-approve when all fields have
verification.status == "PASS"— no human review needed - Flag for review when any field is
NOT_RESOLVABLEor has aFAIL_*verification status — the document may be missing information or the extraction needs a human check - Show citations to reviewers so they can verify in seconds — each field links back to specific blocks in the document
- Use reasoning as an audit trail — for compliance workflows, the per-field reasoning documents exactly how each value was produced, with block-level citations back to the source document
Next Steps
Structured Extraction Overview
Schema format, response structure, and extraction tips
Confidence Scoring
Additional per-field confidence scores (works with both modes)
Saved Schemas
Save and version schemas for reuse across requests
Handling Long Documents
Tips for extracting from 100+ page documents