SPB Git

Repository Public

API_REFERENCE.md 32.2 KB

# MacLustr Identity — API reference

API version 2026-12-01, service version 1.0.0. This document is built from the OpenAPI description served by the application (services/mlid/app.py) and from the code. Where the two differ, the code is the reference.

  • Base URL: https://identity.spboucher.ai/v1 (an alias exists under /api/v1).
  • OpenAPI 3.1 description: GET /api/v1/openapi.json (public, no authentication). Request and response bodies are free-form objects in that description; the shapes below come from the code.
  • Rendered reference: https://identity.spboucher.ai/docs.
  • Official SDKs: SDK_WEB.md, SDK_PYTHON.md, SDK_IOS.md, SDK_ANDROID.md. Integration guide: ../integrations/README.md.

Production status on 2026-12-01: live mode is locked by the compliance gates. Every mlid_sk_live_… call that creates a session returns 403 compliance_gate_closed. Only sandbox works.

# Conventions

  • JSON in, JSON out, UTF-8. Uploads use multipart/form-data.
  • Successful calls return 200.
  • Every response carries a Request-Id header (req_…), including the early 403, 411 and 413 answers described under "Request size". API responses carry Cache-Control: no-store.
  • In production the API only accepts connections coming through the public gateway. A direct connection from another network path is answered 403 forbidden_network.
  • Timestamps are ISO 8601 with offset, except created in webhook events (Unix seconds).
  • Identifiers are prefixed: vs_ session, ver_ verification, we_ webhook endpoint, evt_ event, whd_ delivery, key_ API key, app_ application, chl_ challenge, dsp_ dispute.

# Authentication

Two kinds of credentials, never interchangeable.

Credential Format Used by Endpoints
Secret API key mlid_sk_test_… (sandbox), mlid_sk_live_… (live) Your server only /v1/verification-sessions, /v1/verifications, /v1/webhooks
Session client secret vsc_… The person's browser or native app, for one session /v1/sessions/{id}/…

Both are sent as Authorization: Bearer <credential>.

A secret key belongs to one application and one mode. Keys are stored hashed (SHA-256); the secret is shown once at creation. A key may have an expiry date and may be revoked or rolled from the console; rolling keeps the old key valid for a grace period (24 hours by default, 0 to 168).

# Scopes

Scope Allows
sessions:write Create and cancel verification sessions
sessions:read Retrieve and list verification sessions
verifications:read Retrieve and list verifications, read their status
verifications:write Revoke a verification, destroy its personal data
webhooks:manage Create, list, delete webhook endpoints, rotate their secret

A key created without an explicit list receives all five. A call outside the key's scopes returns 403 insufficient_scope.

# Isolation

Every object belongs to one application and one mode. A key never sees objects of another application or of the other mode: such a request returns 404 resource_missing.

This also holds for webhook management: a sandbox key cannot delete or rotate a live endpoint of the same application, and the reverse (404).

# Errors

json
{
  "error": {
    "type": "invalid_request_error",
    "code": "purpose_required",
    "message": "purpose is required (the reason for this verification, 120 characters at most).",
    "param": "purpose",
    "request_id": "req_0f3k…"
  }
}

param is present when the error concerns one field. Branch on code, never on message.

HTTP type
400, 411, 413, 422 invalid_request_error
401 authentication_error
403 permission_error
404 not_found_error
409 conflict_error
429, code rate_limited rate_limit_error, with a Retry-After header: retry after that delay
429, any other code quota_error: a usage ceiling (per day or per session) was reached; retrying sooner is useless
503 service_unavailable_error, with Retry-After: 5
500 and others api_error

Retry guidance: retry 429 rate_limited, 503 and 409 idempotency_in_progress after the Retry-After delay, with the same Idempotency-Key. Do not retry a quota_error automatically. The official SDKs follow these rules.

# Error codes

General:

