API v3
HTTP contract, extraction profiles, and reading lifecycle.
On this page
https://ocr.ecostudios.dev/api/v3
Endpoints
| Method | Path | Operation |
|---|---|---|
POST | /ine | Reading reservation and extraction. multipart/form-data body. |
GET | /ine/{request_id} | Stored status and result. No body; no inference. |
The public contract uses English JSON properties, enum values, and error codes. Routes and schemas are independent of documentation language.
HTTP contract
| Element | Specification |
|---|---|
| Transport | HTTPS. |
| Authentication | X-API-Key, required on both endpoints. Scope and revocation. |
| Idempotency | Idempotency-Key, required on POST: ^[A-Za-z0-9._:-]{8,128}$. |
| POST body | multipart/form-data; boundary=…. Binary file parts in front and/or back; options mode and profile. |
| Response representation | application/json. |
| Caching | Cache-Control: no-store. |
| Correlation | X-Request-Id and request_id. An error identifier does not imply that a reading was reserved. |
| Pending state | HTTP 202, status: "processing", Location, status_url, and Retry-After: 2. |
JSON uploads, image URLs, base64, PDF, and batches within a single request are unsupported. Accepted files are static JPG, PNG, WEBP, and HEIC, limited to 10 MiB per file; phone photos up to 50 megapixels are scaled before reading. Dimension, multipart body, and side-combination constraints are defined in the extraction request.
Extraction profiles
| Parameter | Value | Structure |
|---|---|---|
mode | both — default | Requires front and back. |
mode | front or back | Requires only the selected side's file. |
profile | standard — default | data: eight nullable scalars and mrz. |
profile | extended | data: twenty scalars, mrz, and address_parts; metadata in sources, checks, and quality. |
Scalar fields have type string | null. mrz is an array of three strings or null. The twelve address_parts components are derived from address OCR fields; they are not twelve additional fields read directly from the credential.
The field reference defines types, printed sources, and nullability. The extended profile defines sources, checks, and image observations. profile: "extended" is present in the extended response; the standard response omits profile.
Reading lifecycle
The initial POST remains open during extraction. A completed reading returns HTTP 200 with status: "succeeded". A retrieval or idempotent replay while processing returns HTTP 202; this state does not represent a durable inference queue.
| Result | Semantics |
|---|---|
200 succeeded | Extraction completed; data contains available values and warnings their associated warnings. |
202 processing | Pending reading. request_id identifies the resource available through GET. |
| Pre-reservation error | Creates no new reading and consumes no additional units. The error may include a correlation request_id. |
| Recorded technical failure | Terminal job state. Its GET or replay returns HTTP 422, even if the original POST returned 502 or 504. |
410 result_expired | The result is outside its availability window. |
Current results expire 23 hours after reservation. GET and idempotent replay do not extend expires_at, rerun OCR, or consume another unit. Compatible historical results may contain expires_at: null.
Idempotency
The key is associated with the account, exact image bytes, mode, and profile. An equivalent replay returns the existing job. Reusing a key with different content or options produces 409 idempotency_conflict. The scope is shared across API versions.
A client timeout or disconnect leaves the POST outcome unconfirmed; it does not establish that reservation failed. A new key permits a new reservation and may duplicate processing. Error codes and recovery actions are defined in errors and idempotency.
Result semantics
null represents an absent, unreadable, ambiguous, or conflicting value according to the field and its warnings. It is distinct from an empty string or zero. needs_review is always true; 200 describes completed extraction, not the accuracy of each value or credential authenticity.
Extended-profile format, check-digit, and consistency checks are separate from transcription. They do not modify extracted text or query INE or RENAPO registries.
Admission and usage
An account supports up to two active jobs and ten new reservations within a rolling 60-second window, in addition to its monthly quota. A reservation occupies one unit regardless of mode or profile. Completed readings and no_fields retain that unit; recorded technical failures credit it back. A credit does not remove the reservation from the per-minute count.
429 states, quotas, and accounting rules are specified in limits and usage. Terminal-state notification is specified in webhooks.