API reference

Extract

Pull named fields out of a document: each value as written, with its position and a confidence.

POST/v1/extract

Base URL https://api.wity.alphanimble.com. Same authentication as decisions: Authorization: Bearer wity_…. For how to write fields, see Extract.

Request body#

text
stringrequired
The document, 1 to 60,000 characters of plain text.
fields
objectrequired
1 to 16 fields: name (up to 64 characters, no double quotes) → what the field asks for, in plain words (up to 300 characters).
types
object
Optional. Field name → date (YYYY-MM-DD), duration or number: those fields come back normalised.

Note

Unknown top-level fields are rejected with 400.

Response#

{
"fields": { "name": ["PRIYA NAIR"], "college": ["National Institute of Technology, Calicut"], "skill": ["Kafka", "Python", "SQL", …] },
"entities": [
{ "field": "name", "text": "PRIYA NAIR", "start": 0, "end": 10, "confidence": 0.9924 },
{ "field": "college", "text": "National Institute of Technology, Calicut", "start": 571, "end": 612, "confidence": 0.8933 },
{ "field": "skill", "text": "Kafka", "start": 265, "end": 270, "confidence": 0.9604 },
…
],
"timing_ms": 503,
"usage": { "input_tokens": 301, "output_tokens": 0 }
}
fields
object
Every field you asked for, in your order, with its values ([] when the document has none).
entities
array
The same values with field, text, character offsets start / end (end exclusive) and confidence (0 to 1), by field and then by position. For a typed field, text is the normalised value and the offsets mark where it was read.
timing_ms
number
Time spent on the server.
usage
object
input_tokens: the document and the field list, counted once, billed at $0.042 per million. output_tokens is always 0.

Errors#

400
invalid
Empty text or over 60,000 characters, no fields or more than 16, a name or description out of bounds, or a type other than date, duration or number. The body says which.
401
auth
Missing or unknown key.
402
credit
Your balance is zero. See Errors, limits & billing.
429
busy
Your key's rate limit, or too many extractions running on the server. Retry after Retry-After seconds.

Note

Long documents take longer: use a client timeout of at least two minutes.

Previous

← Split: POST /v1/split

Next

Skills: /v1/skills →