Code HTTP Meaning
invalid_request 400 Malformed request or missing required field
missing_api_key 401 No Authorization: Bearer header
invalid_api_key 401 Unknown, expired or revoked key
insufficient_scope 403 The key lacks the required scope
resource_missing 404 No such object for this application and mode
not_found 404 Unknown endpoint
method_not_allowed 405 Wrong HTTP method
rate_limited 429 Too many requests; see Retry-After
forbidden_network 403 The connection did not come through the public gateway
length_required 411 Request body sent without a Content-Length (chunked transfer)
payload_too_large 413 Declared body size above the limit for this endpoint; the body is not read
service_unavailable 503 The database is saturated or unreachable; retry after Retry-After
internal_error 500 Unexpected failure; no detail is returned
invalid_idempotency_key 400 Idempotency-Key longer than 200 characters
idempotency_key_reused 409 Same key, different request body
idempotency_in_progress 409 The first request with this key has not finished (Retry-After: 1)
invalid_cursor 400 starting_after does not reference an existing object

Verification sessions:

Code HTTP Meaning
purpose_required 400 purpose missing or longer than 120 characters
unknown_policy 400 Unknown verification_policy
invalid_return_url 400 return_url malformed, too long, or not https
return_url_not_allowed 400 return_url not in the application's allowed redirect URLs
invalid_external_user_id 400 Not a string, or longer than 200 characters
invalid_metadata 400 Not an object, or larger than 2000 bytes once serialised
application_suspended 403 The application is suspended
compliance_gate_closed 403 Live mode is not enabled (gate live_document closed)
no_method_available 403 No method of the policy is enabled for this application and mode
daily_session_limit 429 Daily session limit of the application reached (quota_error, Retry-After: 3600)
session_not_cancellable 409 The session is final, or in manual review (the application cannot cancel during review; the person can still withdraw consent)
not_revocable 409 Only a verified verification can be revoked

Session flow:

Code HTTP Meaning
missing_client_secret 401 No Authorization: Bearer vsc_… header
invalid_client_secret 401 Unknown session or wrong secret
invalid_session_state 409 The step is not available in the current status
method_not_available 400 Method not offered by this session
consent_required 400 accepted is not true, or text_version is not the current one
biometric_consent_required 400 biometric_consent is not true for a biometric method
sandbox_no_real_documents 403 Upload attempted on a sandbox session
sandbox_only 403 Scenario requested on a live session
unknown_scenario 400 Unknown sandbox scenario
invalid_side 400 side is not front or back
file_too_large 413 Document over 12 MB, or a selfie frame over 3 MB
unsupported_file_type 400 Not a JPEG, PNG or WebP image, or an animated image
invalid_image 400 The file could not be decoded
image_too_small 400 Short side under 480 px (document) or 320 px (selfie frame)
too_many_uploads 429 More than 30 document uploads in an hour for this session (quota_error, Retry-After: 3600)
selfie_not_required 409 The chosen method does not use a selfie
too_many_challenges 429 More than 8 challenges requested for this session (quota_error)
invalid_challenge 409 Unknown or already used challenge
challenge_expired 409 Challenge older than 120 seconds
invalid_frame_count 400 Frame count outside the permitted range
document_missing 409 Submit without the front of the document
selfie_missing 409 Submit without the selfie for a biometric method
invalid_message 400 Dispute message outside 5 to 2000 characters
no_decision 409 Dispute before any decision
dispute_exists 409 A dispute is already open

Webhooks:

Code HTTP Meaning
url_required 400 url missing
invalid_webhook_url 400 Not https, contains credentials, does not resolve, or resolves to a private or local address
invalid_event_type 400 Unknown event type
too_many_endpoints 400 More than 16 endpoints for this application and mode

# Idempotency

Send an Idempotency-Key header (200 characters at most) on these calls:

  • POST /v1/verification-sessions
  • POST /v1/verification-sessions/{id}/cancel
  • POST /v1/verifications/{id}/revoke
  • DELETE /v1/verifications/{id}/personal-data
  • POST /v1/webhooks
  • DELETE /v1/webhooks/{id}
  • POST /v1/webhooks/{id}/rotate-secret

