Documents

Locate a provenance span on the original page (bounding boxes)

Resolves a provenance text quote to rectangles on the ORIGINAL page of the document — the server-side path for scanned (image-only) PDFs and image uploads, where no client-side text-layer match is possible. The document's own text layer is used when it has one; otherwise the page is OCR'd for word boxes and the span is aligned to them. Results are cached per document.

Rectangles are page fractions in [0, 1] with a top-left origin. Render your own copy of page_index at any DPI (or use the image as is) and multiply by the rendered width and height: box = (left × W, top × H, width × W, height × H). For an image the fractions are relative to the stored pixel grid — draw against the raw pixels (EXIF orientation not applied). Render PDFs with a tool that honors the page's /Rotate, as the server does.

Gate on method: pdf_text_layer and ocr_word_boxes are the exact span window, section is the enclosing line (a region hint), llm_vision is a model-located box verified against the page's own words, page means the page was located but no rectangle aligned (rects empty), and none means nothing was located (page_index null). An empty result is an honest miss — show no highlight rather than a wrong one.

This is an interactive, per-click endpoint: a cold page costs several seconds of OCR and pages are processed one at a time per API instance. One call per organization is in flight at a time on this route; a concurrent second call receives 429 with Retry-After: 5. Call it when a user selects a field, not in bulk across a corpus. text longer than the configured maximum (500 characters by default) is truncated before matching.

get/v1/documents/{id}/span-geometry

Request

  • Base URL: https://api.talonic.com
  • URL: https://api.talonic.com/v1/documents/{id}/span-geometry
  • Auth: HTTP bearer

Path parameters

idstring uuid required
Example:a1b2c3d4-e5f6-7890-abcd-ef1234567890

Resource UUID.

Query parameters

textstring required

The provenance entry's text (the verbatim document quote) to locate, exactly as delivered. Exactly once — a repeated key is a 400.

pageinteger

0-based page to search first (the provenance entry's page_index). When omitted the page is derived from the document's OCR page map.

Response

Located rectangles, or an honest miss.

document_idstring uuid required
page_indexinteger nullable required

0-based page the rectangles belong to; null when nothing was located.

method'pdf_text_layer' | 'ocr_word_boxes' | 'section' | 'llm_vision' | 'page' | 'none' required

Changes

No recorded changes to this operation across all 1 revision of this API.