API reference

Inputs, response fields and errors for the MRZ interface.

POST/v1/mrz

Your base URL and key are provided after activation. The customer API is not enabled on this website.

Back to the simple guide ↗

Authenticate from your server.

API access is available on request. Use your key only in your server application, never in browser code, mobile client bundles, URLs or public repositories.

PropertyValue
Base URLMRZ_BASE_URL — provided after activation
AuthenticationAuthorization: Bearer <API_KEY>
MethodPOST
Response formatapplication/json
TransportHTTPS

Missing or incorrect credentials return 401 unauthorized. Keys are matched exactly. After activation, you receive the separate base URL. Configure MRZ_BASE_URL and protected MRZ_API_KEY on your server. The /v1/mrz route on this website is currently disabled (HTTP 404).

Send one image as Base64 JSON.

Set Content-Type: application/json and send exactly the image_base64 field. Encode the image bytes using standard Base64.

request.json
{
  "image_base64": "BASE64_IMAGE"
}

Replace the placeholder. JSON contains exactly one field; its value is not a file path or image URL.

RuleRequirement
Base64Standard alphabet A–Z a–z 0–9 + /, correct = padding and canonical zero pad bits. No whitespace, line breaks, URL-safe characters or data:image/…;base64, prefix.
JSON shapeAn object with exactly one string field. No extra fields, duplicate keys, arrays or null values.
Image sizeAt most 25 MiB = 26,214,400 decoded bytes. At most 34,952,536 Base64 characters.
include_cropQuery parameter true (default) or false. With false, the Base64 crop image is omitted; the recognised data keeps the same response format.

Multipart remains supported.

Existing integrations can continue to send the image in multipart field file. Let the HTTP client generate the Content-Type with its boundary. Recognition and response semantics are the same for both input formats.

cURL · multipart
curl "${MRZ_BASE_URL}/v1/mrz?include_crop=false" \
  --header "Authorization: Bearer $MRZ_API_KEY" \
  --form 'file=@document.jpg' 

POST /v1/mrz

HTTP 200 returns a MRZResponse object. Each document remains a separate candidate.

FieldTypeMeaning
imageobjectWidth, height and coordinate_space: exif_oriented_pixels. Coordinates reference the EXIF-oriented original image.
documentsarrayZero, one or multiple separate document candidates. An empty list is valid. Do not merge fields across candidates.
timed_outbooleantrue marks an incomplete result. Check it first even with HTTP 200.
processing_msnumberProcessing duration for this result in milliseconds; not a latency guarantee.
engine_versionstringRecognition engine version. Useful for support and compatibility diagnostics.

Result states

StateMeaningRecommended handling
recognizedMRZ recognised.Still review fields, checks, corrections and diagnostics. Do not treat as proof of identity.
uncertainRecognition or association is uncertain.Request manual review or a better image. Do not auto-import.
no_mrzNo usable MRZ for this candidate.Capture a complete, sharp MRZ again. An available crop does not mean recognition succeeded.
documents: []No document candidate in the result.Treat as no recognition, not a successfully empty document.
timed_out: trueProcessing was incomplete.Do not auto-import. Check time budget, image quality and temporary load.

Complete response example

Illustrative example using public ICAO Utopia data. Image bytes are replaced with BASE64_JPEG; timing and version values illustrate the type and are not performance claims.

