Introduction
Constaia is a European API that tells you whether a document is the one you expect and valid, with reasons, extracted fields and zero retention by default.
Constaia is an API to validate, classify and extract data from documents with AI. It is built for registration forms, customer onboarding, licences, case files and any flow where someone uploads a document and you have to decide whether it is acceptable.
The question it answers
Most document APIs give you text or fields. Constaia answers a different question:
Is this document a valid X?
You say what you expect (expect: "es_dni") and which rules it must meet (checks: not expired, holder,
maximum age, signature, amount…). Constaia returns one of three verdicts:
| Verdict | Meaning |
|---|---|
| Válido | It is the expected type and no check failed or raised doubts. |
| No válido | Some reason has severity error: a different document type, expired, holder mismatch, wrong NIF check letter… |
| Revisar | Some reason has severity warning: low quality, low confidence, unidentified type. A person should look at it. |
Each verdict comes with reasons (reasons): a stable code for your logic and a localised message to show
the user. Details in Verdicts and reasons.
A minimal example
curl https://api.constaia.com/v1/analyze \
-H "Authorization: Bearer $CONSTAIA_API_KEY" \
-F file=@dni_valid.jpg \
-F 'options={"expect":"es_dni"}'{
"id": "an_01J...",
"object": "analysis",
"status": "completed",
"document": { "type": "es_dni", "label": "DNI (España)", "confidence": 0.97, "side": "both", "country": "ESP" },
"verdict": {
"expected": ["es_dni"],
"match": true,
"status": "valid",
"reasons": [
{ "code": "type_match", "severity": "info", "message": "El documento es DNI (España)." },
{ "code": "not_expired", "severity": "info", "message": "Vigente hasta el 12/03/2031." }
]
},
"checks": [
{ "code": "nif_check_digit", "passed": true, "message": "La letra del documento 12345678Z es correcta." }
],
"warnings": []
}Messages are in Spanish by default; send "language": "en" in the options to get them in English
("Valid until 12/03/2031."). With a test key (ck_test_...) you can run this call right now without spending
credits: the result depends on the file name. See the quickstart.
What every analysis returns
document: detected type from the catalogue, readable label, confidence, side and country.verdict: status (valid,invalid,review) and reasons. It isnullif you don't sendexpect.fields: extracted data, each withvalue,confidence,validatedandsource(page and source rectangle). You can also pass your own JSON Schema inextract.checks: deterministic validations (NIF check letter, MRZ check digits, IBAN, invoice totals…) that do not depend on AI.warnings: quality or possible-tampering signals (blurry,glare,screen_photo_suspected…). They are signals, not proof of fraud.exports: signed links to JSON, CSV, XLSX, XML, vCard or PDF if you ask for them.usage: pages processed and credits consumed.
All concepts, summarised, in Key concepts.
European, with zero retention by default
- Processing happens in the EU, with AI providers in European regions. See Storage and privacy and Data residency.
- By default
storageisnone: in a synchronous analysis the file is processed in memory and never written to any storage. If you need to keep it, choosetemporary(withttl_hours) orpersistent. - With
keep_results: falsethe extracted data is not stored either: you get it once and that's it. - Files that are stored are encrypted in the application (AES-256-GCM, per-account key) before reaching object storage in the EU.
What Constaia is not
Constaia is not biometric KYC: it does not compare faces, does no liveness checks and does not query official registries. It checks that the document is the type you expect, that its data is consistent and that it meets your rules. Warnings about possible editing or screen photos are signals to decide whether to review, not fraud detection.
The csv_format code only checks the format of the secure verification code (CSV) on Spanish certificates.
Constaia does not query the issuer's verification service; if you need that, verify the CSV on the issuer's
official site.
Next steps
Quickstart
Your first analysis in 5 minutes with a test key.
Key concepts
Types, expect, verdicts, fields, checks, modes and credits.
What to use
analyze, classify, batches or widget: which one fits your case.
Use cases
ID cards in a form, medical certificates, receipts, invoices…
Integrations
Node, Next.js, Laravel, Django, n8n and many more.
API reference
Every endpoint, parameter and error.
JavaScript SDK
@constaia/sdk for Node, Bun, Deno and edge.
MCP server
Use Constaia from Claude, Cursor or VS Code.