Behaviour:

  • Same key and same body: the stored response is returned with the header Idempotent-Replayed: true.
  • Same key and a different body, or the same key on a different operation: 409 idempotency_key_reused.
  • Same key while the first request is still running: 409 idempotency_in_progress, with Retry-After: 1.
  • If the first request fails, the key is released and may be reused.
  • Keys are scoped to the application and the mode and are kept 24 hours. The stored response is encrypted at rest, because it may contain a session client secret or a webhook secret.

Without the header, a repeated POST /v1/verification-sessions creates a second session.

# Pagination

List endpoints return the newest objects first.

Parameter Meaning
limit 1 to 100, default 20
starting_after Identifier of the last object of the previous page
json
{ "object": "list", "data": [ … ], "has_more": true }

GET /v1/webhooks returns every endpoint at once (has_more is always false).

# Rate limits

Limit Value Scope Result when exceeded
Authenticated calls 1200 per minute Client IP address 429 rate_limited
Calls with an invalid key 30 per minute Client IP address 429 rate_limited
Calls per API key 600 per minute (application setting rate_per_min) Key 429 rate_limited
Session flow calls 900 per minute (MLID_FLOW_IP_RATE) Client IP address 429 rate_limited
Session flow calls 120 per minute Session 429 rate_limited
Sessions created 5000 per day (application setting sessions_per_day) Application and mode 429 daily_session_limit (quota_error)
Sessions for one external_user_id 5 per day (sessions_per_user_per_day) Application and user Not blocked: recorded as a technical-risk signal
Sessions started from one person's IP address 10 per day Application and address, counted at the first consent Not blocked: recorded as a technical-risk signal
Document uploads 30 per hour Session 429 too_many_uploads (quota_error)
Liveness challenges 8 Session 429 too_many_challenges (quota_error)

All limits are stored in the database and shared by every API process: the stated value is the real ceiling. The per-minute limits use fixed one-minute windows, so a burst straddling two windows can reach twice the value; Retry-After gives the number of seconds until the current window ends.

# Request size

The declared size of a request body is checked before the body is read.

Endpoint Maximum body
POST /v1/sessions/{id}/document 12 MB for the file, plus 512 KB for the multipart envelope
POST /v1/sessions/{id}/selfie 24 frames of 3 MB, plus 512 KB
Any other POST, PUT or PATCH 256 KB

A larger body is answered 413 payload_too_large and the connection is closed. A body sent with Transfer-Encoding and no Content-Length is answered 411 length_required.

# Sandbox and live mode

Sandbox (mlid_sk_test_…) Live (mlid_sk_live_…)
Documents and selfies Never accepted (sandbox_no_real_documents) Uploaded by the person
Result Chosen scenario, flagged simulated: true Computed by the engines
Assurance level when verified sandbox_simulated See below
Compliance gates Not required live_document must be open; biometric methods also need live_biometric
Webhooks Delivered to sandbox endpoints only Delivered to live endpoints only

Sandbox scenarios (POST /v1/sessions/{id}/sandbox):

scenario Resulting status Reasons
verified verified simulated
manual_review manual_review simulated, authenticity_indicators
inconclusive inconclusive simulated, capture_quality_insufficient
rejected rejected simulated, document_expired

A sandbox result must never unlock anything in a production system: check livemode and simulated.

# Objects

# Verification session

json
{
  "id": "vs_…",
  "object": "verification_session",
  "status": "created",
  "livemode": false,
  "external_user_id": "user_42",
  "purpose": "Publish listings",
  "verification_policy": "identity_document_face_v1",
  "policy_version": "1.0",
  "locale": "fr-CA",
  "return_url": "https://app.example/verify/return",
  "method": null,
  "metadata": {},
  "verification_id": null,
  "created_at": "2026-12-01T14:00:00+00:00",
  "expires_at": "2026-12-01T15:00:00+00:00",
  "completed_at": null
}

Statuses:

Status Meaning
created Waiting for the person to choose a method and consent
awaiting_document Consent recorded; waiting for the document
awaiting_selfie Front of the document received; waiting for the selfie (biometric method)
processing Submitted; analysis in progress
manual_review A person must review the case
verified, inconclusive, rejected Decision made
expired Not completed before expires_at
cancelled Cancelled by the application, or consent withdrawn by the person
revoked The verification was revoked after being verified

# Verification

json
{
  "verification_id": "ver_…",
  "object": "verification",
  "session_id": "vs_…",
  "status": "verified",
  "assurance_level": "document_check",
  "method": "document_only",
  "verification_policy": "identity_document_v1",
  "policy_version": "1.0",
  "livemode": true,
  "simulated": false,
  "external_user_id": "user_42",
  "reasons": [],
  "dimensions": {
    "document_quality": { "status": "pass" },
    "document_consistency": { "status": "pass" },
    "authenticity_indicators": { "status": "pass" },
    "face_match": { "status": "not_applicable" },
    "liveness": { "status": "not_applicable" },
    "session_integrity": { "status": "pass" },
    "technical_risk": { "status": "pass" }
  },
  "decision_engine": "risk-1.0",
  "created_at": "…",
  "verified_at": "…",
  "expires_at": "…",
  "revoked_at": null,
  "personal_data_deleted_at": null
}
  • status: verified, inconclusive, rejected, manual_review, revoked.
  • assurance_level (only when verified): document_check, document_face_liveness_check, document_manual_review, document_face_manual_review, sandbox_simulated.
  • dimensions[*].status: pass, review, fail, not_assessed, not_applicable. Scores are never returned.
  • expires_at: a verification is valid for the policy's validity_days (365 by default).
  • The object never contains a name, a document number, a date of birth, an image or any biometric data.

Reason objects are { "code": "…", "message": { "fr": "…", "en": "…" } }. Codes:

document_type_not_permitted, unknown_document_type, document_type_not_accepted, capture_quality_insufficient, machine_zone_unreadable, document_expired, document_inconsistent, authenticity_indicators, face_not_usable, face_uncertain, face_mismatch, liveness_uncertain, liveness_failed, accessible_path, human_review_method, technical_risk, face_thresholds_not_calibrated, decision_overturned, review_not_completed, engine_unavailable, simulated, reviewer_decision.

Treat the list as open: new codes may be added. Two of them describe a decision that changed after the fact:

  • review_not_completed: the case was sent to a reviewer and was not handled before its deadline (72 hours by default). The images are destroyed, the verification becomes inconclusive, and the person may start again with a new session.
  • decision_overturned: the person contested a rejected or inconclusive decision and a reviewer set it aside. The verification becomes (or stays) inconclusive, a verification.inconclusive event is emitted, and the person may verify again with a new session. A contested decision is never turned into verified.

# Server-to-server endpoints

# Create a verification session

POST /v1/verification-sessions — scope sessions:write.

Field Type Required Notes
purpose string yes Shown to the person; 120 characters at most
verification_policy string no Default identity_document_face_v1. Built-in: identity_document_v1 (document only), identity_document_face_v1 (document and selfie, or document reviewed by a person)
external_user_id string no Your opaque identifier, 200 characters at most. Never an e-mail address, a name or a phone number
return_url string no In live mode it must match an allowed redirect URL of the application (exact match, or that URL followed by / or ?). In sandbox, the same rule applies when the application has allowed redirect URLs; otherwise any https URL, http://localhost or http://127.0.0.1 is accepted
locale string no Default fr-CA. A value starting with en selects English
metadata object no 2000 bytes at most once serialised. Do not put personal information in it
expires_in_minutes integer no 10 to 1440, default 60
bash
curl https://identity.spboucher.ai/v1/verification-sessions \
  -H "Authorization: Bearer $MLID_SECRET_KEY" \
  -H "Idempotency-Key: 5c1f0d3e-publish-user-42" \
  -H "Content-Type: application/json" \
  -d '{"purpose": "Publish listings", "external_user_id": "user_42", "return_url": "https://app.example/verify/return"}'

