Entrust endpoints
Two surfaces on entrust_router: an authenticated session endpoint and an unauthenticated,
signature-verified webhook. The business flow behind them is in
validate_identity_document (Entrust / Onfido).
|
Au10tix / Entrust coexistence. Entrust Identity Verification (Onfido) is the eventual
replacement for Au10tix identity-document validation. During the rollout both vendors run
under the same |
POST /entrust/sessions
Creates (or reuses) an Entrust Identity Verification session for a supplier owner and returns the hosted verification URL.
Request body — CreateEntrustSessionRequest; both fields are optional at the HTTP layer because
the requirement depends on the caller:
{ "supplier_key": "9b1c4d3e-6f2a-4b8c-9d0e-1f2a3b4c5d6e", "person_id": "44f2a1b0-7c3d-4e5f-8a9b-0c1d2e3f4a5b" }
| Source | Identity resolution |
|---|---|
|
Self-service only. The body may be omitted entirely — |
|
Acts on someone else’s behalf, so |
|
Self-service origin used by the supplier onboarding flow; like |
Behaviour:
-
Prior-run lookup — reads the supplier’s
validate_identity_documentexecutions from the GSI and keeps only Entrust rows (those whoseinputcarries anapplicant_id) for thisperson_id, so historical Au10tix runs never affect dedup or rate limiting. -
Dedup — if one of those rows is
pendingand itsadditional_data.hosted_linkis still valid (link_expires_atin the future, or absent), that URL,workflow_run_idandsdk_tokenare returned instead of minting a new run. An unparseable expiry is treated as stale. -
Rate limit —
SUPPLIER_DASHBOARDandONBOARDINGare capped at 3 sessions per person →429.INTERNALis unlimited. -
Name lookup —
PayabilityInternalAPI.get_supplier_info(detailed=True), then the owner whoseloginKey == person_id. Middle names are stripped fromfirstName. Unknown supplier (400/404upstream) →404; missing owner or missing name →404; other upstream failures or connection errors →502. -
Session creation —
create_applicantthencreate_workflow_runagainstENTRUST_WORKFLOW_ID, tagged withcustom_data = {"supplier_key": …}. A 4xx from Onfido is passed through with its status and the parsed upstream body underentrust_error; a 5xx or connection error becomes502. -
Persistence —
TaskExecutionTable.save(task_id=workflow_run_id, …, status=pending)withinput = {supplier_key, person_id, applicant_id, workflow_run_id}andadditional_data = {hosted_link, link_expires_at, sdk_token}, thenToolTable.update(ENTRUST, PENDING, correlation_id=workflow_run_id). -
Downstream syncs — HubSpot
entrust_verification_status = in_progressand a supplier event (status = in_progress,tool = ENTRUST) to the internal EventLogger. Both are best effort; neither can fail the request. See HubSpot and Supplier event logger.
Response — EntrustSessionResponse:
{
"url": "https://alt.onfido.app/l/eyJhbGciOi...",
"workflow_run_id": "b1f7d0c2-3f4e-4a1b-9c8d-2e5f6a7b8c9d",
"sdk_token": "eyJhbGciOiJFUzUxMiJ9...",
"link_expires_at": "2026-08-19T09:14:03Z"
}
A metric create_entrust_session_endpoint_time_taken is emitted on every call, success or
failure.
Systems touched: Payability internal API, Entrust/Onfido, TaskExecutionTable, ToolTable,
ChangelogTable, HubSpot, EventLogger.
POST /entrust/webhook
Receives Onfido workflow-run completion callbacks. Unauthenticated by design — Onfido has no
Payability JWT — so it lives on a separate webhook_router without the JWTAuthorizer
dependency and establishes trust by signature instead.
The handler is deliberately thin: verify, correlate, enqueue. All slow work (Onfido re-read, S3
archive, document download and re-upload, verdict) happens in the SWF task
entrust/handle_identity_document_validation_response, mirroring how the Au10tix request task
schedules its response task.
| Check | Outcome |
|---|---|
|
Missing header, unset secret or mismatch → |
Body parses as JSON |
Otherwise |
|
Anything else → |
|
Missing → |
|
Missing row (session never minted or purged) → |
|
|
The scheduled activity carries
task_input = {supplier_key, person_id, applicant_id, workflow_run_id} and
task_correlation_id = workflow_run_id, with the deterministic workflow id
Automatic UW Tool - Entrust - {workflow_run_id}.
The raw request body must be read untouched (await request.body()) because the HMAC is
computed over the exact received bytes.
Systems touched: TaskExecutionTable (read only), SWF via the B2B Task Manager.
Configuring the webhook in Onfido
-
Point the Onfido webhook at
POST https://<host>/entrust/webhook(dev hosts include the/automatic-uw-tool-web-apiroot path). -
Subscribe to the
workflow_run.completedevent. -
Use the same shared secret that is stored as
ENTRUST_WEBHOOK_TOKENin theautomatic_uw_toolsecret — see Settings & secrets reference. -
The workflow itself is referenced by
ENTRUST_WORKFLOW_ID; changing the Studio workflow means changing that setting insettings_setup.py.