MRZResponse · HTTP 200
{
  "image": {
    "width": 1200,
    "height": 760,
    "coordinate_space": "exif_oriented_pixels"
  },
  "documents": [
    {
      "status": "recognized",
      "format": "TD3",
      "raw_mrz": [
        "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<",
        "L898902C36UTO7408122F1204159ZE184226B<<<<<10"
      ],
      "mrz": [
        "P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<",
        "L898902C36UTO7408122F1204159ZE184226B<<<<<10"
      ],
      "fields": {
        "document_code": "P<",
        "issuing_state": "UTO",
        "document_number_raw": "L898902C3",
        "nationality": "UTO",
        "date_of_birth": "740812",
        "sex": "F",
        "date_of_expiry": "120415",
        "optional_data": "ZE184226B<<<<<",
        "names_raw": "ERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<",
        "document_number": "L898902C3",
        "document_number_extended": false,
        "surname_raw": "ERIKSSON",
        "given_names_raw": "ANNA<MARIA",
        "surname": "ERIKSSON",
        "given_names": "ANNA MARIA"
      },
      "checks": {
        "date_of_birth": {
          "expected": "2",
          "actual": "2",
          "valid": true,
          "applicable": true
        },
        "date_of_expiry": {
          "expected": "9",
          "actual": "9",
          "valid": true,
          "applicable": true
        },
        "optional_data": {
          "expected": "1",
          "actual": "1",
          "valid": true,
          "applicable": true
        },
        "document_number": {
          "expected": "6",
          "actual": "6",
          "valid": true,
          "applicable": true
        },
        "composite": {
          "expected": "0",
          "actual": "0",
          "valid": true,
          "applicable": true
        }
      },
      "corrections": [],
      "errors": [],
      "mrz_quad": [
        [
          60.63999938964844,
          516.3800048828125
        ],
        [
          1112.280029296875,
          515.219970703125
        ],
        [
          1112.6600341796875,
          601.4600219726562
        ],
        [
          60.790000915527344,
          602.9500122070312
        ]
      ],
      "recognition_score": 0.9833,
      "recognition_method": "neural_mrz_casefold_aspect0.7+neural_mrz_casefold",
      "document_quad": [
        [
          11.5600004196167,
          3.5999999046325684
        ],
        [
          1185.4300537109375,
          9.420000076293945
        ],
        [
          1185.760009765625,
          756.9400024414062
        ],
        [
          9.619999885559082,
          754.3699951171875
        ]
      ],
      "crop_quad": [
        [
          11.559963226318358,
          3.598575592041015
        ],
        [
          1185.4285889897849,
          9.422903061521222
        ],
        [
          1185.759399282995,
          756.9421386655698
        ],
        [
          9.615039825346546,
          754.3733520866444
        ]
      ],
      "document_score": 0.9992,
      "crop_basis": "document",
      "association_basis": null,
      "recognition_retry": null,
      "crop_jpeg_base64": "BASE64_JPEG"
    }
  ],
  "timed_out": false,
  "processing_ms": 125.5,
  "engine_version": "0.1.6"
}

Document object: all public fields

FieldTypeMeaning
statusstringrecognized · uncertain · no_mrz
formatstring | nullTD1 · TD2 · TD3
raw_mrz / mrzstring[]Original and selected MRZ lines. Preserve line lengths and < fillers.
fieldsobjectExtracted data. Values are string, boolean or null; not every field is always present.
checksobjectCheck objects for document number, dates, optional data and composite check. See below.
correctionsarrayline and index are zero-based; from, to and score record character corrections.
errorsstring[]Candidate diagnostics. This is not an HTTP error field. Review before importing.
document_quad / mrz_quad / crop_quadarray | nullCoordinate pairs [x,y] for each geometry. Missing geometry is null.
crop_basisstring | nulldocument, input_border_context, document_mrz_extension
association_basisstring | nullOptional association evidence: unique_partial_overlap_surface, unique_continuous_surface_corridor, unique_context_detector_consensus. Not proof of physical document identity.
recognition_score / document_scorenumber | nullInternal scores. Do not interpret as calibrated correctness probabilities or percentages.
recognition_methodstring | nullName of the recognition method. Diagnostic metadata, not a fixed enum for business logic.
recognition_retryobject | nullEvidence of a reread: method and previous source_document without image bytes. May contain additional evidence.
crop_jpeg_base64string | nullDocument crop as plain Base64 JPEG bytes. May be absent or null, especially with include_crop=false. Not a separately cropped portrait.

Extracted fields

