> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datalab.to/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration Guide

> Migrate from deprecated endpoints to the current API.

This guide helps you migrate from deprecated Datalab API endpoints to their current replacements.

## Marker → Dedicated Endpoints

> [!WARNING]
>
> The `/api/v1/marker` endpoint is deprecated. Migrate to the new dedicated endpoints below.

The monolithic `/api/v1/marker` endpoint has been replaced with dedicated endpoints for each operation:

| Old Usage | New Endpoint | SDK Method |
| - | - | - |
| `/marker` (basic conversion) | `POST /api/v1/convert` | `client.convert()` |
| `/marker` with `page_schema` | `POST /api/v1/extract` | `client.extract()` |
| `/marker` with `segmentation_schema` | `POST /api/v1/segment` | `client.segment()` |
| `/marker` with `extras=track_changes` | `POST /api/v1/track-changes` | `client.track_changes()` |
| `/marker` with `pipeline_id` | `POST /api/v1/agent` with `processor` | `client.run_agent()` |

### SDK upgrade

Update to the latest SDK for the new dedicated methods:

```bash theme={null}
pip install --upgrade datalab-python-sdk
```

SDK users who only use `client.convert()` do not need to change code — it continues to work and now calls `/api/v1/convert` internally.

### Document Conversion

```python Python SDK theme={null}
# No changes needed — convert() works the same
from datalab_sdk import DatalabClient, ConvertOptions

client = DatalabClient()
result = client.convert("document.pdf")
print(result.markdown)
```

```bash cURL (before) theme={null}
# Old
curl -X POST https://www.datalab.to/api/v1/marker \
  -H "X-API-Key: $DATALAB_API_KEY" \
  -F "file=@document.pdf" \
  -F "output_format=markdown"
```

```bash cURL (after) theme={null}
# New
curl -X POST https://www.datalab.to/api/v1/convert \
  -H "X-API-Key: $DATALAB_API_KEY" \
  -F "file=@document.pdf" \
  -F "output_format=markdown"
```

### Structured Extraction

```python Python SDK (before) theme={null}
# Old: page_schema on ConvertOptions
from datalab_sdk import DatalabClient, ConvertOptions
options = ConvertOptions(page_schema=schema)
result = client.convert("invoice.pdf", options=options)
```

```python Python SDK (after) theme={null}
# New: Dedicated extract() method with ExtractOptions
from datalab_sdk import DatalabClient, ExtractOptions
import json

client = DatalabClient()
options = ExtractOptions(
    page_schema=json.dumps(schema)
)
result = client.extract("invoice.pdf", options=options)
extracted = json.loads(result.extraction_schema_json)
```

### Document Segmentation

```python Python SDK (before) theme={null}
# Old: segmentation_schema on ConvertOptions
options = ConvertOptions(segmentation_schema=json.dumps(schema))
result = client.convert("document.pdf", options=options)
```

```python Python SDK (after) theme={null}
# New: Dedicated segment() method with SegmentOptions
from datalab_sdk import DatalabClient, SegmentOptions
import json

client = DatalabClient()
options = SegmentOptions(
    segmentation_schema=json.dumps(schema)
)
result = client.segment("document.pdf", options=options)
segments = result.segmentation_results
```

### Track Changes

```python Python SDK (before) theme={null}
# Old: extras parameter on ConvertOptions
options = ConvertOptions(extras="track_changes", output_format="html")
result = client.convert("contract.docx", options=options)
```

```python Python SDK (after) theme={null}
# New: Dedicated track_changes() method
from datalab_sdk import DatalabClient, TrackChangesOptions

client = DatalabClient()
options = TrackChangesOptions(output_format="markdown,html,chunks")
result = client.track_changes("contract.docx", options=options)
```

### Checkpoint reuse

The new endpoints support a checkpoint system to avoid re-parsing documents. Convert once, then extract or segment multiple times:

```python theme={null}
from datalab_sdk import DatalabClient, ConvertOptions, ExtractOptions, SegmentOptions
import json

client = DatalabClient()

# Step 1: Convert and save checkpoint
options = ConvertOptions(save_checkpoint=True)
result = client.convert("document.pdf", options=options)
checkpoint_id = result.checkpoint_id

# Step 2: Extract using checkpoint (no re-parsing)
extract_opts = ExtractOptions(
    checkpoint_id=checkpoint_id,
    page_schema=json.dumps({"type": "object", "properties": {"invoice_number": {"type": "string"}}})
)
extracted = client.extract(options=extract_opts)

# Step 3: Segment using same checkpoint
segment_opts = SegmentOptions(
    checkpoint_id=checkpoint_id,
    segmentation_schema=json.dumps({"segments": ["Header", "Body", "Footer"]})
)
segmented = client.segment(options=segment_opts)
```

## Workflows → Pipelines

