What to use
When to use analyze, classify, batches, the widget, the MCP server or a no-code tool in Constaia, with the cost, latency and limits of each option.
Constaia offers several ways to process documents. They all use the same API and the same keys; what changes is the cost, the latency and who uploads the file.
Summary
| Option | What for | Cost | Response |
|---|---|---|---|
POST /v1/analyze | Verdict + extracted data for one document | 1 credit per 2 pages (minimum 1) | Synchronous up to 30 s; otherwise 202 and webhook |
POST /v1/classify | Only find out which document type it is | 0.2 credits | Synchronous |
POST /v1/batches | Many documents at once (1–100) | Like analyze, per document | Always 202; batch.completed webhook |
Widget <constaia-upload> | Browser capture with camera and quality control | That of the analysis your backend runs | Whatever your backend returns |
| MCP server | Let an AI agent (Claude, Cursor…) analyse documents | Like analyze / classify | MCP tools |
| No-code | n8n, Make, Zapier, Power Automate… with HTTP requests | Like analyze / classify | Depends on the tool |
How to decide
| Question | If the answer is yes |
|---|---|
| Do you need to know whether the document is valid and get its data? | analyze with expect and checks. |
| Do you only need to route (is it an invoice or a receipt?) without extracting data? | classify. It costs a fifth. |
| Do you receive several documents at once (a folder, an email with attachments, an import)? | batches, with a combined export. |
| Does the user upload from a browser or phone and you want to guide the photo? | Widget in the frontend + analyze in your backend. |
| Are you working from an AI assistant or agent? | MCP server. |
| Don't want to write code? | The no-code guide for your tool. |
You can combine them: for example, classify to decide the type and then analyze with the right expect, or
the widget in the form and batches for bulk imports.
Cost
analyze:ceil(pages / 2)credits, minimum 1. An ID card with both sides in one file or a 2-page PDF costs 1 credit; a 5-page PDF, 3.classify: 0.2 credits per document.- Batches: each document is charged as an
analyze. In live mode Constaia checks up front that you have at least 1 credit per document (otherwise 402). - Exports are included. Test mode never charges.
See Credits and billing and Pricing.
Latency
analyzeandclassifywait up to 30 seconds. If the analysis hasn't finished, they respond 202 with the analysis inqueuedorprocessingand the result arrives by webhook or by pollingGET /v1/analyses/{id}.- With
async: truethe response is always an immediate 202. - Batches are always asynchronous: you get
analysis.review_requiredandanalysis.failedper document and a singlebatch.completedat the end.
Limits
| Limit | Value |
|---|---|
| File size | 20 MB |
| Pages per PDF | 30 synchronous, 200 with async: true or in batches |
| Documents per batch | 1–100 |
Types in expect | 1–20 |
| Requests per second | Per key: 2 on the free plan, 10 on paid |
| Concurrent synchronous analyses | Per account: 2 on the free plan, 10 on paid (batches and async: true don't count) |
| Pages per minute | Per account: 60 on the free plan, 600 on paid (see Rate limits) |
Examples
analyze
curl https://api.constaia.com/v1/analyze \
-H "Authorization: Bearer $CONSTAIA_API_KEY" \
-F file=@dni_valid.jpg \
-F 'options={"expect":"es_dni","checks":{"min_age_years":18}}'Returns the full analysis: document, verdict, fields, checks, warnings. See
Quickstart.
classify
curl https://api.constaia.com/v1/classify \
-H "Authorization: Bearer $CONSTAIA_API_KEY" \
-F file=@dni_valid.jpg \
-F 'options={"expect":"es_dni"}'{
"object": "classification",
"status": "completed",
"document": { "type": "es_dni", "label": "DNI (España)", "confidence": 0.97, "side": "both", "country": "ESP" },
"candidates": [{ "type": "es_dni", "confidence": 0.97 }],
"verdict": {
"expected": ["es_dni"],
"match": true,
"status": "valid",
"reasons": [{ "code": "type_match", "severity": "info", "message": "El documento es DNI (España)." }]
},
"warnings": []
}The classify verdict only evaluates the type (type_match or type_mismatch): it does not check expiry or
extract fields.
Batch
curl https://api.constaia.com/v1/batches \
-H "Authorization: Bearer $CONSTAIA_API_KEY" \
-F "files[]=@invoice-001.pdf" \
-F "files[]=@invoice-002.pdf" \
-F 'options={"expect":"invoice","export":["xlsx"]}'It responds 202 with a batch object (bat_...) in processing. When it finishes you get batch.completed with
counts and the combined export in exports.xlsx, one row per document. See
Bulk batches.
Widget
<script type="module" src="https://cdn.jsdelivr.net/npm/@constaia/widget@0.1"></script>
<constaia-upload endpoint="/api/constaia" document="es_dni" lang="en"></constaia-upload>The widget never holds the key: it sends the file to your endpoint (/api/constaia), and your backend calls
POST /v1/analyze with the expect and checks it decides. See Widget.
MCP
claude mcp add constaia --env CONSTAIA_API_KEY=ck_test_... -- npx -y @constaia/mcpIt exposes the tools analyze_document, classify_document, list_document_types, get_analysis and
get_balance. See MCP server.
No-code
In n8n, Make, Zapier or Power Automate you use the tool's HTTP module to call POST /v1/analyze. See the
n8n, Make and Zapier guides.
Coming soon
- Verification links (
POST /v1/verification-links): a URL you send to the user so they upload the document without going through your backend. Today it responds 501not_implemented. - Official n8n node and publishable browser keys.
Next steps
Key concepts
Document types, expect, verdicts, reasons, fields, checks, warnings, test and live modes, credits, storage, webhooks and idempotency in Constaia.
Test mode
How Constaia ck_test_ keys work, what each test file returns and how to write automated tests with Vitest, PHPUnit or pytest without spending credits.