FieldMeaning
surname, given_namesNormalised names; original reading in surname_raw, given_names_raw, names_raw.
document_numberFull document number; document_number_raw retains the original main field, document_number_extended marks continuations.
document_codeOriginal two-character code, e.g. P<.
issuing_state, nationalityMRZ codes including any fillers. Unknown codes are preserved and flagged.
date_of_birth, date_of_expiryRaw MRZ dates in YYMMDD format; incomplete birth dates may contain <. This endpoint does not determine the century.
sexMRZ value M, F or <.
optional_data, optional_data_2, optional_data_remainingFormat-dependent optional raw data. No personal identification number is inferred from them.

Interpret check digits correctly

checks.document_number
{"expected":"6","actual":"6","valid":true,"applicable":true}

expected is the calculated digit, actual is the observed digit; either can be null. Only applicable=true and valid=true mean an applicable check passed. Missing or non-applicable checks do not count as passed. Check names: document_number, date_of_birth, date_of_expiry, optional_data and composite.

Handle diagnostics and multiple documents.

Each candidate carries its diagnostics in errors. Also inspect checks, corrections and, when present, recognition_retry. A recognized status does not replace these checks.

EvidenceMeaning & handling
Check digitschecksum_<name> in errors marks a failed check digit. The individual values are in checks.
CorrectionsReview corrections and differences between raw_mrz and mrz. Not all fields are protected by check digits.
Rereadrecognition_retry describes a reread of the same lossless crop. Its source_document preserves the preceding result without image bytes.
Document associationassociation_basis and coordinates describe the spatial association of a document and MRZ. They do not prove a person’s identity or document authenticity.

Document diagnostics

The current engine can return the following diagnostic groups. Failed check digits also appear as checksum_<name> in errors. Preserve unknown future codes and route them to review instead of assuming success.

Syntax and field contents

invalid_line_structureinvalid_charactersinvalid_document_codeinvalid_issuing_stateinvalid_nationalityinvalid_document_numberinvalid_document_number_rawinvalid_extended_document_numberinvalid_date_of_birthinvalid_date_of_expiryinvalid_sexinvalid_names_rawinvalid_name_paddinginvalid_optional_datainvalid_optional_data_2

Unknown country/state codes

unknown_issuing_stateunknown_nationality

Correction and character evidence

invalid_alternativescorrection_limit_exceededambiguous_correctionslow_recognition_scorelow_character_evidenceconflicting_raw_character_evidenceunsupported_character_correction

Image position and time budget

mrz_outside_imageprocessing_budget_exhausted

Multiple candidates remain separate.

documents contains every candidate, including those with uncertain or no_mrz. The API does not select one flat result or merge fields. If your application expects exactly one document, check the count and candidates explicitly. Ask for a separate document image or provide manual selection when ambiguous. documents: [] means no candidate was found.

HTTP errors and concrete next steps.

Request and service failures use HTTP 4xx/5xx. The table covers current engine mappings, including shared decoder diagnostics. Not every diagnostic code can occur for every format.

HTTPError / responseWhat your application should do
400invalid_content_lengthInvalid Content-Length. Let the HTTP client calculate this header.
422invalid_requestInvalid JSON shape: image_base64 is missing, is not a string, or extra fields are present. Send an object with exactly this string field.
401unauthorizedBearer token missing or incorrect. Check the key; do not retry unchanged.
405detailWrong method. Use POST.
408upload_timeoutUpload exceeded its time window. Check the connection or send a smaller file.
413upload_too_largeTransport, Base64 or decoded-file limit exceeded. Reduce the image; Base64 increases data size.
413
image_limitpixel_limitupload_limitpdf_page_limit
Image, pixel or decoder limit. Reduce dimensions; do not send PDFs to this single-image endpoint.
422invalid_jsonMalformed JSON, duplicate keys or an invalid JSON constant. Generate valid UTF-8 JSON.
422invalid_base64Empty, invalid or non-canonical Base64. Re-encode original bytes using standard Base64 without line breaks.
422
invalid_imageunsupported_formatempty_fileimage_too_small
No usable image. Send a supported file with a legible MRZ.
422
invalid_heicheic_decode_failedinvalid_webpunsupported_rawinvalid_rawraw_decode_failed
Format-specific decoder failure. Check the file or convert to JPEG/PNG while preserving quality.
422
pdf_requires_batchpdf_password_requiredinvalid_pdfinvalid_pagepdf_emptypdf_invalid_geometrypdf_decode_failed
PDF/page diagnostics from the shared decoder. This interface accepts one image; send a suitable page as an image. The internal batch API is not publicly exposed.
422detail: […]FastAPI validation on /v1/mrz, e.g. a missing multipart field or invalid query parameter. Correct fields/parameters.
500processing_failedInternal processing or response error. Retry only a limited number of times; contact support if repeated.
503service_busyProcessing capacity is occupied. Honour Retry-After: 2 and reduce concurrency.
504processing_timeoutProcessing stopped. Error response includes timeout evidence; after a short pause try a smaller or more suitable image.
4xx / 5xxrequest_failed / detailGeneric HTTP or proxy failure. Check the HTTP status and Content-Type; error responses do not match the successful MRZResponse model.