The response is the session object plus two fields returned only here:

Field Use
client_secret vsc_…, for the session flow
url Hosted page: https://identity.spboucher.ai/verify/{id}#{client_secret}. Send it to that user's browser

The secret is in the URL fragment, which browsers do not send to the server when loading the page.

# Retrieve, list, cancel

Call Scope Notes
GET /v1/verification-sessions/{id} sessions:read
GET /v1/verification-sessions sessions:read Filters: status, external_user_id; pagination
POST /v1/verification-sessions/{id}/cancel sessions:write Destroys every uploaded image, fails any queued analysis, emits verification.cancelled. Refused (409 session_not_cancellable) once the session is final or in manual review

# Verifications

Call Scope Notes
GET /v1/verifications/{id} verifications:read
GET /v1/verifications verifications:read Filters: status, external_user_id; pagination. Use external_user_id to know whether a user is verified
GET /v1/verifications/{id}/status verifications:read Minimal answer, see below
POST /v1/verifications/{id}/revoke verifications:write Body { "reason": "…" } (optional, 200 characters kept). Only from verified; revoking twice returns the same object
DELETE /v1/verifications/{id}/personal-data verifications:write Destroys the images, the extracted fields and the dispute message that still exist. The minimal result remains. Accepts Idempotency-Key

Status answer:

json
{ "verification_id": "ver_…", "status": "verified", "valid": true, "assurance_level": "document_check", "expires_at": "…" }

valid is true only when the status is verified and expires_at is in the future. Gate sensitive actions on valid, and treat any error or timeout as not verified.

Deletion answer:

json
{ "verification_id": "ver_…", "deleted": true, "artifacts_destroyed": 0, "extracted_destroyed": 0 }

If the verification was in manual review, the open review case is closed, the verification becomes inconclusive and its session cancelled. A verification.inconclusive event is emitted for that change.

# Webhook endpoints

Call Notes
POST /v1/webhooks Body { "url": "https://…", "events": ["*"], "description": "…" }. Returns the endpoint and its secret (whsec_…), shown once
GET /v1/webhooks Endpoints of the key's application and mode
DELETE /v1/webhooks/{id} Accepts Idempotency-Key. Returns { "id": "we_…", "deleted": true }
POST /v1/webhooks/{id}/rotate-secret Returns the new secret. For 24 hours each delivery is signed with both secrets

All require the scope webhooks:manage and act only on endpoints of the key's own mode. The URL must be https and resolve to a public address. At most 16 endpoints per application and mode.

Endpoint object:

json
{ "id": "we_…", "object": "webhook_endpoint", "url": "https://app.example/webhooks/identity", "events": ["*"], "status": "enabled", "livemode": false, "description": "", "created_at": "…" }

# Session flow endpoints

Used by the hosted page and by the native SDKs, authenticated with the session client secret. An application integrating through the hosted page never calls them. They are the same in sandbox and live mode, except where stated.

Call Purpose
GET /v1/sessions/{id} Flow state
POST /v1/sessions/{id}/consent Choose a method and consent
POST /v1/sessions/{id}/document Upload one side of the document (live only)
POST /v1/sessions/{id}/selfie/challenge Get a liveness challenge (live only)
POST /v1/sessions/{id}/selfie Upload the selfie frames (live only)
POST /v1/sessions/{id}/submit Submit for analysis (live only)
POST /v1/sessions/{id}/sandbox Complete with a simulated scenario (sandbox only)
POST /v1/sessions/{id}/withdraw Withdraw consent; everything is destroyed
POST /v1/sessions/{id}/dispute Contest a decision

# Flow state

GET /v1/sessions/{id} returns:

