Skip to main content
Datalab provides REST APIs for document conversion, structured extraction, form filling, and file management. All APIs use the same authentication and follow similar patterns.
For the simplest integration, use the Python SDK. The SDK handles authentication, polling, and provides typed responses.

Authentication

All requests require an API key in the X-API-Key header:
Get your API key from the API Keys dashboard.

Request Pattern

All processing endpoints follow this pattern:
  1. Submit a document for processing (returns immediately with a request_id)
  2. Poll the status endpoint until processing completes
  3. Retrieve results from the completed response

Submit Request

Response:

Poll for Results

Response while processing:
Response when complete:

Progress percentages

Hosted API polling responses can include progress_percent, an integer from 0 to 100 estimating overall work completed. Use it to display a progress bar.
  • The percentage can pause or jump. It is not an estimate of time remaining.
  • Treat a missing or null value as unavailable and show an indeterminate indicator.
  • A successful result reports 100 when it is ready to retrieve. A failed request may retain its last percentage or have no percentage.
  • Keep checking status and success to decide whether processing finished. A percentage is not a completion signal.
Polling about once per second is sufficient for progress displays. Consecutive polls may return the same percentage. With Python SDK 0.8.0 or later, pass on_progress to document-processing helpers such as convert() and extract() to receive increasing integer percentages while they poll. Missing values and duplicates are skipped. Async clients also accept async callbacks. Callbacks run inline; keep them short. Callback exceptions stop local polling and propagate to your call, without cancelling the server request. Existing polling intervals and request counts are unchanged. Earlier SDK versions can use REST polling.
Results are deleted from Datalab servers about one day after processing completes, or sooner if you delete them with DELETE /api/v1/results/{request_id}. Retrieve your results promptly.

Document Conversion

Convert documents to Markdown, HTML, JSON, or chunks. Endpoint: POST /api/v1/convert

Request

Parameters

Processing Modes

Response

Poll request_check_url until status is complete, checking success and error on each response. Completed responses can contain the output inline or a signed result_url for downloading the result JSON. Download signed URLs without an API key header. See the complete Python requests example for bounded polling, HTTP error handling, and downloading results. Response fields:
For structured data extraction, see the Extract endpoint. For document segmentation, see the Segment endpoint.

Structured Extraction

Extract structured data from documents using a JSON schema. Endpoint: POST /api/v1/extract

Request

Parameters

The extracted data is returned in extraction_schema_json in the poll response. See Structured Extraction for detailed examples.

Document Segmentation

Segment documents into structured sections using a JSON schema. Endpoint: POST /api/v1/segment

Parameters

See Document Segmentation for detailed examples.

Track Changes

Extract tracked changes (insertions and deletions) from DOCX files, PDFs, and images. Endpoint: POST /api/v1/track-changes DOCX files use exact pandoc-based change extraction. PDFs and images are processed by a vision model.
See Track Changes for detailed examples.

Custom Processor (Agent, Beta)

This feature is currently in open beta. The API may change.
Run an existing published processor on a document. The published processor determines the task and output format. Endpoint: POST /api/v1/agent
POST /api/v1/custom-processor and POST /api/v1/custom-pipeline are deprecated. They keep working until a removal date we will announce ahead of time. Migrate to POST /api/v1/agent, passing processor=cp_XXXXX instead of pipeline_id=cp_XXXXX. See the migration guide.

Parameters

Form Filling

Fill forms in PDFs and images. Endpoint: POST /api/v1/fill

Request

Parameters

Field Data Format

Response

See Form Filling for more examples.

File Management

Upload and manage files for use in pipelines.

Upload File

Step 1: Request an upload URL
Response:
Step 2: Upload directly to the presigned URL
Step 3: Confirm upload

List Files

Get File Metadata

Get Download URL

Delete File

See File Management for detailed examples.

Create Document

Generate DOCX files from markdown with track changes support:
See Create Document for detailed examples.

Webhooks

Configure webhooks to receive notifications when processing completes instead of polling. Set a default webhook URL in your webhook settings, or override per-request with the webhook_url parameter. See Webhooks for configuration details.

Rate Limits

Default rate limits apply per API key. If you exceed limits, you’ll receive a 429 response. See Rate Limits for details and how to request higher limits.

Next Steps

SDK Reference

Use the Python SDK for a simpler integration with typed responses.

Webhooks

Receive notifications when processing completes instead of polling.

API Limits

Understand file size limits, page limits, and rate limiting.

Document Conversion

Detailed guide to converting documents to Markdown, HTML, or JSON.