Distinguish error envelopes

/v1/mrz · HTTP 422
{"error":"invalid_base64"}
/v1/mrz · HTTP 504
{"error":"processing_timeout","timed_out":true,"documents":[]}

Proxy errors may return a simple object such as {"error":"request_failed"}. An unknown URL can return HTTP 404 with text rather than JSON. Always check status and Content-Type before reading a success model. Handle new diagnostic codes defensively.

A reliable flow for your application.

  1. Check the HTTP response

    4xx: correct input or credentials. 503: honour Retry-After. 500/502/504: retry a limited number of times with a pause. Catch network failures and non-JSON responses separately.

  2. Check the processing outcome

    timed_out=false, intended candidate present, and documents[].status=recognized. Explicitly check candidate count and association. Do not import partial fields from negative outcomes.

  3. Validate warnings and fields

    Evaluate checks, corrections, raw readings and association evidence. Validate required fields, date assumptions, age and expiry against your business rules. Do not fill missing fields with guesses.

  4. Import or route to review

    Import only after your acceptance criteria are met. Route uncertain, ambiguous or incomplete results to a visible review process. Never declare documents authentic because check digits pass.

Decode image outputs from Base64 and validate JPEG format and dimensions before further processing. Create a display data URL only in your own UI. Log technical status/error codes rather than document images, full responses or API keys.

Formats and limits

AreaBehaviour
Enterprise API25 MiB decoded image bytes; 40 million pixels. One image per request.
Input formatsJPEG, PNG, WebP, HEIC and supported camera RAW files. RAW support depends on the format/camera model.
PDFDo not send to /v1/mrz. Provide a document page as an image first.
MRZ formatsTD1: 3 × 30 · TD2: 2 × 36 · TD3: 2 × 44
Prepared Enterprise API: response and retentionSynchronous JSON response. The current base recognition service processes images in memory and does not persist documents or results. The protected customer archive with 30-day retention included in paid offers is configured individually. The free demo does not provide download links to a customer archive. Store your own downloads only according to your intended workflow.

AI image enhancement is a separate extension on request. This interface has no standard parameter to activate “Enhance Output Image with AI”.

Public website demo

Consent and training storage in the demo

Selecting files or samples, dropping files or activating the camera starts transmission after the visible storage notice. The interface sends X-Training-Consent: training-v3; training-v1 and training-v2 remain accepted for older clients. The header identifies the notice version.

Original images and complete results are stored encrypted for 30 days from upload for training and quality improvement, then deleted automatically. You can request earlier deletion at info@oasisscan.de using your upload ID. This storage applies only to the public demo.

X-Training-Upload-ID provides the ID of an accepted storage record. An upload may already be stored even when recognition fails; do not automatically repeat it in that case. Cancelling or resetting does not delete stored data.

Demo-specific errors: 422 training_consent_required means the notice marker is missing or unsupported; 503 training_storage_unavailable means secure storage is temporarily unavailable. Processing does not silently continue without storage. 503 service_busy without an upload ID can be retried a limited number of times after Retry-After. Browser batch mode uses up to four concurrent single-image requests and shows a status and upload ID per file. See the privacy notice.