DocumentationPOST /ine

POST /ine

POST contract, multipart fields, image constraints, and reservation semantics.

On this page
POST https://ocr.ecostudios.dev/api/v3/ine

One request processes one credential. mode=both accepts its front and back; front and back modes accept a single side. Independent requests share the account's admission limits.

Request headers

HeaderRequiredContract
X-API-KeyYesActive API key.
Idempotency-KeyYes8–128 ASCII characters matching ^[A-Za-z0-9._:-]{8,128}$.
Content-TypeYesmultipart/form-data with a boundary matching the encoded body.
AcceptNoapplication/json.

JSON bodies, image URLs, PDF, base64 strings, and credential batches are unsupported.

Form fields

FieldTypeContract
frontFileExactly one in both or front mode; absent in back mode.
backFileExactly one in both or back mode; absent in front mode.
modeStringboth (default), front, or back.
profileStringstandard (default) or extended.

Unknown form fields return invalid_form. Duplicate or unsupported options return invalid_options. Image-field cardinality inconsistent with mode returns missing_images.

standard returns eight scalar fields and mrz. extended adds twelve scalar fields, parsed address parts, and review metadata. Both profiles use the response contract.

Image requirements

PropertyAccepted value
FormatStatic JPG, PNG, WEBP, or HEIC.
File size32–10,485,760 bytes (10 MiB), per image.
Decoded width240–10,000 pixels.
Decoded height140–10,000 pixels.
Decoded areaAt most 50,000,000 pixels. Images over 2,048 pixels on the long side are scaled before reading; EXIF orientation is applied.
Multipart bodyAt most 21,037,056 bytes, including multipart overhead.
Paired imagesDifferent bytes in front and back.

Validation includes file signatures, static-image containers, and decoded properties. Passing validation does not establish text readability. A valid input can still produce image_too_complex during preparation when generated detail images exceed the processing size limit.

Request example

Node.js 22+; TypeScript with Node.js types; Python 3 with requests. INE_FRONT_TYPE is the input MIME type: image/jpeg, image/png, image/webp, or image/heic. cURL saves the body in INE_RESULT_PATH and headers in INE_HEADERS_PATH, and prints only the HTTP status. The functions return the HTTP response without logging extracted data.

curl --silent --show-error --max-time 90 \
  --output "$INE_RESULT_PATH" \
  --dump-header "$INE_HEADERS_PATH" \
  --write-out '%{http_code}\n' \
  'https://ocr.ecostudios.dev/api/v3/ine' \
  -H "X-API-Key: $INE_API_KEY" \
  -H "Idempotency-Key: $INE_IDEMPOTENCY_KEY" \
  -H 'Accept: application/json' \
  -F 'mode=front' \
  -F 'profile=extended' \
  -F "front=@${INE_FRONT_PATH};type=${INE_FRONT_TYPE}"

Each example performs one request without automatic retries or redirect following. The client timeout is 90 seconds; Python requests applies it to connection and read inactivity, not a total wall-clock deadline. HTTP error responses remain available to the caller.

mode=front excludes back. A single-side job consumes one unit; fields unavailable on that side remain null.

Response behavior

The initial POST waits for extraction. Completion returns 200 succeeded. A replay of an active job can return 202 processing:

{
  "request_id": "00000000-0000-4000-8000-000000000001",
  "status": "processing",
  "status_url": "/api/v3/ine/00000000-0000-4000-8000-000000000001"
}
Response headerContract
X-Request-IdCorrelation identifier matching the body; not every error identifier represents a reserved job.
Cache-Controlno-store.
Retry-After2 seconds on 202; admission errors can specify another delay.
LocationOn 202, the relative result route matching status_url.
Server-TimingOptional stage durations for a newly reserved reading. Parallel durations are not additive.

The API has no durable submission queue. GET responses expose the stored state. Non-success responses use the error contract.

Idempotency and reservation

A key is scoped to the authenticated account. The payload fingerprint includes exact image bytes, mode, and profile. A matching replay returns the same job without an additional unit. An existing key with a different fingerprint returns 409 idempotency_conflict; metadata and compression changes count as byte changes.

Pre-reservation rejection consumes no unit. Reservation occupies one unit. Success and no_fields retain it; recorded technical failures credit it back. A credit does not restart the job. Quota accounting applies independently of the response's recovery action.

Route compatibility

/api/v3/ine and /v3/ine expose the same English contract. /v1/ine and /v2/ine retain their earlier representations. All versions share jobs, quota, and idempotency.

The fallback origin https://ine-api.acessloop.workers.dev exposes the same /api/v3 paths and credentials. Origin changes do not create separate quota or idempotency scope. Documentation locale prefixes such as /es are not API prefixes.