Documentation /docs/charts-equations

Charts & Equations

Use Charts for figures, diagrams, flowcharts, and plotted data. Use Equations for mathematical notation that should be returned as structured equation records.

Request contracts

POST /v1/charts:

{
  "input": {"file_id": "file_report"},
  "execution_mode": "sync"
}

POST /v1/equations:

{
  "input": {"file_id": "file_report"},
  "execution_mode": "sync",
  "boundary_source": "detector"
}

cURL

curl -sS -X POST "https://api.docspeed.ai/v1/charts" \
  -H "Authorization: Bearer ${DOCSPEED_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {"file_id": "file_report"},
    "execution_mode": "sync"
  }'

Python

import requests

response = requests.post(
    "https://api.docspeed.ai/v1/equations",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
    },
    json={
        "input": {"file_id": "file_report"},
        "execution_mode": "sync",
        "boundary_source": "detector",
    },
    timeout=600,
)
response.raise_for_status()
print(response.json())

TypeScript

const response = await fetch("https://api.docspeed.ai/v1/charts", {
  method: "POST",
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    input: { file_id: "file_report" },
    execution_mode: "sync",
  }),
});

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

Example chart response fragment

{
  "engine": "chart_codegen",
  "pages": 1,
  "items": [
    {
      "item_id": "chart_1",
      "page_index": 0,
      "kind": "chart",
      "title": "Quarterly revenue",
      "summary": "Revenue rises from Q1 to Q4.",
      "confidence": 0.86,
      "region_ids": ["p1_chart_1"]
    }
  ],
  "grounding_regions": []
}

Example equation response fragment

{
  "engine": "equation_codegen",
  "pages": 1,
  "equations": [
    {
      "equation_id": "eq_1",
      "page_index": 0,
      "latex": "E = mc^2",
      "display_mode": "block",
      "confidence": 0.92,
      "region_ids": ["p1_equation_1"]
    }
  ],
  "grounding_regions": []
}

Production notes

  • Use Parse or Layout first when you need broader document context around a chart or equation.
  • Keep boundary_source: "detector" unless you are intentionally reusing layout regions.
  • Store returned region_ids with your review UI so visual findings remain traceable to source pages.