Read a spec’s table of contents
Spec TOC parsing · model toc-parser
/v1/specs/parse/documentQueue TOC / spec structure extraction from a PDF already in ag_documents — the same upload as POST /v1/documents, not a second upload. Job model is toc-parser. Worker reads up to 40 pages of text and parses TOC lines from the document.
X-API-Key and Content-Type: application/json. Async: immediate 202 with a new job id, then poll GET /v1/jobs/{job_id}. This path is in the tier RPM limiter with other job-submit POSTs. See pricing for how jobs are counted (402 when a trial allowance is used up, 429 when a monthly allowance is). Optional webhook_url: delivery from the worker requires tier developer, pro, or enterprise.
- Returns
- A job to check202 Accepted
- Usage
- Document indexingper page read (up to 40)
- Results in
- Divisions and sectionsresult.divisions
- Auth
- API keyX-API-Key header
POST /v1/specs/parse; that path does not exist. Use /v1/specs/parse/document (required for content-extract).How it runs
- Send a
document_id - Get a
job_id - Check your results or receive a webhook
Request
document_id. Upload your PDF first.Body type: ParseSpecByDocumentRequest.
| Field | Description |
|---|---|
document_idstring · UUIDRequired | Document in ag_documents for your account; must not be missing, wrong account, or expired. |
webhook_urlstring · URLOptional | Honored on developer, pro, enterprise for worker delivery. |
| Header | Description |
|---|---|
X-API-KeyRequired | Your API key. A missing or invalid key returns 401. |
Content-TypeRequired | application/json |
Responses
Shape: ParseJobQueued. Poll until status is complete or failed.
| Field | Description |
|---|---|
job_idstring · UUID | Use this to poll for results. |
statusstring | queued on this response. |
estimated_processing_secondsinteger | Hint only (e.g. 15). |
poll_urlstring | Path only — prepend https://api.anchorgrid.ai to build the full URL. |
When status is complete and model is toc-parser. Division/section shape comes from TOCParser.parse_toc_structure (division_code, division_title, sections[] with section_code as 6 digits and section_title). GET /v1/jobs does not post-filter toc-parser results.
| Field | Description |
|---|---|
toc_foundboolean | false if no TOC detected. |
division_countinteger | Typically 0 when toc_found is false. |
section_countinteger | Typically 0 when toc_found is false. |
divisionsarray | Typically [] when toc_found is false. |
toc_found_reasonstring | Optional when toc_found is false — e.g. nothing structured in first 40 pages. |
model_versionstring | e.g. toc-parser-v1.0.0 |
processing_time_msinteger | Wall time. |
Usage & rate limits
Each job counts as one document-indexing page (See pricing). Rate limit: tier RPM (job-submit bucket).
Errors
Handler detail; Intelligence may still genericize JSON.
| Status | What it means |
|---|---|
| 401 | Invalid or missing API key. |
| 422 | Bad JSON / invalid document_id. |
| 404 | Document missing, wrong account, or expired (DOCUMENT_NOT_FOUND). |
| 402 / 429 | Plan allowance used up. |
| 429 | RPM limit (middleware). |
Worker failures → job failed with an error object (code such as URL_UNREACHABLE, PDF_CORRUPT or INTERNAL_ERROR, and a message) — poll GET /v1/jobs.
See Errors for HTTP exception mapping.
Typical flow
Continue with POST /v1/specs/content-extract using the completed TOC job_id and section or division codes.