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

# Table Recognition

> Extract tables from documents.

<Warning>
  **Deprecated:** The standalone Table Recognition endpoint (`/api/v1/table_rec`) is deprecated. Table extraction is now integrated into the Convert API.

  Use the Convert API with `output_format: "json"` to get structured table data with bounding boxes.
</Warning>

## Recommended Approach

Use the Convert API for table extraction:

```python 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 found: {block['id']}")
        print(f"Bounding box: {block['bbox']}")
        # Access table cells in block['children']
```

### REST API

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

The JSON response includes `Table` and `TableCell` blocks with bounding boxes.

## Why Use Marker Instead?

* **Single endpoint** - No need for a separate table-specific call
* **Better integration** - Tables are extracted in context with the full document
* **More features** - Access processing modes, structured extraction, and more
* **Consistent API** - Same patterns as all other document processing

## Related

* [Document Conversion](/docs/recipes/conversion/conversion-api-overview) - Full Convert API documentation
* [Structured Extraction](/docs/recipes/structured-extraction/api-overview) - Extract specific data from tables

<Card title="Try Datalab" icon="rocket" href="https://www.datalab.to/auth/sign_up">
  Get started with our API in less than a minute. We include free credits.
</Card>