Field Content
id, status, livemode, locale, purpose, return_url, method, expires_at Session fields
application name, logo_url, accent (branding set by the application)
methods Each offered method: id, biometric, label, and consent texts in fr and en (version, title, body, checkbox, points, controller). The points state the application's actual retention settings
controller Name, contact and privacy page of the service operator
sandbox null in live mode; otherwise the list of scenarios
uploaded, selfie_done What has been received
attempts_left, max_attempts Remaining and total submissions
last_issue Reasons of the last capture that had to be retaken
document front: "required", back: "required_for_cards", accepted (document template identifiers accepted by the policy: passport_td3, id_card_td1, ca_driver_licence), back_required_for (the subset of accepted that needs the back side, with the same identifiers)
result Present after a decision: status, reasons, verified_at. Absent once the session is cancelled
json
{ "method": "document_selfie", "accepted": true, "text_version": "2026-12-01.2", "biometric_consent": true, "locale": "fr-CA" }
  • text_version must equal the version of the consent text that was displayed. Read it from the flow state; never hard-code it. The current value is also exposed as consent_version by GET /health.
  • biometric_consent: true is mandatory for document_selfie.
  • The method can be changed until submission: images already uploaded are destroyed and the previous consent is marked withdrawn.

# Document

multipart/form-data with side (front or back) and file (JPEG, PNG or WebP, 12 MB at most).

json
{ "accepted": true, "side": "front", "issues": [], "status": "awaiting_selfie" }

A capture of insufficient quality is answered with 200 and accepted: false; nothing is stored. Issues: resolution_too_low, image_blurry, image_too_dark, image_overexposed, low_contrast. Uploading a side again replaces the previous image.

Send the photograph at full resolution, not a frame of the video preview: the short side must be at least 600 px to be accepted, and a dense PDF417 barcode on a driver's licence needs much more to be read (the hosted page and the native SDKs warn under 1000 px). Images are scaled down to 3600 px on their long side.

# Liveness challenge and selfie

POST /v1/sessions/{id}/selfie/challenge with {} or { "accessible": true }:

json
{ "challenge_id": "chl_…", "steps": ["turn_left", "turn_right"], "accessible": false, "expires_in": 120, "frames": { "min": 8, "max": 24, "interval_ms": 250 } }
  • A challenge is single-use and expires after 120 seconds.
  • The accessible path has no step, needs 3 to 24 frames, and always leads to review by a person.

POST /v1/sessions/{id}/selfie is multipart/form-data with challenge_id and frames repeated (8 to 24 images in capture order, 3 MB each at most, short side of 320 px or more). Answer: { "accepted": true, "frames": 12 }.

# Submit, withdraw, dispute

  • POST …/submit moves the session to processing and returns the flow state. Poll GET /v1/sessions/{id} until result appears. When the capture must be retaken, the session returns to awaiting_document with last_issue filled.
  • POST …/withdraw returns { "id": "vs_…", "status": "cancelled", "destroyed": true }. It is allowed until a decision is made, including while the session is in manual review: the review case is then closed without a decision, the images and extracted fields are destroyed, the verification becomes inconclusive, and two events are emitted, verification.inconclusive (verification object) and verification.cancelled (session object). It is refused (409 session_not_cancellable) once the session is final.
  • POST …/dispute with { "message": "…" } (5 to 2000 characters) returns { "id": "dsp_…", "status": "open" }. The message is stored encrypted and destroyed when a reviewer closes the dispute. The reviewer either maintains the decision or sets it aside (see decision_overturned).

# Webhooks

# Event

json
{
  "id": "evt_…",
  "object": "event",
  "type": "verification.verified",
  "api_version": "2026-12-01",
  "created": 1796133600,
  "livemode": false,
  "data": { "object": { "verification_id": "ver_…", "object": "verification", "status": "verified", "…": "…" } }
}

# Event types

Type data.object Emitted when
verification.created session A session is created
verification.processing session The session is submitted
verification.completed verification Any decision other than manual review is recorded
verification.verified verification Decision verified (automatic or by a reviewer)
verification.inconclusive verification Decision inconclusive, including an engine failure, a review case that reached its deadline, a contested decision set aside, and a withdrawal or a personal-data deletion during manual review
verification.rejected verification Decision rejected
verification.manual_review verification The case is sent to a reviewer
verification.expired session The session expired before submission
verification.cancelled session Cancelled by the application, or consent withdrawn (including during manual review)
verification.revoked verification A verification is revoked

