Webhooks allow your server to receive real-time notifications about KYC verification status changes.
What are Webhooks?
Webhooks are HTTP POST requests that Flonk sends to your server when verification events occur:
verification.completed— Automated verification finished (AI/system decision). This same event also fires when a reviewer approves a session that was in manual review. When Proof of Address is enabled in the project settings with Wait for PoA result in real time turned on, this event already contains the finalpoaStatus. With the toggle off,verification.completedfires after the identity step and a follow-upverification.updatedarrives later with the PoA outcome — see Proof of Address for the full flow.verification.status_changed— A status change made by an admin from the dashboard or as the outcome of manual review: the reviewer decision (approved/rejected; a rejection carriesrejection_reasonandreviewed_by), an automatic rejection taken by the checks themselves (rejectedwith a machine-readablerejection_reasonand noreviewed_by), and — informational only — the moment a session entersmanual_revieworaction_required(the latter carries the additivenext_actionfield). The informational entry events let your KYC page show a "verification pending" state without polling.verification.updated— Verification data was manually edited by admin (document fields, uploaded files), or the asynchronous PoA review finished (deliverspoaStatusandpoaConfidenceScore).
Review entry is now announced. When automated checks route a session to
manual_revieworaction_required, an informationalverification.status_changedfires with thatnewStatus(no decision yet). The final outcome still arrives later: approval firesverification.completed; rejection firesverification.status_changedwithstatus: "rejected". These entry events are additive — integrators that only handle the reviewer decision can ignore them.
Setup
1. Create endpoint in your application
1import { FlonkKYCServer } from '@flonkid/kyc/server';23const flonk = new FlonkKYCServer({4 secretKey: process.env.FLONK_SECRET_KEY!,5});67// Express webhook handler (use raw body for signature verification)8app.post('/webhooks/kyc',9 express.raw({ type: 'application/json' }),10 (req, res) => {11 const signature = req.headers['x-signature-256'] as string;1213 try {14 // Automatically detects signature format (sha256= or t=...,v1=...)15 const event = flonk.webhooks.constructEvent(16 req.body.toString(),17 signature,18 process.env.FLONK_WEBHOOK_SECRET!,19 );2021 // Process the verified event22 const verification = event.data.object;23 console.log(`Verification ${verification.id}: ${verification.status}`);24 console.log('Extracted data:', verification.extracted_data);2526 res.sendStatus(200);27 } catch (err) {28 console.error('Webhook verification failed:', err instanceof Error ? err.message : err);29 res.sendStatus(400);30 }31 }32);
2. Configure URL in Flonk Dashboard
- Go to Flonk Dashboard
- Select Settings → API and pick the environment (Sandbox or Production)
- Under Webhooks, enter your endpoint URL (for example
https://yourdomain.com/api/kyc/webhook) and save it with the check button - On the Webhook Secret row press Show. You may be asked to confirm it's you first. Copy the
whsec_…value
Each environment has its own endpoint URL and its own webhook secret. For test mode the URL and secret are set separately, in Settings → Test Mode.
The Settings → Webhooks tab does not hold the URL. It is the delivery history: every delivery, its attempts, and the failures you can retry (see Delivery status and failed deliveries).
Webhook Payload Format
All webhook payloads follow this structure:
{"id": "evt_1234567890","type": "verification.completed","created": 1640995200,"livemode": true,"data": {"object": {"id": "verification_attempt_id","client_id": "user_1761052168279","client_metadata": {},"status": "completed","confidence": 0.9442,"document_type": "id_card","extracted_data": {"full_name": "JOHN DOE","first_name": "JOHN","last_name": "DOE","date_of_birth": "1990-01-15","nationality": "UKR","sex": "M"},"duplicate_verification": {"is_duplicate": true,"previous_verification_id": "cmohkbzfq000686fezoudgcuc","previous_verified_at": "2026-04-27T19:01:03.000Z","match_type": "document_number","similarity_score": 1},"created_at": "2025-10-21T13:10:10.584Z","test_mode": false}}}
livemode tells you which kind of event you got. It is true for real
sessions and false for test mode sessions (those made
with a sk_test_* key) and for the dashboard's test ping. Test-mode events also
carry test_mode: true inside data.object.
The signature is sent in the headers (not in the body). Flonk sends two, both HMAC-SHA256 with your webhook secret:
X-Signature: t=1700000000, v1=abc123... ← also replay-protected (signed timestamp)X-Signature-256: sha256=def456... ← HMAC of the bodyX-Event-Type: verification.completedX-Event-Id: evt_1234567890
Both are fully valid signatures — both prove the request came from Flonk and
the body wasn't tampered with. The only difference: X-Signature also signs a
timestamp, so a captured request is rejected outside the skew window (default
5 min) — i.e. replay protection. X-Signature-256 has no timestamp, so a
captured request stays valid; close that gap by deduping on event.id
(recommended anyway). Prefer X-Signature when you want replay protection at the
signature layer; X-Signature-256 is perfectly safe for authenticity + integrity.
Which secret signs what
| Event | Signed with | Where to find it |
|---|---|---|
Real session (livemode: true) | The webhook secret (whsec_…) of the environment that created the session | Settings → API, Webhook Secret row (Sandbox and Production have one each) |
Test mode (livemode: false) | The project's test webhook secret (whsec_test_…) | Settings → Test Mode, Test Webhook Secret |
If your endpoint serves several environments, pick the secret by livemode (and
by the environment you configured the URL for). A signature made with the wrong
secret will never match.
The dashboard shows the live and sandbox secrets but has no rotate button for them. The test secret is replaced by Regenerate Keys in Settings → Test Mode, which also replaces the test publishable and secret keys, so update all three in your app.
Event Types
verification.completed
Sent when automated verification finishes (AI/system decision). Status is always completed.
Duplicate verification signal
When a verification completes successfully, Flonk checks whether the same document or person was already verified in the same project. If a match is found, the verification.completed webhook includes an optional duplicate_verification object.
This is a signal for your own risk logic. Flonk still completes the verification normally; your application decides whether to allow the user, block the user, send the case to manual review, or apply a custom threshold.
Duplicate checks are scoped to a project. The same person or document can be verified in a different project without being marked as a duplicate for your project.
Example:
{"duplicate_verification": {"is_duplicate": true,"previous_verification_id": "cmohkbzfq000686fezoudgcuc","previous_verified_at": "2026-04-27T19:01:03.000Z","match_type": "document_number","similarity_score": 1}}
AML screening result
When AML screening is enabled and ran for the verification, verification.completed includes an optional aml object. It is absent when screening did not run. Only verification.completed carries it: the verification.status_changed event sent when a verification enters manual_review does not, so read the final result from verification.completed or from GET /v1/verifications/{sessionId}. The field is additive; no API version change.
{"aml": {"status": "clear","provider": "dilisense","checked_at": "2026-10-05T12:04:30.000Z","total_hits": 0,"matched_hits": 0,"cleared_hits": 0,"confirmed_hits": 0,"categories": []}}
status is clear, hit, or error. matched_hits counts the matches found, cleared_hits those a reviewer marked as false positives, and confirmed_hits those a reviewer confirmed. categories contains any of SANCTION, PEP, CRIMINAL, OTHER, ADVERSE_MEDIA. adverse_media_articles is added when adverse media screening is on; adverse media is informational and does not by itself hold a verification. Hit details are visible only in the dashboard.
Fields:
| Field | Type | Description |
|---|---|---|
is_duplicate | boolean | Always true when the object is present |
previous_verification_id | string | ID of the earlier successful verification in the same project |
previous_verified_at | string | ISO 8601 timestamp of the earlier verification |
match_type | "document_number" | "personal_data" | How the duplicate was detected |
similarity_score | number | Match confidence from 0.0 to 1.0 |
match_type values:
| Value | Meaning | Typical score |
|---|---|---|
document_number | Exact blind-index match on the document number. This usually means the same physical document was used before. | 1.0 |
personal_data | Blind-index match on last name + date of birth. This can catch the same person using another document type, for example passport first and ID card later. | 0.95 |
When no duplicate is detected, duplicate_verification is omitted from the webhook payload.
Workflow and checks
When the session ran with a workflow, verification.completed also says which workflow version it ran and how each check ended. Both fields are additive and only on verification.completed; verification.status_changed, verification.updated and verification.aml_alert do not carry them.
{"workflow": {"id": "wf_clx1234567890","version_id": "clx0987654321","version": 3},"checks": [{ "node_id": "node_document", "feature": "document", "status": "passed", "score": 0.94 },{ "node_id": "node_liveness", "feature": "liveness", "status": "passed", "score": 0.91 },{ "node_id": "node_face", "feature": "faceMatch", "status": "passed", "score": 0.88 },{ "node_id": "node_poa", "feature": "poa", "status": "skipped", "score": null }]}
workflow:
| Field | Type | Description |
|---|---|---|
id | string | Workflow id |
version_id | string | The published version the session was pinned to |
version | number | Version number inside the workflow, starting at 1 |
checks has one entry per feature step of that workflow version:
| Field | Type | Description |
|---|---|---|
node_id | string | Id of the step in the workflow graph. Stable within one workflow version |
feature | string | Which check it is, see the list below |
status | string | pending, passed, failed, skipped or error. skipped means the check did not run for this session (for example, no selfie was uploaded or no proof of address) |
score | number | null | Confidence score for checks that produce one; null when the check has no score or did not run |
feature values:
| Value | Check |
|---|---|
document | Document reading and validation |
liveness | Liveness of the selfie |
faceMatch | Selfie against the document portrait |
faceReverify | Face re-verification of a returning person |
poa | Proof of Address |
vaultReuse | Reuse of an identity that was verified before |
aml | AML screening |
When these fields can be missing:
- The session ran without a workflow:
workflowisnullandchecksis[]. - Flonk could not read the workflow data when it built the event: both fields are left out. Treat a missing field as "unknown", not as "no workflow".
- Use
featurevalues you know and ignore the rest, so a check added later does not break your code.
Only ids, the version number, statuses and scores are sent. Workflow names, issue codes and branch decisions stay in the dashboard.
verification.status_changed
Sent when a verification's status changes. Two kinds of change use this event:
- Reviewer decision —
statusisapprovedorrejected, made by an admin from the dashboard or as the outcome of manual review. A rejection carriesrejection_reasonandreviewed_by;previous_statusismanual_review. - Automatic rejection —
statusisrejectedwithprevious_status: "processing"and noreviewed_by: the checks reached a verdict no review could change, so the session was never queued.rejection_reasonis a machine-readable code — today onlyDOCUMENT_EXPIRED(the document is past its expiry date; the holder needs a new one and must start a new session). - Review entry (informational) —
statusismanual_revieworaction_required, fired the moment automated checks route the session there. No decision has been made yet;previous_statusisprocessing. Anaction_requiredentry additionally carriesnext_action(resubmit_front/resubmit_back). These entry events are additive — ignore them if you only act on the final decision.
A manual-review approval does not use this event — it fires
verification.completedinstead. Only rejections (reviewer or automatic) and the informational review-entry events above arrive asverification.status_changed.
Additional fields in data.object:
| Field | Type | Description |
|---|---|---|
previous_status | string | Status before the change (e.g. completed, manual_review, processing) |
rejection_reason | string? | Reason for rejection (only when status is rejected) — free text from a reviewer, or a code such as DOCUMENT_EXPIRED from an automatic rejection |
reviewed_by | string? | Identifier of who made the decision (admin email or reviewer role); absent on an automatic rejection |
next_action | string? | On an action_required entry: the side to re-upload — resubmit_front or resubmit_back |
{"id": "evt_1234567891","type": "verification.status_changed","created": 1640995300,"livemode": true,"data": {"object": {"id": "verification_attempt_id","client_id": "user_1761052168279","status": "rejected","confidence": 0.95,"document_type": "passport","extracted_data": {"full_name": "JOHN DOE","first_name": "JOHN","last_name": "DOE"},"previous_status": "completed","rejection_reason": "Document expired","reviewed_by": "admin@company.com","created_at": "2025-10-21T13:10:10.584Z"}}}
verification.updated
Sent when an admin manually edits verification data (document fields, uploads new files) from the dashboard.
Additional fields in data.object:
| Field | Type | Description |
|---|---|---|
updated_at | string | ISO 8601 timestamp of the update |
updated_by | string? | Email of the admin who made the edit |
extracted_data | object | Updated extracted data (issue_date, expiry_date, place_of_birth, …). document_number is not included — see the note below. |
{"id": "evt_1234567892","type": "verification.updated","created": 1640995400,"livemode": true,"data": {"object": {"id": "verification_attempt_id","client_id": "user_1761052168279","status": "completed","document_type": "passport","extracted_data": {"full_name": "JOHN DOE","first_name": "JOHN","last_name": "DOE","date_of_birth": "1990-01-15","nationality": "UKR","sex": "M","issue_date": "2020-01-01","expiry_date": "2030-01-01","place_of_birth": "Kyiv"},"created_at": "2025-10-21T13:10:10.584Z","updated_at": "2026-03-31T12:00:00.000Z","updated_by": "admin@company.com","test_mode": false}}}
verification.aml_alert
Sent when ongoing AML monitoring finds a new possible match for a person you verified earlier. It fires only when Ongoing monitoring is enabled. The verification itself stays completed; review the new match in the dashboard.
Fields in data.object:
| Field | Type | Description |
|---|---|---|
id | string | The verification attempt ID (same as verification_attempt_id). |
status | string | Verification status. Stays completed. |
document_type | string | Type of the verified document. |
extracted_data | object | Always {}. Alerts carry no personal data. |
created_at | string | ISO 8601 timestamp when the alert was created. |
test_mode | boolean | true for test-mode sessions. |
client_id | string | Your client ID for the person, when you set one. |
client_metadata | object | The metadata you passed when creating the session, when you set one. |
session_id | string | The session that was verified. |
verification_attempt_id | string | The verification attempt the match belongs to. |
aml | object | Updated AML summary, now including the new match. |
alert.new_hits | number | How many new matches this alert found. |
alert.categories | string[] | Categories of the new matches (SANCTION, PEP, CRIMINAL, OTHER). |
alert.detected_at | string | ISO 8601 timestamp of the detection. |
{"id": "evt_1234567893","type": "verification.aml_alert","created": 1640995500,"livemode": true,"data": {"object": {"id": "verification_attempt_id","status": "completed","document_type": "passport","extracted_data": {},"created_at": "2026-11-12T08:30:01.000Z","test_mode": false,"client_id": "client_42","session_id": "sess_1234567890","verification_attempt_id": "verification_attempt_id","aml": {"status": "hit","provider": "dilisense","checked_at": "2026-10-05T12:04:30.000Z","total_hits": 2,"matched_hits": 1,"cleared_hits": 0,"confirmed_hits": 0,"categories": ["PEP"]},"alert": {"new_hits": 1,"categories": ["PEP"],"detected_at": "2026-11-12T08:30:00.000Z"}}}}
This event is additive; integrators that do not use monitoring never receive it.
Handling Event Types
const event = flonk.webhooks.constructEvent(rawBody, signature, secret);switch (event.type) {case 'verification.completed':// Automated AI decisionawait handleAutomatedVerification(event.data.object);break;case 'verification.status_changed':// Admin manual decisionawait handleAdminDecision(event.data.object);break;case 'verification.updated':// Admin edited verification dataawait handleDataUpdate(event.data.object);break;case 'verification.aml_alert':// Ongoing monitoring found a new possible matchawait handleAmlAlert(event.data.object);break;}
Signature Verification (Security)
Important: Always verify webhook signature for security!
Using the SDK (Recommended)
import { FlonkKYCServer } from '@flonkid/kyc/server';const flonk = new FlonkKYCServer({secretKey: process.env.FLONK_SECRET_KEY!,});// Automatically detects signature format (t=,v1= or sha256=)const event = flonk.webhooks.constructEvent(rawBody, // raw request body as stringsignatureHeader, // X-Signature header (recommended) or X-Signature-256webhookSecret, // your webhook secret);console.log(event.type); // 'verification.completed', 'verification.status_changed', 'verification.updated', or 'verification.aml_alert'console.log(event.data.object.id); // verification ID
Manual Verification
If you verify without the SDK, use a constant-time comparison —
=== on the signature string leaks how many leading characters matched via
timing and is exploitable. Use crypto.timingSafeEqual:
import crypto from 'crypto';function verifyWebhookSignature(payload: string,signature: string,secret: string): boolean {const expected ='sha256=' + crypto.createHmac('sha256', secret).update(payload).digest('hex');// Constant-time compare. HMAC both sides so the buffers are equal length// regardless of input, then timingSafeEqual — no early length/return branch.const key = crypto.randomBytes(32);const a = crypto.createHmac('sha256', key).update(signature).digest();const b = crypto.createHmac('sha256', key).update(expected).digest();return crypto.timingSafeEqual(a, b);}
To check the timestamped X-Signature by hand: read t and v1 from the
header, compute HMAC-SHA256 (hex) of the string {t}.{rawBody} with your webhook
secret, compare it to v1 in constant time, and reject the request if t is
more than 5 minutes from your clock.
Prefer the SDK's
constructEvent— it does exactly this for you and also handles the timestampedt=,v1=format.
Best Practices
1. Idempotency
Flonk delivers at-least-once (see Retry Logic), so the same
event can arrive more than once. Dedupe by event.id — store the ids you've
processed and skip ones you've already seen. This is the same pattern you'd use
for Stripe; keep it in your own durable store, separate from the signature check.
A unique index on the event id (atomic, durable) is the simplest:
app.post('/api/kyc/webhook', async (req, res) => {const event = flonk.webhooks.constructEvent(req.rawBody, req.headers['x-signature'], secret);try {await db.webhookEvents.create({ data: { eventId: event.id } }); // unique constraint} catch (e) {if (isUniqueViolation(e)) return res.status(200).end(); // already processedthrow e;}await processWebhook(event);res.status(200).end();});
Or with Redis — SET NX returns null when the key already existed:
const fresh = await redis.set(`whk:${event.id}`, '1', 'PX', 6 * 60_000, 'NX');if (fresh === null) return res.status(200).end(); // retry — already handled
2. Quick Response
Respond quickly (< 5 seconds), process asynchronously:
@Post('webhooks/flonk')async handleWebhook(@Body() payload: any) {// Quick validationif (!this.verifySignature(payload)) {throw new UnauthorizedException();}// Add to processing queueawait this.queue.add('process-webhook', payload);// Respond immediatelyreturn { received: true };}
3. Retry Logic
Flonk makes up to 8 delivery attempts per event: the first immediately, then one every 5 minutes — a flat interval, not exponential backoff. So the last attempt lands roughly 35 minutes after the first.
| Setting | Value |
|---|---|
| Attempts | 8 (1 immediate + 7 retries) |
| Interval | 5 minutes, flat |
| Per-attempt timeout | 30 seconds |
| Counts as delivered | any 2xx |
| Retried | any other status, plus timeouts and connection errors |
| Never retried | 400 and 401 — we read those as "this endpoint will never accept it" |
After the 8th failed attempt the delivery is marked dead and stops on its own. Dead and failed deliveries can be replayed by hand from Settings → Webhooks in the dashboard, optionally against a different URL — a replay sends the original body, so your signature check still passes.
Because a slow endpoint burns attempts, respond 200 first and process
afterwards (see Quick Response).
5. Delivery status and failed deliveries
Every real event is stored as a delivery, and you can follow it in Settings → Webhooks. A delivery is in one of these states:
| Status | Meaning |
|---|---|
pending | Queued, not tried yet (or queued again after a manual retry) |
in_flight | Being sent right now |
succeeded | Your endpoint answered 2xx |
failed | The last attempt failed and another attempt is scheduled |
dead | No more attempts: the 8th attempt failed, or your endpoint answered 400 / 401 |
The status filter also has Open failures: the failed and dead deliveries
that still need attention.
When something is failing, a red box at the top of the tab says how many deliveries are open. It has two buttons:
- Show failed opens the Open failures list. Open a delivery to see each attempt and your endpoint's answer, then Retry it to the project URL or to a custom URL.
- Not relevant hides the current failures for the whole team. The alert comes back only when a new delivery fails or someone retries one by hand.
The same alert appears on the dashboard overview. Only people who can manage project settings see it and can retry, and only for projects that have a webhook URL set. If you do not use webhooks, remove the endpoint URLs (Sandbox and Production in Settings → API, and the test URL in Settings → Test Mode): nothing is sent, and the alert stops.
Test mode webhooks
Sessions made with a sk_test_* key send webhooks too, so you can test your
receiver end to end. They have livemode: false, are signed with the test
webhook secret, and go to the Test Webhook URL from Settings → Test
Mode (if none is set, the environment's endpoint URL is used).
To check your endpoint without creating a session, set the Test Webhook URL in
Settings → Test Mode and press Send Test Webhook. It sends one sample
verification.completed event (id starting evt_test_, livemode: false) with
both signature headers, and shows you whether your endpoint answered 2xx.
A test ping is sent once and is not stored as a delivery. It does not appear in Settings → Webhooks, is not retried, and cannot be replayed from there. Use the dashboard message, or your own logs, to see how it went.
4. Logging
Log all received webhooks. The fields live on the event, not on a wrapper:
logger.info('Webhook received', {eventId: event.id, // 'evt_...' — also the X-Event-Id headertype: event.type, // 'verification.completed'verificationId: event.data.object.id,clientId: event.data.object.client_id,created: event.created, // Unix seconds});