Documentation /docs/grounding

Grounding

Grounded extraction is the difference between a demo and a production review workflow. Docspeed supports:

  • line-level grounding from OCR
  • region-level grounding for page structure
  • cell-level grounding for tables and line-item review

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"
  }'

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",
    },
    timeout=300,
)
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",
  }),
});

console.log(await response.json());

Example grounded cell

{
  "value": "8471",
  "row_index": 1,
  "col_index": 4,
  "region_ids": ["p1:t1:c4"],
  "effective_region_ids": ["p1:t1:c4"]
}
  • Use grounding: ocr_lines on parse when you want reviewable text reconstruction.
  • Use grounding: regions when layout context matters more than individual cells.
  • Use grounding: cell on extraction and tables for AP, reconciliation, and exception-review workflows.