Menu

API integration

Scenario: fully headless

An SDK is not required: you can capture the images in your own UI and call the API. Your backend creates the session with X-Api-Key exactly as in the backend scenario and gives the device session_id + access_token; every step below uses that Bearer token.

Your responsibility as the integrator

  • Before any capture, show our consent text unchanged in the user's language (Get consent text) and record their acceptance (Record consent). You may not write your own consent text for the biometric processing.
  • Capture the document photos, and for liveness one frame at each server-chosen head movement plus a selfie.
  • Call these endpoints from the user's device (a native app), or from your own servers with their IPs registered (below). A web page cannot call them from the browser: CORS only allows our WebSDK; for a web flow use the WebSDK.
  • Show the rejection hint and let the user retry (3 retries per session).
  • NFC chip reading needs a phone: use our mobile SDKs for the NFC path.

Calling from your servers: registered server IPs

The per-IP daily limit and the device & IP analysis look at the IP of the first device call (access-keys, or liveness/start in a liveness-only session). Sent from your servers, all your users would share one IP and hit the daily limit. Register those IPs once:

  • Panel → Webhooks & keys → server IPs (your password and 2FA are asked). At most 5 single public IPv4/IPv6 addresses, no ranges.
  • From a registered IP: no per-IP daily limit, and no device & IP analysis (not charged; the device signals are null, which means not checked).
  • Still applies: 5 sessions/day per applicant_external_id, the per-token request rate (120/min per session) and our gateway's 3000 requests/min per IP. Above that you get 429.
  • Send X-Device-Id (16–128 characters, A–Z a–z 0–9 _ -, stable per device) if you have one: from a device that is not on the list it splits the per-IP limit per device (below).

Step by step

#CALLRESPONSENEXT
1GET /config200: modules, liveness_mode, document_optionsOffer the documents for the user's country
2GET /consent?lang=200: text, placeholders, version, policy_urlShow the text unchanged
3POST /consent200 {"consent": {…}}On the user's tap; until then evidence calls return 409 consent.required
4POST /access-keys200 {"status": "document_pending"}Can be sent again to change the choice until photos are uploaded
5POST /documents/images202 {"status": "document_processing"}Poll GET /result every 2 s
6GET /resultstatus: document_processing → liveness_pending · rejected · review · approvedrejected with retries_left > 0: POST /retry (→ document_pending), upload again
7POST /liveness/start200 {"challenge_id", "challenges": ["head_left", …], "expires_in_seconds": 300}In passive mode challenges is []: send only the selfie
8POST /liveness/submit202 {"status": "liveness_processing"}Poll GET /result
9GET /resultapproved · review · rejectedrejected with retries: POST /retry (→ liveness_pending), start liveness again

All paths start with /v1/sessions/{id}. /result returns the internal step for your screen, not the verification status: the decision still reaches your backend as a webhook. Stop polling after about 3 minutes and rely on the webhook.

# Python 3.10+   pip install requests — runs on the user's device in production (see above)
import time
import requests

API = "https://api.idotta.com"

def step(method, path, token, **kw):
    r = requests.request(method, API + path, headers={"Authorization": f"Bearer {token}"}, timeout=30, **kw)
    if r.status_code >= 400:
        raise RuntimeError(f"{method} {path} → {r.status_code} {r.text}")
    return r.json()

def wait(sid, token, busy):
    """Poll the result while the server is processing; returns the result once it leaves the busy steps."""
    deadline = time.time() + 180
    while time.time() < deadline:
        res = step("GET", f"/v1/sessions/{sid}/result", token)
        if res["status"] not in busy:
            return res
        time.sleep(2)
    raise TimeoutError("still processing: rely on the webhook")

