Skip to main content
Send text and say what to find. Sage returns typed values, the exact text each came from, and a probability. A field that isn’t in the text comes back null.

Extract fields

values is your request, filled in:
results has the same keys. Each says where the value was found (text, and start/end as character offsets into content) and how likely it is:
probabilities lists every candidate, then null (not in the text). They sum to 1, so you can set your own bar.

Say what to find

The shape of extract is the shape of the answer. A question works as a field name too: {"What's the amount of the invoice?": ""}.

Types

Set type to get a value your code can use directly. Without it, you get the text as written. Values come only from what the text states: no relative dates, no missing years filled in, no unit or currency conversion. currency is null when the text names none. Units are dropped; ask for text to keep them.

Not found, not sure

When the text has candidates but none reads as the type, the result also carries parse_error, saying what it found.

Many documents

POST /v1/extract/batch takes up to 64 contents and one extract for all of them. results follows the order of contents.
A document that fails (for example, too long) comes back as {"ok": false, "error": "..."}. The rest still answer, and the failed one isn’t charged.

Usage and limits

meta.usage.input_tokens counts what Sage reads for each document: your content, field names and definitions. output_tokens is the size of the response. Ask only for the fields you need.
  • Up to 64 fields per request, 64 documents per batch.
  • Field names and questions: up to 256 characters, no double quotes or line breaks, unique ignoring case (_ counts as a space).
  • Definitions: up to 4,000 characters.
  • Content plus definitions: up to 16,384 tokens. Longer returns 413: split the document.
See Limits and errors for status codes.