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
| Header | Required | Contract |
|---|---|---|
X-API-Key | Yes | Active API key. |
Idempotency-Key | Yes | 8–128 ASCII characters matching ^[A-Za-z0-9._:-]{8,128}$. |
Content-Type | Yes | multipart/form-data with a boundary matching the encoded body. |
Accept | No | application/json. |
JSON bodies, image URLs, PDF, base64 strings, and credential batches are unsupported.
Form fields
| Field | Type | Contract |
|---|---|---|
front | File | Exactly one in both or front mode; absent in back mode. |
back | File | Exactly one in both or back mode; absent in front mode. |
mode | String | both (default), front, or back. |
profile | String | standard (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
| Property | Accepted value |
|---|---|
| Format | Static JPG, PNG, WEBP, or HEIC. |
| File size | 32–10,485,760 bytes (10 MiB), per image. |
| Decoded width | 240–10,000 pixels. |
| Decoded height | 140–10,000 pixels. |
| Decoded area | At most 50,000,000 pixels. Images over 2,048 pixels on the long side are scaled before reading; EXIF orientation is applied. |
| Multipart body | At most 21,037,056 bytes, including multipart overhead. |
| Paired images | Different 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}"
import { readFile } from 'node:fs/promises';
export async function createReading({ apiKey, idempotencyKey, frontPath, frontType }) {
const form = new FormData();
form.set('mode', 'front');
form.set('profile', 'extended');
form.set('front', new Blob([new Uint8Array(await readFile(frontPath))], { type: frontType }), 'front');
return fetch('https://ocr.ecostudios.dev/api/v3/ine', {
method: 'POST',
headers: {
'X-API-Key': apiKey,
'Idempotency-Key': idempotencyKey,
Accept: 'application/json',
},
body: form,
signal: AbortSignal.timeout(90_000),
redirect: 'error',
});
}
const response = await createReading({
apiKey: process.env.INE_API_KEY,
idempotencyKey: process.env.INE_IDEMPOTENCY_KEY,
frontPath: process.env.INE_FRONT_PATH,
frontType: process.env.INE_FRONT_TYPE,
});
import os
import requests
def create_reading(api_key, idempotency_key, front_path, front_type):
with open(front_path, "rb") as image:
return requests.post(
"https://ocr.ecostudios.dev/api/v3/ine",
headers={
"X-API-Key": api_key,
"Idempotency-Key": idempotency_key,
"Accept": "application/json",
},
data={"mode": "front", "profile": "extended"},
files={"front": ("front", image, front_type)},
timeout=90,
allow_redirects=False,
)
response = create_reading(
os.environ["INE_API_KEY"],
os.environ["INE_IDEMPOTENCY_KEY"],
os.environ["INE_FRONT_PATH"],
os.environ["INE_FRONT_TYPE"],
)
import { readFile } from 'node:fs/promises';
type ReadingInput = {
apiKey: string;
idempotencyKey: string;
frontPath: string;
frontType: string;
};
export async function createReading(
{ apiKey, idempotencyKey, frontPath, frontType }: ReadingInput,
): Promise<Response> {
const form = new FormData();
form.set('mode', 'front');
form.set('profile', 'extended');
form.set('front', new Blob([new Uint8Array(await readFile(frontPath))], { type: frontType }), 'front');
return fetch('https://ocr.ecostudios.dev/api/v3/ine', {
method: 'POST',
headers: {
'X-API-Key': apiKey,
'Idempotency-Key': idempotencyKey,
Accept: 'application/json',
},
body: form,
signal: AbortSignal.timeout(90_000),
redirect: 'error',
});
}
const response = await createReading({
apiKey: process.env.INE_API_KEY!,
idempotencyKey: process.env.INE_IDEMPOTENCY_KEY!,
frontPath: process.env.INE_FRONT_PATH!,
frontType: process.env.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 header | Contract |
|---|---|
X-Request-Id | Correlation identifier matching the body; not every error identifier represents a reserved job. |
Cache-Control | no-store. |
Retry-After | 2 seconds on 202; admission errors can specify another delay. |
Location | On 202, the relative result route matching status_url. |
Server-Timing | Optional 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.