def run(sid, token, front, back, frames_for, selfie):
    # 1) What to offer: modules, liveness mode, documents per country
    config = step("GET", f"/v1/sessions/{sid}/config", token)

    # 2) Consent: show our text unchanged in the user's language; record it when they tap the button it names
    consent = step("GET", f"/v1/sessions/{sid}/consent", token, params={"lang": "en"})
    # ... show consent["text"] with consent["placeholders"] filled in, {policy} linking to consent["policy_url"] ...
    step("POST", f"/v1/sessions/{sid}/consent", token,
         json={"text_version": consent["version"], "language": consent["language"]})

    # 3) Document details → {"status": "document_pending"}
    step("POST", f"/v1/sessions/{sid}/access-keys", token,
         json={"method": "manual", "document_type": "id_card", "document_country": "GHA"})

    while True:
        # 4) Photos → 202 {"status": "document_processing"}
        files = [("front", open(front, "rb"))] + ([("back", open(back, "rb"))] if back else [])
        step("POST", f"/v1/sessions/{sid}/documents/images", token, files=files)
        res = wait(sid, token, {"document_processing"})
        if res["status"] == "rejected" and res["retries_left"]:
            print("document rejected:", res["hint"])                # ask the user for a new photo
            step("POST", f"/v1/sessions/{sid}/retry", token)        # → document_pending
            continue
        break

    while res["status"] == "liveness_pending":
        # 5) Liveness: the server picks the head movements
        ch = step("POST", f"/v1/sessions/{sid}/liveness/start", token)
        files = [("frames", open(frames_for(c), "rb")) for c in ch["challenges"]]  # same order, one each
        files.append(("selfie", open(selfie, "rb")))
        step("POST", f"/v1/sessions/{sid}/liveness/submit", token,
             data={"challenge_id": ch["challenge_id"]}, files=files)  # → 202 {"status": "liveness_processing"}
        res = wait(sid, token, {"liveness_processing"})
        if res["status"] == "rejected" and res["retries_left"]:
            step("POST", f"/v1/sessions/{sid}/retry", token)        # → liveness_pending
            res = {"status": "liveness_pending"}

    # 6) approved · review · rejected — for your screen only; your backend decides from the webhook
    return res["status"]

The same with cURL

cURL
# 1) Config — what to offer
curl https://api.idotta.com/v1/sessions/$SID/config -H "Authorization: Bearer $TOKEN"

# 2) Consent: show the text unchanged, then record the user's acceptance
curl "https://api.idotta.com/v1/sessions/$SID/consent?lang=en" -H "Authorization: Bearer $TOKEN"
curl -X POST https://api.idotta.com/v1/sessions/$SID/consent \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"text_version":"2026-12-02","language":"en"}'

# 3) Document details
curl -X POST https://api.idotta.com/v1/sessions/$SID/access-keys \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"method":"manual","document_type":"id_card","document_country":"GHA"}'

# 4) Document photos (front + back for an ID card; a passport has no back)
curl -X POST https://api.idotta.com/v1/sessions/$SID/documents/images \
  -H "Authorization: Bearer $TOKEN" -F "front=@front.jpg" -F "back=@back.jpg"

# 5) Poll: liveness_pending = continue, rejected = see retries_left / hint
curl https://api.idotta.com/v1/sessions/$SID/result -H "Authorization: Bearer $TOKEN"

# 6) Liveness: the movements come from the server
curl -X POST https://api.idotta.com/v1/sessions/$SID/liveness/start -H "Authorization: Bearer $TOKEN"
curl -X POST https://api.idotta.com/v1/sessions/$SID/liveness/submit \
  -H "Authorization: Bearer $TOKEN" -F "challenge_id=..." \
  -F "frames=@head_left.jpg" -F "frames=@head_up.jpg" -F "frames=@head_right.jpg" \
  -F "selfie=@selfie.jpg"

# Retry after a rejection with retries left
curl -X POST https://api.idotta.com/v1/sessions/$SID/retry -H "Authorization: Bearer $TOKEN"
# → {"status":"document_pending","retry_type":"document","attempt":2}
  • method: manual (type and country only) or mrz (you also send the MRZ lines you read).
  • The token lives 15 min; your backend issues a new one with POST /v1/sessions/{id}/sdk-link if the user is slow.
  • frames follow the challenges order exactly, one each; the field is repeated (frames, not frames[]).
  • Our SDKs also call a few internal endpoints (MRZ page, NFC challenges, App Clip hand-off, in-flow contact codes). They are not part of the public contract.