A final decision therefore produces two events: verification.completed and the event of its status. The verification.inconclusive events caused by a withdrawal, a deletion or a set-aside decision come alone, without verification.completed. Subscribe with a list of types or ["*"], and ignore types you do not know.

Events are kept 90 days on the service side.

# Delivery

  • POST to your URL with the JSON body, Content-Type: application/json, User-Agent: MacLustr-Identity-Webhooks/1.0.
  • Headers: MLID-Event-Id, MLID-Delivery-Id, MLID-Event-Type, MLID-Signature.
  • Success is any 2xx answer within 10 seconds (5 seconds to connect). Redirects are not followed.
  • On failure, the delivery is retried after 30 s, 2 min, 10 min, 30 min, 2 h, 6 h, 12 h and 24 h (nine attempts in all), then marked failed. An operator can retry it from the console.
  • Delivery is at-least-once and unordered: deduplicate on the event id, and do not let an older event overwrite a newer state.
  • The destination is checked again before each delivery; a URL that now resolves to a private or local address is not called.

# Signature

text
MLID-Signature: t=1796133600,v1=5257a8…[,v1=…]
  • t: Unix time of the delivery attempt.
  • v1: hexadecimal HMAC-SHA-256 of the bytes "{t}." + raw request body, keyed with the endpoint secret (the whole whsec_… string, UTF-8).
  • During the 24 hours after a secret rotation there are two v1 values, one per secret. Accept the delivery if any v1 matches.
  • Reject a delivery whose t is more than 300 seconds away from your clock.

Always compute the signature on the raw body, before any JSON parsing, and compare in constant time. The SDKs implement this (constructEvent); the samples below show the scheme without them.

Python:

python
import hashlib, hmac, time

def verify(secret: str, header: str, raw_body: bytes, tolerance_s: int = 300) -> bool:
    try:
        parts = [p.split("=", 1) for p in header.split(",") if "=" in p]
        ts = int(next(v for k, v in parts if k == "t"))
    except (StopIteration, ValueError):
        return False
    if abs(time.time() - ts) > tolerance_s:
        return False
    expected = hmac.new(secret.encode(), f"{ts}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return any(hmac.compare_digest(expected, v) for k, v in parts if k == "v1")

Node.js:

js
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(secret, header, rawBody, toleranceSec = 300) {
  const parts = String(header || "").split(",").map((p) => p.split(/=(.*)/s).slice(0, 2));
  const ts = Number((parts.find(([k]) => k === "t") || [])[1]);
  if (!Number.isInteger(ts) || Math.abs(Date.now() / 1000 - ts) > toleranceSec) return false;
  const expected = createHmac("sha256", secret).update(`${ts}.`).update(rawBody).digest();
  return parts.some(([k, v]) => {
    if (k !== "v1") return false;
    const got = Buffer.from(v || "", "hex");
    return got.length === expected.length && timingSafeEqual(got, expected);
  });
}

rawBody is a Buffer holding the request body exactly as received.

# Health

Call Answer
GET /health { "status": "ok", "service": "maclustr-identity", "version": "1.0.0", "consent_version": "2026-12-01.2" }
GET /health/ready status, environment, workers_online, jobs_queued, live_document, live_biometric; 503 when the database is unreachable

Both are public. /health/ready therefore discloses whether live mode is open and how many workers are online.

# Not in this API

  • No endpoint returns extracted document fields, images or scores to an application.
  • No endpoint lists events; events are available through webhooks only.
  • There is no CORS support: the API is meant to be called from servers, and the session flow from the hosted page or the native SDKs.
  • The console API (/api/console/…) is for the operator interface and is not a public contract.
Files main
Menu

Theme