Skip to content
Platform

API reference

The shared model behind every SDK — sessions and modes, webhooks, configuration, and the full set of statuses, decisions and error codes.

Sessions & modes

A session is one run of a workflow for one user. There are two ways to start one:

Create mode

The client configures the SDK with a public key, workflowExternalId and clientData. The SDK mints the session. Fastest to integrate.

Token mode

Your server mints a session and returns a sat to the client. No keys ever reach the device. Recommended for production.

token mode
// On YOUR server — never expose the secret to the client.
// 1. Create a session with your private credentials.
// 2. Return the session access token (sat) to your app.

// In the client SDK, start in token mode:
new OthentoSDK({
  mode: 'token',
  sat: '<session-access-token-from-your-server>',
  onCompleted: ({ decision }) => console.log(decision),
}).start();

Webhooks

When a session reaches a terminal decision, Othento can notify your backend at the callbackUrl you provide. Use callbackReceiver to choose which party is notified (Initiator, Completer or Both). Correlate the notification to your user with the session externalId (saved from onSessionCreated) and the clientData and metadata you passed in. Always treat the webhook — not the client callback — as the source of truth for granting access.

Session configuration

The same options across every SDK. Three fields are required to create a session.

OptionTypeDescription
mode'create' | 'token'Required. Create a new session (create) or resume a server-minted one (token).
apiKeystring · createPublic key. pk_sandbox_… for testing, pk_live_… for production.
workflowExternalIdstring · createThe verification workflow this session runs.
clientDatastring · createYour end-user identifier; echoed on events and webhooks.
satstring · tokenServer-minted session access token; keeps API keys off the client.
expectedDetailsobject · optionalPre-filled identity hints cross-checked against extracted data.
callbackUrlstring · optionalWebhook / redirect URL for terminal session notifications.
callbackReceiver'Initiator' | 'Completer' | 'Both'Which party receives the callback. Optional.
metadatastring · optionalFree-form string round-tripped on session events and webhooks.

Web only: container (inline mode), showCloseButton, closeOnBackdropClick, loadTimeoutMs, initTimeoutMs. Mobile only: closeOnComplete, loggingEnabled (Android).

expectedDetails

Optional identity hints, cross-checked against extracted document data. Send only what you have.

firstName / lastNamestringGiven and family name.
dateOfBirthstringISO-8601, e.g. 1990-04-23.
genderstringExpected gender.
nationality / countrystringExpected nationality and country.
addressstringExpected address.
documentNumberstringExpected document number.
ipAddressstringEnd-user IP address.

Session statuses

Streamed through the status callback as the session progresses.

CreatedSession minted, not yet started.
InProgressThe user is actively verifying.
ProcessingEvidence uploaded; backend is deciding.
CompletedTerminal — a decision is available.
ExpiredSession passed its validity window.
FailedSession ended in a non-recoverable failure.

Decisions

The terminal outcome, returned by onCompleted.

Approved

Identity verified and approved.

Declined

Verification failed or was rejected.

InReview

Pending manual review.

Cancellation reasons

Returned by onCancelled — useful for adaptive retry UX and analytics.

close-buttonUser tapped the built-in close control.
backdrop / escWeb modal: backdrop click or Escape key.
page-hideWeb: the host page was unloaded.
swipe-dismissiOS: the sheet was pulled down to dismiss.
back-buttonAndroid: system back navigation.
host-destroyYour app called destroy() before a decision.

Error codes

Every error exposes a typed code you can switch on. When code is upload_failed, error.stage pinpoints the step.

missing_api_keyRequired apiKey not provided (thrown at construction).
missing_workflowRequired workflowExternalId not provided.
missing_client_dataRequired clientData not provided.
config_invalidOther configuration validation failure.
camera_permission_deniedCamera blocked, or the web page is not on HTTPS.
session_not_foundThe session id did not resolve.
session_expiredSession minted too long ago to start.
session_failedSession ended in a failed state server-side.
session_token_expiredToken-mode SAT expired (mobile).
networkTransient connectivity failure; safe to retry.
create_failedSession creation failed — check key and workflow.
documents_failedDocument capture or processing failed.
initiate_failedFlow failed to start after session creation.
upload_failedEvidence upload failed; see error.stage.
poll_failedPolling for the result failed.
file_too_largeCaptured file exceeded the upload limit.
iframe_load_failedWeb: the SDK iframe did not load in time.
init_timeoutWeb: the ready handshake did not complete in time.
version_mismatchWeb: SDK / flow bridge protocol mismatch.
unknownUnclassified runtime error.

upload_failed stages:UploadUrlS3PutConfirmUpload