> [!WARNING]
>
> The API removed the Workflows API (`/api/v1/workflows`), and SDK 0.15.0 removed the workflow methods and CLI commands. Use [Pipelines](https://docs.datalab.to/docs/recipes/pipelines/pipeline-overview.md) instead.

Pipelines replace Workflows with a simpler API, per-step status tracking, versioning, and a visual editor in Forge.

| Workflows | Pipelines |
| - | - |
| `POST /api/v1/workflows/workflows` | `POST /api/v1/pipelines` (via SDK: `client.create_pipeline()`) |
| `POST /api/v1/workflows/workflows/{id}/execute` | `POST /api/v1/pipelines/{id}/run` (via SDK: `client.run_pipeline()`) |
| `GET /api/v1/workflows/executions/{id}` | `GET /api/v1/pipelines/executions/{id}` (via SDK: `client.get_pipeline_execution()`) |

See [Pipelines](https://docs.datalab.to/docs/recipes/pipelines/pipeline-overview.md) for a full walkthrough.

## Custom Processors → Agent

> [!WARNING]
>
> The legacy custom processor endpoints and SDK methods are deprecated. They keep working until a removal date we will announce ahead of time. Move existing integrations to the agent endpoint.

Run custom processors through the agent endpoint. The response format is the same.

| Before | After |
| - | - |
| `POST /api/v1/custom-processor` or `POST /api/v1/custom-pipeline` with `pipeline_id=cp_XXXXX` | `POST /api/v1/agent` with `processor=cp_XXXXX` |
| SDK `run_custom_processor()` or `run_custom_pipeline()` with `CustomProcessorOptions(pipeline_id="cp_XXXXX")` | SDK `run_agent()` with `AgentOptions(processor="cp_XXXXX")` |
| CLI `datalab custom-pipeline` | CLI `datalab agent --processor cp_XXXXX` |

`run_custom_processor()`, `run_custom_pipeline()` and the `custom-pipeline` command still work but are deprecated. So are the `/api/v1/custom_processors` management endpoints and their SDK methods, such as `list_custom_processors()`; they print a deprecation warning.

```python Python SDK theme={null}
from datalab_sdk import AgentOptions, DatalabClient

client = DatalabClient()
result = client.run_agent("document.pdf", options=AgentOptions(processor="cp_XXXXX"))
```

```bash cURL theme={null}
curl -X POST https://www.datalab.to/api/v1/agent \
  -H "X-API-Key: $DATALAB_API_KEY" \
  -F "file=@document.pdf" \
  -F "processor=cp_XXXXX"
```

See [Run a Published Processor](https://docs.datalab.to/docs/recipes/pipelines/custom-processors.md) for versions and results.

## Table Recognition → Document Conversion

The standalone Table Recognition endpoint (`/api/v1/table_rec`) is deprecated. Use the Document Conversion endpoint with JSON output instead.

### Before (deprecated)

```python theme={null}
# Old: Dedicated table recognition endpoint
response = requests.post(
    "https://www.datalab.to/api/v1/table_rec",
    files={"file": ("doc.pdf", f, "application/pdf")},
    headers={"X-API-Key": API_KEY}
)
```

### After (current)

```python Python SDK theme={null}
from datalab_sdk import DatalabClient, ConvertOptions

client = DatalabClient()

options = ConvertOptions(
    output_format="json",
    mode="balanced"
)

result = client.convert("document.pdf", options=options)

# Tables are in the JSON output with block_type "Table"
for block in result.json.get("children", []):
    if block.get("block_type") == "Table":
        print(f"Table: {block['id']}")
        print(f"Bounding box: {block['bbox']}")
        # Access cells in block['children']
```

```bash cURL theme={null}
curl -X POST https://www.datalab.to/api/v1/convert \
  -H "X-API-Key: $DATALAB_API_KEY" \
  -F "file=@document.pdf" \
  -F "output_format=json" \
  -F "mode=balanced"
```

## OCR → Document Conversion

The standalone OCR endpoint (`/api/v1/ocr`) is deprecated. Use the Document Conversion endpoint instead, which includes OCR as part of its processing pipeline. The OCR endpoint runs only in the US, so it returns 403 for EU data residency (`processing_location=eu` or an EU-residency team).

### Before (deprecated)

```python theme={null}
# Old: Dedicated OCR endpoint
response = requests.post(
    "https://www.datalab.to/api/v1/ocr",
    files={"file": ("doc.pdf", f, "application/pdf")},
    headers={"X-API-Key": API_KEY}
)
```

### After (current)

```python Python SDK theme={null}
from datalab_sdk import DatalabClient, ConvertOptions

client = DatalabClient()

# For text extraction, use markdown output
result = client.convert("document.pdf")
print(result.markdown)

# For page-level text, use JSON output
options = ConvertOptions(output_format="json")
result = client.convert("document.pdf", options=options)
```

```bash cURL theme={null}
curl -X POST https://www.datalab.to/api/v1/convert \
  -H "X-API-Key: $DATALAB_API_KEY" \
  -F "file=@document.pdf" \
  -F "output_format=markdown"
```

## Next Steps

> [card] [Document Conversion](https://docs.datalab.to/docs/recipes/conversion/conversion-api-overview.md)
>
> Full guide to the current conversion API

> [card] [Structured Extraction](https://docs.datalab.to/docs/recipes/structured-extraction/api-overview.md)
>
> Extract structured data using JSON schemas

> [card] [Changelog](https://docs.datalab.to/platform/changelog.md)
>
> See all API changes and deprecations

> [card] [SDK Reference](https://docs.datalab.to/docs/welcome/sdk.md)
>
> Use the SDK for the simplest migration path


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.