Schema-valid JSON from text or document images.
Extraction is two of six pay-per-call APIs for autonomous agents. Pay per successful call with x402 V2 on Base mainnet—no account or API key.
Send text, HTML, or a PNG/JPEG/WebP image plus your JSON Schema. Receive JSON that validates with Ajv draft 2020-12, or a typed error and you are not charged.
- Text/HTML evidence: Benchmarked 100% schema-valid with ~0.99 field F1 and zero hallucinations across a 10-doc-type text/HTML corpus (11 items, incl. an adversarial prompt-injection tier), p50 latency ~1.5s and p95 ~57.7s. Evidence: /.well-known/benchmarks.json.
- Image evidence: Five real paid image calls passed schema validation and all 148 independently transcribed field anchors across a synthetic invoice/receipt launch corpus, with p50 latency ~2.6s and p95 ~4.1s. Small-corpus limitations are published at /.well-known/image-benchmarks.json.
Six APIs, one payment rail
Every service below is pay-per-call over x402 V2 with USDC on Base mainnet, with no account and no API key, and settles only on a successful result. This origin serves the two extraction APIs; the other four run on their own subdomains and publish their own schemas, benchmarks, and payment manifests.
| API | Use when | Endpoint | Price | Brief |
|---|---|---|---|---|
| SchemaSure Text extraction | you hold unstructured text or HTML and need JSON that matches a schema you supply | POST /v2/extract | $0.01/call, flat, failed calls free | llms.txt |
| SchemaSure Image extraction | you hold a document image — scan, receipt, form, label, or screenshot — and need JSON that matches a schema you supply | POST /v2/extract-image | $0.03/image, flat, failed calls free | llms.txt |
| ChronoSure Business time | you must resolve a local time, a DST ambiguity, a business-day offset, or a public holiday for a timezone | POST /v1/business-timechrono.schemasure.com | $0.01/call list | llms.txt |
| SQLPermit SQL guard | you are about to execute a PostgreSQL statement and need it checked against a policy first | POST /v1/guard/sqlsqlpermit.schemasure.com | $0.01/call list | llms.txt |
| TxGuard Transaction preflight | you are about to sign a Base transaction or an x402 payment authorization and need to know what it actually does | POST /v1/tx/preflighttxguard.schemasure.com | $0.01/call list | llms.txt |
| SafeFetch Safe fetch | you must read an untrusted web page and want the prose without the instructions hidden inside it | POST /v1/fetchsafefetch.schemasure.com | $0.01/call list | llms.txt |
Prices shown as "list" are for orientation only; the authoritative amount always comes from that service's live 402 challenge. For a machine-readable index of all six, read /apis.json or /SKILL.md.
Choose the right extraction API
| Input | Use | Endpoint | Price |
|---|---|---|---|
| Text or HTML | Emails, pages, logs, OCR text, resumes, invoices | /v2/extract | $0.01/call, flat, failed calls free |
| Document image | Scans, receipts, forms, labels, screenshots, photos | /v2/extract-image | $0.03/image, flat, failed calls free |
PDFs and multi-image requests are not supported. Convert each page to PNG, JPEG, or WebP and call the image endpoint once per image.
Production API: V2
POST /v2/extract is the canonical SchemaSure API for production agents, integrations, and marketplace discovery. It is always paid from the first call and uses x402 V2 with USDC on Base mainnet (eip155:8453).
curl -i -X POST https://schemasure.com/v2/extract \
-H 'content-type: application/json' \
-d '{"input":"Invoice #A-1042 — Acme Corp. Total due: $1,299.00 USD on 2026-08-01.","schema":{"type":"object","additionalProperties":false,"required":["invoiceNumber","total","currency","dueDate"],"properties":{"invoiceNumber":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string","enum":["USD","EUR","GBP"]},"dueDate":{"type":"string","format":"date"}}}}'
V2 payment flow
- The unsigned request returns
402withPAYMENT-REQUIRED. - Validate the live price, network, asset, payee, and resource; sign them with an x402 V2 wallet/client.
- Retry the identical request with
PAYMENT-SIGNATURE. - On
200, readPAYMENT-RESPONSEfor the settlement receipt.
Do not hardcode payment terms—validate the live challenge. The server verifies before work and settles only after producing schema-valid output.
Document image extraction: V2 only
POST /v2/extract-image reads invoices, receipts, forms, labels, screenshots, and photographed documents into your JSON Schema. Send base64 PNG, JPEG, or WebP bytes. This service is always paid via x402 V2 from the first call—there is no free or V1 image endpoint.
IMAGE_BASE64=$(base64 < invoice.png | tr -d '\n')
curl -i -X POST https://schemasure.com/v2/extract-image \
-H 'content-type: application/json' \
-d '{"image":{"data":"'"$IMAGE_BASE64"'","mimeType":"image/png"},"schema":{"type":"object","required":["invoiceNumber","total"],"properties":{"invoiceNumber":{"type":"string"},"total":{"type":"number"}}}}'
Successful response (data validates against the schema supplied in the request):
{
"data": {
"invoiceNumber": "INV-2048",
"vendor": "Northstar Supplies",
"total": 382.45
},
"meta": {
"repairs": 0,
"latencyMs": 910,
"validated": true
}
}
Maximum decoded image size: 8 MiB. The declared MIME type must match the file signature. Clear, upright, high-resolution images work best.
Try free on legacy V1
Evaluate extraction quality without connecting a wallet: the legacy POST /extract endpoint includes 3 limited free calls per client. When you are ready to automate or increase usage, move the agent to V2.
curl -X POST https://schemasure.com/extract \
-H 'content-type: application/json' \
-d '{"input":"Invoice #A-1042 — Acme Corp. Total due: $1,299.00 USD on 2026-08-01.","schema":{"type":"object","additionalProperties":false,"required":["invoiceNumber","total","currency","dueDate"],"properties":{"invoiceNumber":{"type":"string"},"total":{"type":"number"},"currency":{"type":"string","enum":["USD","EUR","GBP"]},"dueDate":{"type":"string","format":"date"}}}}'
| V1 evaluation | V2 production | |
|---|---|---|
| Endpoint | /extract | /v2/extract |
| Free calls | 3 limited calls/client | No—payment from first call |
| Recommended for | Trying SchemaSure | Production agents and marketplaces |
| Protocol | x402 V1 | x402 V2 |
Pricing
- Text/HTML: $0.01/call, flat, failed calls free.
- Image: $0.03/image, flat, failed calls free. V2-only; no free image calls.
- Primary V2 API — USDC on Base mainnet. No signup, API keys, or account dashboard.
- Charge-only-on-success: verified up front, settled only after valid output is produced.
- Free evaluation calls are available only on the legacy V1 endpoint.
Why agents can trust it
Prompt-injection defenses
Document content is delimited and treated as data. The text benchmark includes an adversarial injection case; no defense is represented as universally infallible.
Typed errors
Machine-readable JSON with stable error codes — never an HTML page.
Validated output
Every result is checked against your JSON Schema with Ajv (draft 2020-12).
Modality-specific evidence
Inspect text/HTML metrics and paid image metrics, including sample sizes, latency tails, methodology, and limitations.
Error handling and retry policy
| HTTP | Codes | Agent action |
|---|---|---|
| 400 / 413 | BAD_REQUEST, INVALID_SCHEMA, INPUT_TOO_LARGE, UNSUPPORTED_INPUT_TYPE | Fix or reduce the request. Do not retry it unchanged. |
| 402 | PAYMENT_REQUIRED, PAYMENT_INVALID | Validate and sign the live challenge, or obtain a fresh challenge. Retry the identical body only. |
| 422 | EXTRACTION_FAILED, VALIDATION_FAILED, ABSTAINED | Change the input/schema or use a fallback. No settlement occurs. |
| 429 | RATE_LIMITED | Wait for Retry-After. |
| 500 / 502 / 504 | INTERNAL, UPSTREAM_LLM_ERROR, PAYMENT_UPSTREAM, TIMEOUT | Retry with bounded exponential backoff. Include X-Request-ID in support reports. |
Every error is JSON: {"error":{"code":"...","message":"...","details":{...}}}. Do not blindly replay a paid request after losing its response; request idempotency is not yet available.
Text V2 request & response example
Canonical request body for /v2/extract:
{
"input": "Invoice #A-1042 — Acme Corp. Total due: $1,299.00 USD on 2026-08-01.",
"schema": {
"type": "object",
"additionalProperties": false,
"required": [
"invoiceNumber",
"total",
"currency",
"dueDate"
],
"properties": {
"invoiceNumber": {
"type": "string"
},
"total": {
"type": "number"
},
"currency": {
"type": "string",
"enum": [
"USD",
"EUR",
"GBP"
]
},
"dueDate": {
"type": "string",
"format": "date"
}
}
}
}
Response (data validates against your schema; meta reports repairs and latency):
{
"data": {
"invoiceNumber": "A-1042",
"total": 1299,
"currency": "USD",
"dueDate": "2026-08-01"
},
"meta": {
"repairs": 0,
"latencyMs": 640,
"validated": true
}
}
Best results come from describing your fields: a per-field description in your schema is the biggest accuracy lever. Max input 256 KB per call.
Agent integration
Machine-readable discovery surfaces:
/llms.txt /SKILL.md /openapi.json /.well-known/x402 /.well-known/x402-image /.well-known/x402-v1 /.well-known/pricing.json /.well-known/benchmarks.json /.well-known/image-benchmarks.json /apis.json /.well-known/security.txt /.well-known/data-handling.json
MCP: run npx -y @noamjose/schemasure. The published thin client exposes extract_to_schema and extract_image_to_schema; set SCHEMASURE_PRIVATE_KEY for paid x402 V2 mode. The dedicated wallet signs locally and the key never reaches SchemaSure. Package and setup.
Data handling: production does not persist raw text, HTML, images, schemas, or extracted output. /metrics is an ephemeral per-process operational snapshot that resets on deploy; it is not an adoption counter.