Installation
The CLI is included with the SDK:Authentication
Set your API key as an environment variable:datalab login saves the key to ~/.config/datalab/config.json, readable only by your user. Every datalab command uses it when --api_key is not passed and DATALAB_API_KEY is not set, but only for the host you signed in to. For another --base_url, run datalab login --host <url> or pass a key.
datalab login needs SDK 0.7.0 or newer.Convert Documents
Convert documents to markdown, HTML, JSON, or chunks.Basic Usage
Output Options
Processing Options
Advanced Options
Directory Processing
Convert all documents in a directory:./documents/a/report.pdf saves to ./output/a/report/report.md, with its images in the same folder, so files with the same name in different folders keep separate results. Without --output_dir, results go to ./output/; pass --output_dir . to save them in the working directory, as before SDK 0.14.0. The CLI prints the full output path when a run starts and in its summary.
Each output folder holds a .datalab-output file with the input’s file name. A directory scan skips these folders, so running the same command again does not process its own output. The CLI checks every output folder before it submits anything. It stops if two inputs would share a folder (for example report.pdf and report.docx in the same folder; process one type with --extensions pdf), if a folder already exists and was not made by the CLI, if a folder holds another input’s results from an earlier run, or if one input’s folder would be inside another’s (for example report.pdf next to a report/ folder of documents).
Convert Command Reference
Extract Structured Data
Extract structured data from documents using a JSON schema.Basic Usage
Extract Command Reference
Segment Documents
Segment documents into logical sections using a schema.Basic Usage
Segment Command Reference
Track Changes
Extract tracked changes from DOCX files, PDFs, and images. DOCX files use exact XML extraction; PDFs and images use a vision model.Basic Usage
Track Changes Command Reference
Published Processor (Beta)
This feature is currently in beta. The API may change.
Create Document
Create a DOCX document from markdown with track changes.Basic Usage
Create Document Command Reference
Compare (Open Beta)
This feature is currently in beta. The API may change.
datalab eval is the deprecated SDK 0.10.0 name of these commands.
run --wait and get lists each variant’s share and each
file’s ID, which compare differences takes (SDK 0.15.0 or later).
Exit Status
The document commands (convert, extract, segment, track-changes, fill, form-fields, agent and create-document) exit with status 1 when any file fails, so scripts and CI jobs can check the result. Invalid options exit with status 2.
After a run over several files, the summary gives the number of files that succeeded and failed, and names each failed file with its error. It names the output directory only when the run saved results to it, and says No output was saved. when it saved none. A run that saves nothing leaves no empty output directory behind.
compare run --wait exits with status 1 when the comparison fails or any of its files fails. Skipped files don’t count as failures. compare get exits 0 for a failed comparison, because it reports the status it read.
Examples
Batch Convert PDFs
Extract Data from Documents
High-Throughput Processing
Getting Help
Next Steps
Quickstart
Get up and running with Datalab in minutes.
Batch Processing
Process multiple documents efficiently in parallel.
SDK Reference
Explore the full Python SDK for advanced usage.
Supported File Types
See all document formats supported by Datalab.