TrustTyped API¶
TrustTyped API turns a document or a conversation into typed JSON. You send the text (or an image) and a schema that describes the fields you want; the API fills every field at the same time and returns values that are guaranteed to match their types: numbers are numbers, booleans are booleans, enums are one of the listed values.
curl https://api.trusttyped.com/v1/typed \
-H "Content-Type: application/json" \
-d '{
"context": "Sunrise Cafe. Fried Rice 25000, Iced Tea 8000. Total 33000. Paid in cash.",
"schema": {
"merchant": {"type": "string", "extract": true, "instruction": "Store name"},
"total": {"type": "number", "integer": true, "instruction": "Final total"},
"paid": {"type": "bool", "instruction": "Was it paid?"},
"category": {"enum": ["food", "transport", "other"], "instruction": "Category"}
}
}'
{
"result": {"merchant": "Sunrise Cafe", "total": 33000, "paid": true, "category": "food"},
"confidence": {"merchant": 1.0, "total": 1.0, "paid": 0.9998, "category": 1.0},
"needs_review": []
}
Hosted API vs. self-hosted engine
The Hosted API (https://api.trusttyped.com) uses POST /v1/extract
with API-key auth. A self-hosted typed-serve deployment uses
POST /v1/typed with no auth. This site documents the engine (schemas,
fields, rules) for both; the hosted service has its own
Getting started section.
What you can build¶
- Document extraction: receipts, invoices, forms, IDs, statements into typed JSON, with verbatim copies of names and numbers.
- Classification and routing: category, priority, sentiment, team, in one request.
- Decisions with rules: policy checks done by code, the model explains, doubtful cases go to a human. See the credit assessment example.
- Conversations: fill a form over several chat turns, in the OpenAI
messagesformat. - Enrichment with your APIs: fetch data from HTTP APIs in the middle of a request and use it in later fields.
How a request works¶
flowchart LR
In["context / messages / image"] --> S1["Stage 1<br/>fields filled in parallel"]
S1 --> R1{"rules<br/>(code)"}
R1 --> S2["Stage 2<br/>fields that depend on stage 1,<br/>computed fields, API calls"]
S2 --> R2{"rules<br/>(code)"}
R2 --> Out["result + confidence<br/>+ needs_review + trace"]
- The input is read once and shared by every field.
- Fields without dependencies are filled in parallel; fields that
depends_onothers run in a later stage and see their values. - After each stage, rules run in code: reject, retry, branch, or flag a field for human review.
- The response carries the values plus everything needed to trust them: per-field confidence, the fields that need review, and an audit trail.
Guarantees¶
- Types are guaranteed. A
numberfield always parses as a number, aboolistrue/false, anenumis one of its values. No JSON repair or retries are needed. If a typed value cannot be completed, the field isnullrather than a partial value. - Values are not guaranteed. A correctly shaped value can still be wrong.
The API tells you when it is unsure (
confidence,needs_review) and lets you add checks in code. See Confidence and review. - Deterministic. The same input, schema, parameters and model revision
give the same output, so results can be reproduced for audit
(
provenancein every response).
Next steps¶
- :material-cloud-outline: Hosted API — first call in
minutes against
api.trusttyped.com(key auth, streaming, idempotency). - :material-rocket-launch: Quickstart — your first request in curl, Python and JavaScript.
- :material-table-cog: Structured outputs — field types and options.
- :material-shield-check: Confidence and review — know when to trust a value.
- :material-book-open-variant: API reference — every endpoint, parameter and response field.