Tables
Use POST /v1/tables when table structure is the primary output, or when reviewers need table-cell evidence before building an Extract schema.
Request contract
{
"input": {"file_id": "file_invoice"},
"execution_mode": "sync",
"grounding": "cell",
"boundary_source": "detector",
"detection_policy": "strict"
}
cURL
curl -sS -X POST "https://api.docspeed.ai/v1/tables" \
-H "Authorization: Bearer ${DOCSPEED_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"input": {"file_id": "file_invoice"},
"execution_mode": "sync",
"grounding": "cell",
"boundary_source": "detector",
"detection_policy": "strict"
}'
Python
import requests
response = requests.post(
"https://api.docspeed.ai/v1/tables",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"input": {"file_id": "file_invoice"},
"execution_mode": "sync",
"grounding": "cell",
"boundary_source": "detector",
"detection_policy": "strict",
},
timeout=600,
)
response.raise_for_status()
print(response.json())
TypeScript
const response = await fetch("https://api.docspeed.ai/v1/tables", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
input: { file_id: "file_invoice" },
execution_mode: "sync",
grounding: "cell",
boundary_source: "detector",
detection_policy: "strict",
}),
});
console.log(await response.json());
Example response fragment
{
"grounding": "cell",
"tables": [
{
"html": "<table><tr><th>Description</th><th>Amount</th></tr><tr><td>Consulting</td><td>1240.00</td></tr></table>",
"page_index": 0,
"source_page_indexes": [0],
"grid_row_count": 2,
"grid_col_count": 2,
"region_ids": ["p1_table_1"],
"mapping_quality": "exact"
}
],
"grounding_regions": [
{
"region_id": "p1_table_1",
"page_index": 0,
"shape": {"type": "bbox", "x": 80, "y": 460, "w": 760, "h": 220}
}
]
}
Production notes
- Use
grounding: "cell"for AP, reconciliation, and exception-review workflows. - Use
boundary_source: "detector"unless you have a known layout boundary to reuse. - Keep
detection_policy: "strict"for production and switch toliberalonly when evaluating recall on messy documents.