Public API · Passport & ID card (eMRTD) · CodeB Wallet
Passport & ID card reading API.
Read the chip of a passport or ID card through CodeB Wallet with the server as the reading terminal, then open or confirm an account from a genuine document. This page lists every endpoint of emrtd-relay.ashx: the relay protocol, the pages, invitations, the account check, the self-service guest account and the admin endpoints.
Honest scope. Document check only: the chip is genuine and unchanged, read on an attested phone. There is no face comparison, so an account opened this way is a document-checked guest account, not a verified identity. Designed to follow ICAO Doc 9303 and ETSI TS 119 461; not certified. See also
Passport & ID chip check and
account opening.
How a reading works
- A session is created: by an admin (test or invitation), by the signed-in user (
account-check), by the sign-in page, or by CodeB Wallet itself (self-session). Each session has a link https://<host>/wallet/emrtd/session?id=<sid> that CodeB Wallet opens as an App Link.
- The wallet posts
op: info to /wallet/emrtd/relay.ashx and gets the session's challenge, who asks and why, and the data groups to read.
- The wallet posts
op: start with its Key Attestation chain (and a Play Integrity token when the server requires it) and the access key the person typed (CAN, or the MRZ fields). The attested key is bound to the session; every later request is signed with it (X-CodeB-Signature).
- The server is the terminal: it answers with
op: apdu commands, the wallet sends each one to the chip over NFC and posts the chip's answer back as op: response. The server runs PACE or BAC, chip or active authentication, and passive authentication of the security object against the CSCA master list and CRLs.
- The last answer is
op: done with the verdict genuine, not_verified or not_genuine and the reasons. Raw chip files are not kept; the evidence log keeps keyed hashes only.
Design target: ICAO Doc 9303 (reading) and ETSI TS 119 461 (identity-proofing evidence, extended level) — designed to follow, not certified. The CAN and the MRZ are never stored or logged.
Relay and pages
POST /wallet/emrtd/relay.ashx Open #
Relay protocol v1 between CodeB Wallet and the server's reading terminal. One endpoint for the whole reading. Every request is a JSON object with v: 1, op and session; every answer is HTTP 200 with a JSON object whose op says what comes next (info, apdu, aa_challenge, done, cancelled or error with code). The first start carries the phone's Key Attestation chain (and a Play Integrity token when the server requires it); its key is then bound to the session and every later request must carry X-CodeB-Signature made with it. Ops: info (challenge, requester, data groups), start (attestation, access key {type:'can',can} or {type:'mrz',documentNumber,dateOfBirth,dateOfExpiry}, app and card details), response (seq, rapdu base64url, ms), card_error (tag_lost), cancel, evidence (local reading fallback, only when the server allows it). Limits: 5 starts per session, 3 wrong access keys, per-IP rate limit, body cap. Rewritten to emrtd-relay.ashx?p=relay.
Parameters
X-CodeB-Signature (header) — Required on every request after the first attested start.
Request (application/json)
{
"v": 1,
"op": "info",
"session": "...",
"attestation": {},
"access": {},
"mode": "relay",
"seq": 0,
"rapdu": "...",
"error": "..."
}
Responses
200 — Next step of the protocol (always 200; errors as op=error with code such as session_unknown, session_expired, signature_invalid, attestation_failed, integrity_failed, wrong_key, protocol)
405 — Not POST
413 — Body too large
415 — Not application/json
429 — Rate limit
200 example
{
"op": "...",
"code": "...",
"message": "...",
"challenge": "...",
"apdu": "...",
"seq": 0,
"result": {
"verdict": "genuine",
"reasons": [
"..."
],
"mode": "..."
}
}
GET /wallet/emrtd/session Open #
App Link landing page of a reading session (shown when the wallet is not installed). HTML page (HTTP 200, no redirect) behind the App Link https://<host>/wallet/emrtd/session?id=<sid>; CodeB Wallet opens the link directly. noindex, strict CSP; the session id is not echoed.
Parameters
id (query, required) — string
Responses
GET /wallet/emrtd/status Open #
State of a sign-in reading, polled by the browser that started it. Only for sign-in readings and only from the browser that holds the session's codeb_emrtd cookie.
Parameters
sid (query, required) — string
Responses
200 — State
404 — Unknown session or wrong browser
200 example
{
"state": "waiting",
"code": "...",
"verdict": "..."
}
Guest account from CodeB Wallet (self-service)
Flow in the app
self-info (is it switched on?) → self-session → relay info / start / … / done → self-code (mail a 6-digit code to the address the person typed) → the person types the code → self-finish. The account is a document-checked guest account: genuine chip on an attested phone, confirmed e-mail address, one account per document and per phone; no face comparison, so it is not a verified identity. The PID and Photo ID offered afterwards are test credentials. Guests sign at most 100 documents per UTC day with the CodeB signing service (the site's administrator can change the number); signing as an invited person does not count. The guest can delete the account in the app at any time (self-delete).
Two answer shapes. Final answers of a reading are {"status","reason","message"} and fixed for that reading (a repeat returns the same answer). Answers the app can recover from are {"error","error_description"}.
GET /emrtd-relay.ashx?p=self-info Open #
Is opening an account in the app switched on?. The wallet hides 'Create a CodeB account' when self_service is false. Also in POST /rqes/csc/v2/info. 120 per minute per IP.
Responses
200 — Switch and limits
429 — Rate limit
200 example
{
"self_service": true,
"account_role": "guest",
"guest_signatures_per_day": 5,
"session_minutes": 15
}
POST /emrtd-relay.ashx?p=self-session Open #
Start a reading session for a new guest account. Creates a reading session of kind self (15 minutes; it ends after 5 minutes if no phone sent start). The device check runs in the relay start: Key Attestation, the wallet's issuance-key proof and, when the server has it configured, a Play Integrity verdict ok; otherwise the relay answers attestation_failed / integrity_failed and reads nothing. 10 per minute and 30 per hour per network.
Request (application/json)
{
"lang": "en"
}
Responses
200 — Session
400 — invalid_request
429 — rate_limited or daily_cap
503 — self_service_off or busy
200 example
{
"session": "...",
"relay_url": "https://phone.aloaha.com/...",
"session_url": "https://phone.aloaha.com/...",
"expires_in": 900
}
POST /emrtd-relay.ashx?p=self-code Open #
Mail a one-time code to confirm the e-mail address. After the reading ended (op: done) and within 15 minutes of self-session. Checks the reading and the limits first, so a final refusal can already come here. The 6-digit code is valid for 10 minutes and kept only in memory as an HMAC. At most 3 addresses or code mails per reading (an address already in use counts too; the 4th try ends the reading), at most 3 codes per address and hour.
Parameters
X-CodeB-Signature (header, required) — Signature over the raw request body made with the relay key the wallet bound in the relay start of this session (same scheme as on the relay requests).
Request (application/json)
{
"session": "...",
"email": "person@example.com"
}
Responses
200 — Code sent, or the reading's final answer
400 — invalid_email or invalid_request
403 — signature_invalid
404 — session_unknown
409 — email_in_use (counts as a try) or not_ready
410 — session_expired
429 — rate_limited (codes per address) or a final refusal (status refused)
503 — self_service_off or temporarily_unavailable
200 example
{
"status": "code_sent",
"email": "...",
"expires_in": 0,
"sends_left": 0,
"message": "..."
}
POST /emrtd-relay.ashx?p=self-finish Open #
Open the guest account with the confirmed address. Release rule self_service: genuine chip, document not expired and not expiring today, no account for this document, attested phone with issuance key, limits (one account per phone, 10 openings per network and hour, daily cap, 24 h after a delete on the same phone or document), code right for this address, address neither a login nor another account's e-mail. Five wrong codes per reading end it. The final answer is fixed per reading: repeats return it again and create or mail nothing. Accepted until 25 minutes after self-session.
Parameters
X-CodeB-Signature (header, required) — Signature over the raw request body made with the relay key the wallet bound in the relay start of this session (same scheme as on the relay requests).
Request (application/json)
{
"session": "...",
"email": "person@example.com",
"code": "..."
}
Responses
200 — created / exists / refused
400 — code_required, code_invalid (with attempts_left), code_expired, invalid_request
403 — signature_invalid
404 — session_unknown
409 — not_ready, or a final refusal email_in_use
410 — session_expired
429 — Final refusal: device_limit, recently_deleted, rate_limited, daily_cap, too_many_attempts
503 — self_service_off or temporarily_unavailable
200 example
{
"status": "created",
"reason": "document_has_account",
"message": "...",
"login": "...",
"released": true,
"offers": {
"pid": "https://phone.aloaha.com/...",
"photo_id": "https://phone.aloaha.com/..."
}
}
POST /emrtd-relay.ashx?p=self-delete Bearer #
The signed-in guest deletes the own account (GDPR Art. 17). Access token of the site's own sign-in (client codeb-admin), or CodeB Wallet's own token (client codeb-wallet-app) after a sign-in of the last 10 minutes; role guest only. Removes the account, photos, every document binding, open offers, the account's signing requests and signing key, revokes the PID / Photo ID test credentials already issued (status list) and revokes the access token used. Also removed: the account's approval keys, its AI agents with their open requests, its password-locked backups, the remote key store accounts that hold keys of its PID, and its list of linked wallets (the wallets themselves are not revoked). The answer is {"deleted":true,"credentials_revoked":true|false,"complete":true|false}; complete is false when a part could not be removed (it is then in the server log). The same phone and document can open a new account after 24 hours. 3 per minute per account.
Responses
200 — Deleted
401 — sign_in_required
403 — not_allowed (not a guest account); fresh_login_required (CodeB Wallet's token, sign-in older than 10 minutes)
404 — not_found
409 — not_deleted
429 — rate_limited
503 — temporarily_unavailable (nothing changed)
200 example
{
"deleted": true,
"credentials_revoked": true
}
Document data kept in the account
After a genuine reading that opens or confirms an account, the profile keeps the document read, newest reading per kind, under identity_documents.<passport|id_card|other> (written by the server only): every data element of the machine-readable zone (DG1: document code, issuing state, document number, names, nationality, birth date, sex, expiry date, optional data, check-digit result), the additional personal details (DG11: full name, other names, personal number, full birth date, place of birth, address, telephone, profession, title, personal summary, custody information, other travel documents) and the additional document details (DG12: issuing authority, date of issue, other persons, endorsements, tax or exit requirements, personalization time and device), plus verified: "chip", read_at and a keyed document_hash. Images the chip holds besides the face (DG11 proof of citizenship, DG12 front and rear of the document) are kept as non-public files. These fields are shown on the account page and in the administrators’ list; they are not part of the PID and not OIDC claims.
GET /emrtd-relay.ashx?p=document-image Bearer #
A document image read from the chip (proof of citizenship, front, rear) as JPEG. Images a passport or ID card chip may hold besides the face: DG11 proof of citizenship, DG12 image of the front and of the rear. They are kept with the account and listed in the profile under identity_documents.<passport|id_card|other>.<proof_of_citizenship_image|front_image|rear_image> = {id, type, bytes, sha256, view} ({stored: false} when the chip had one that could not be kept). Own account: Bearer of the signed-in user and id. Administrator: admin Bearer plus user. JPEG 2000 images are served converted to JPEG. Cache-Control no-store. 60 per minute per account. Not part of the PID or of OIDC claims.
Responses
200 — The image
400 — invalid request
401 — sign-in (or admin sign-in) required
404 — not found (or not this account's image)
405 — use GET
429 — rate_limited / slow_down
500 — server error
PID sign-in with a passport or ID card
Flow on the sign-in page
When a wallet asks for a PID, the sign-in page of the OpenID4VCI authorisation offers “Read your passport or ID card with CodeB Wallet” next to the normal sign-in (/vci.ashx?pid-read, ?pid-code, ?pid-verify, ?pid-continue; schemas in openapi.json). Signed out, the person first confirms the e-mail address of the new guest account with a 6-digit code, then reads the document.
Existing guest account: if the document already belongs to an enabled guest account, the page offers to continue with that account. The person enters its e-mail address; the page answers every address alike (“we sent a code”) and never tells whether an account exists. After the code is confirmed the flow continues only with that account and only with its own document, after a fresh reading. Any other account continues after the normal sign-in, and every refusal names a contact. Test credentials; not certified.
Invitations, account check and offers
POST /emrtd-relay.ashx?p=invite-info Open #
What an invitation link allows (label, expiry, readings left). Used by /wallet/emrtd/try. The invitation token travels in the body, never in a URL. 300 requests per minute per IP.
Request (application/json)
{
"i": "..."
}
Responses
200 — Invitation
404 — Unknown or used up
429 — Rate limit
200 example
{
"label": "...",
"expires": "2026-10-16T10:00:00Z",
"readings_left": 0,
"type": "try",
"account_created": true
}
POST /emrtd-relay.ashx?p=invite-new Open #
Start a reading session from an invitation.
Request (application/json)
{
"i": "..."
}
Responses
200 — Session
404 — Unknown invitation
409 — No readings left
429 — Rate limit
503 — Too many open readings
200 example
{
"sid": "...",
"view": "...",
"link": "https://phone.aloaha.com/...",
"expires": "2026-10-16T10:00:00Z",
"readings_left": 0
}
POST /emrtd-relay.ashx?p=invite-session Open #
Live state and result of an invitation reading. Polled by the invitee page every 2 s. Shows state, verdict, a preview of the chip data to the person who read it, and the outcome for the account (created, released, offers).
Request (application/json)
{
"sid": "...",
"view": "..."
}
Responses
200 — Session view
404 — Unknown session or wrong view token
200 example
{}
POST /emrtd-relay.ashx?p=account-check Bearer #
Start a passport / ID card check of the signed-in user's own account. Answers with the reading link the page opens on the phone. 5 per minute per account.
Request (application/json)
{
"expected_family_name": "..."
}
Responses
200 — Reading link
401 — Not signed in
429 — Rate limit
200 example
{}
GET /emrtd-relay.ashx?p=pid-offer Open #
Credential offer (authorization code) for the PID test credential. The link in the release mail. Contains no secrets: the wallet signs in to collect.
Responses
200 — OpenID4VCI credential offer
200 example
{
"credential_issuer": "https://phone.aloaha.com/...",
"credential_configuration_ids": [
"..."
],
"grants": {}
}
Admin endpoints
Bearer access token of an admin of this site (aud codeb-admin, with a scope; refresh and id tokens are refused).
POST /emrtd-relay.ashx?p=admin-new Bearer (admin) #
Admin: new test reading session (emrtd-test.html).
Request (application/json)
{
"forceLocalAa": true
}
Responses
200 — Session
401 — Admin sign-in required
409 — Local fallback switched off
413 — Body over 1 KB
503 — Too many open sessions
200 example
{
"sid": "...",
"link": "...",
"expires": "..."
}
GET /emrtd-relay.ashx?p=admin-session Bearer (admin) #
Admin: state, verdict, evidence summary and preview of a test session.
Parameters
sid (query, required) — string
Responses
200 — Session view
401 — Admin sign-in required
404 — Unknown or expired
200 example
{}
GET /emrtd-relay.ashx?p=admin-evidence Bearer (admin) #
Admin: latest evidence records, hash-chain check and configuration.
Responses
200 — Evidence summary
401 — Admin sign-in required
200 example
{}
GET /emrtd-relay.ashx?p=admin-failed-sod&id={id} Bearer (admin) #
Admin: what the chip sent in a reading that was not confirmed as genuine. A reading with the verdict not_verified or not_genuine keeps EF.SOD and the data groups read for 3 days, for investigation. The evidence record names it in document.failed_reading_kept (the id). The data groups contain personal data; the record is deleted after 3 days and never served without an admin sign-in.
Responses
200 — id, kept, delete_after, verdict, reasons, sod_b64, data_groups (base64 per data group)
401 — Admin sign-in required
404 — Unknown id or older than 3 days
GET /emrtd-relay.ashx?p=admin-invites Bearer (admin) #
Admin: list invitations.
Responses
200 — Invitations
401 — Admin sign-in required
200 example
{
"invites": [
{}
]
}
POST /emrtd-relay.ashx?p=admin-invite-new Bearer (admin) #
Admin: new invitation (try, account opening or account check). type try (chip check only), onboard (open an account; e-mail required) or verify (check an existing account; account and expected_family_name). Mails the link when an e-mail is given.
Request (application/json)
{
"type": "try",
"label": "...",
"days": 0,
"readings": 0,
"email": "person@example.com",
"account": "...",
"expected_family_name": "...",
"expected_birthdate": "..."
}
Responses
200 — Invitation with link
400 — Invalid
401 — Admin sign-in required
200 example
{}
POST /emrtd-relay.ashx?p=admin-invite-revoke Bearer (admin) #
Admin: withdraw an invitation.
Request (application/json)
{
"id": "..."
}
Responses
200 — Withdrawn
401 — Admin sign-in required
404 — Unknown
200 example
{}
GET /emrtd-relay.ashx?p=admin-proofing Bearer (admin) #
Admin: accounts waiting for an identity-proofing decision.
Responses
200 — List
401 — Admin sign-in required
200 example
{}
POST /emrtd-relay.ashx?p=admin-proofing-decide Bearer (admin) #
Admin: release or reject an account's document check. A release offers the PID and Photo ID test credentials to the wallet that read the document.
Request (application/json)
{
"user": "...",
"decision": "release",
"note": "..."
}
Responses
200 — Decided
400 — Invalid
401 — Admin sign-in required
404 — Unknown account
200 example
{}
Chip reading for a client’s website
A website that signs its users in through this site can ask this site to read and check the chip of a passport or ID card and receive a signed result. This site stays the relying party of the reading: CodeB Wallet forwards the chip commands, the server reads and checks. The reading opens no account and issues no credential. It must be switched on for the client by the site’s superuser (emrtd-rp-admin.html), and the client needs a browser origin in its OIDC client entry. First purpose: age_proof (proof of age for an accommodation).
POST /emrtd-rp.ashx?action=new
From the client’s page (CORS for the client’s origins, no credentials), as a form post: access_token (the signed-in person’s access token for this client), client_id, purpose, accommodation (the name shown on the phone, 2 to 60 characters, no website address), lang (en, de, it, fr, es, nl, pl or mt; any other value gives English), portrait (true to receive the chip photo; without it the photo is not read). Answer: {"sid","link","result_token","expires_in"}. Show link as a QR code or open it on the phone; it opens CodeB Wallet. Errors: 400 invalid_client or invalid_request, 401 invalid_token, 403 origin_not_allowed, client_not_allowed or purpose_not_allowed, 409 limit, 429 slow_down, 503 busy.
POST /emrtd-rp.ashx?action=result
Form post with sid and result_token; poll every few seconds. Answer: {"status"} = waiting, reading, done, failed (with code) or expired. With done the answer carries result exactly once; later calls answer "fetched": true. Keep the result yourself: the data read is dropped here as soon as it was handed out, at the latest after 30 minutes.
The signed result
A JWT (ES256, typ codeb-emrtd-result+jwt) with the certificate chain of this site’s relying-party certificate in x5c; the CA certificate is at /sign-request.ashx?ca. Claims: iss, aud (the client), iat, exp (10 minutes), jti, purpose, genuine, verdict, checks (issuer_signature, data_unchanged, chip_genuine, revocation, expired), read_at, holder_check, sid (the reading this result belongs to, as returned by new) and requester (the “who asks” line the phone showed). For a genuine reading also given_name, family_name, birthdate, issuing_country (the issuing state’s code as printed in the document, up to three letters, for example MLT, FRA, and D for Germany), document_type (passport or id_card) and, when asked for, portrait. Names are in the spelling of the machine-readable zone. A reading that is not genuine carries the checks only. The document number, the machine-readable zone and raw chip files are never part of the result.
holder_check is always none: nobody compares a face. The result shows that a genuine document with this date of birth was read at that time, not that a person present is its holder. Not certified.
What the phone shows
Before the reading CodeB Wallet shows who asks (“accommodation through client name (client website)”) and what for. Both texts are fixed on this server; a client supplies only the accommodation’s name.
Limits
Readings per signed-in person and day and per client and day (set by the superuser; start values 100 and 5,000), 120 readings per network and hour, 20 open readings per client. A reading no phone has started ends after 10 minutes, a started one after 15. After 30 minutes the reading is forgotten and result answers 404 not_found; stop polling then.
Frequently asked questions
How does CodeB check a passport or ID card?
CodeB Wallet only forwards the chip commands over NFC; the CodeB server is the reading terminal. It runs PACE or BAC with the CAN or MRZ the person typed, chip or active authentication, and passive authentication of the document security object against the CSCA master list and the CRLs, and returns genuine, not_verified or not_genuine.
Are the CAN, MRZ or chip data stored?
No. The CAN and MRZ are never stored or logged. Raw chip files are not kept after the reading; the evidence log contains keyed hashes only. Account data (names, date of birth, chip photo) is kept only when the reading opens or confirms an account.
Can a new user open an account from the app?
Yes, as a document-checked guest account: CodeB Wallet reads a genuine passport or ID card on an attested phone, the e-mail address is confirmed with a mailed 6-digit code, and the account opens with the PID and Photo ID test credentials offered to that wallet. One account per document and per phone; no face comparison.
Is this certified?
No. The reading follows ICAO Doc 9303 and the evidence is designed to follow ETSI TS 119 461 (extended level of identity proofing); nothing is certified. PID and Photo ID are test credentials.
How does a guest delete the account?
With POST /emrtd-relay.ashx?p=self-delete and the access token of the site's sign-in. It removes the account, photos, document bindings, open offers, signing requests and the signing key, the approval keys, AI agents, password-locked backups, remote key store keys and the list of linked wallets, revokes the credentials already issued, and revokes the token used.
Which passport or ID card data does the account keep?
Every data element of the machine-readable zone (DG1), the additional personal details (DG11) and the additional document details (DG12), each in its own field under identity_documents, plus the images the chip holds besides the face (proof of citizenship, front and rear of the document) as non-public files. Only the account holder and administrators can see them; they are not part of the PID or OIDC claims. The CAN, the MRZ typed in and raw chip files are not stored.