Convert documents to Markdown, HTML, JSON, or chunks using the Convert API.
Convert PDFs, Word documents, spreadsheets, and images to machine-readable formats. Marker handles complex layouts, tables, math, and images.Before you begin, make sure you have:
import os, time, requestsAPI_URL = "https://www.datalab.to/api/v1/convert"headers = {"X-API-Key": os.getenv("DATALAB_API_KEY")}# Submit requestwith open("document.pdf", "rb") as f: response = requests.post( API_URL, files={"file": ("document.pdf", f, "application/pdf")}, data={"output_format": "markdown", "mode": "balanced"}, headers=headers )check_url = response.json()["request_check_url"]# Poll for completionfor _ in range(300): result = requests.get(check_url, headers=headers).json() if result["status"] == "complete": print(result["markdown"]) break time.sleep(2)
The SDK handles polling automatically. For the REST API, you submit a request and poll the request_check_url until the status is complete.See SDK Conversion for complete SDK documentation.
File limits: Maximum file size is 200 MB, with up to 7,000 pages per request. See API Limits for the full list.
Predict per-word bounding boxes with confidence scores. Each word is inlined into HTML output as a <span data-bbox="..." data-confidence="..."> element (markdown output strips these). Billed at $0.30 per 1K pages.
extras
string
-
Comma-separated: track_changes, chart_understanding, extract_links, table_cell_bboxes, list_item_bboxes, infographic, new_block_types. (table_row_bboxes is deprecated — use table_cell_bboxes instead.)
include_markdown_in_chunks
bool
false
Include markdown content in chunks/JSON output
token_efficient_markdown
bool
false
Optimize markdown for LLM token efficiency
fence_synthetic_captions
bool
false
Wrap synthetic image captions in HTML comments
additional_config
string
-
JSON with extra config (see below)
webhook_url
string
-
Override webhook URL for this request
processing_location
string
-
Data residency region override: "eu" or "us". When set, use file_url or a pre-uploaded datalab:// reference — multipart uploads are not supported. EU processing carries a regional pricing premium.
For structured extraction, use the Extract API. For document segmentation, use the Segment API.
The track_changes extra is supported on this endpoint. You can also use the dedicated Track Changes endpoint.
Three add-ons annotate HTML output with spatial coordinates and confidence scores. All are billed at $0.30 per 1K pages each (additive on top of the base conversion rate) and require the html output format to expose the attributes.
Add-on
How to enable
What it annotates
Word bboxes
word_bboxes=True
Every word in the document gets a data-bbox and data-confidence span in HTML
Table cell bboxes
extras="table_cell_bboxes"
<colgroup><col>, <tr>, and <td>/<th> elements get data-bbox/data-confidence; also enables word_bboxes
List item bboxes
extras="list_item_bboxes"
Each <li> element gets data-bbox/data-confidence; also enables word_bboxes
from datalab_sdk import DatalabClient, ConvertOptionsclient = DatalabClient()# Get table cell bboxes (also includes word bboxes)options = ConvertOptions( output_format="html", extras="table_cell_bboxes,list_item_bboxes",)result = client.convert("document.pdf", options=options)# HTML contains data-bbox and data-confidence on table cells, list items, and words
options = ConvertOptions( output_format="html", add_block_ids=True)result = client.convert("document.pdf", options=options)# HTML elements have data-block-id attributes for citation tracking
For spreadsheet files, page_range filters by sheet index (0-based):
options = ConvertOptions( page_range="0,2", # First and third sheets only output_format="markdown")result = client.convert("workbook.xlsx", options=options)