HMAC Signature Verification: Securing Your Didit Webhooks
Verify Didit webhooks with the signing input for the header you check: X-Signature-V2 over canonical JSON, X-Signature over exact raw bytes. Check X-Timestamp within 300 seconds and compare in constant time.

Contents
In this guide
Jump to the part you need.
This guide is for developers who receive Didit webhooks and need to verify each request before acting on it. The checks behind these events are billed per completed check. Full KYC is $0.33 per completed full KYC check at list price. The main caveat: preserve the raw request body on receipt, then use the signing input defined for the header you verify. X-Signature-V2 is recommended and signs sorted, Unicode-preserved canonical JSON. X-Signature signs the exact raw request bytes.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Header | What it signs | When to use it |
|---|---|---|
X-Signature-V2 | HMAC-SHA256 over sorted, Unicode-preserved canonical JSON | Recommended default |
X-Signature | HMAC-SHA256 over exact raw request bytes | Use when your stack passes the body through untouched |
X-Signature-Simple | HMAC-SHA256 over four envelope fields: {timestamp}:{session_id}:{status}:{webhook_type} | Deprecated fallback. Authenticates the envelope, not the decision body |
X-Timestamp | Unix epoch seconds when Didit dispatched the webhook | Check in both directions. Reject missing, invalid or more than 300 seconds away |
X-Signature-V2-Previous, X-Signature-Previous, X-Signature-Simple-Previous | The same signatures made with the replaced secret | Sent for 24 hours after a rotation. Not sent for the legacy application webhook URL |
Start free in the Didit sandbox with no sales call. For developers, connect Didit to an AI assistant through the Didit MCP server.
What HMAC verification proves
Every Didit destination has its own signing secret. We compute an HMAC-SHA256 signature over the material defined by the header and send it with the request. Each signature authenticates the material it covers using the shared secret. X-Signature-V2 authenticates sorted, Unicode-preserved canonical JSON. X-Signature authenticates the exact raw request bytes. X-Signature-Simple authenticates four envelope fields only.
A matching signature shows that the covered material was signed by a holder of the destination secret. A signature alone cannot establish that this delivery is new. It does not approve a user. For X-Signature-V2, a match does not establish byte-for-byte equality of the raw body. For Simple, decision fields in the payload are left unauthenticated, not removed.
X-Timestamp is checked for freshness, while V2 and the raw signature cover the body and Simple covers the documented four-field string, including its timestamp field. Reject a missing or invalid timestamp and any timestamp more than 300 seconds away from your clock in either direction. Freshness and idempotency are separate checks. Use the session event event_id as the dedupe key only after successful V2 or raw-body verification. The timestamp check does not deduplicate events within the window.
For session events, the envelope carries event_id, session_id, webhook_type, status, environment and, for decision statuses, a decision object. status.updated means a session or business-session status changed. Branch on the exact status before acting on a decision.
Prerequisites before you write code
- A webhook destination with a signing secret, created in the Business Console. Each destination has its own secret, and sandbox and live are separate applications.
- An API key for the Management API calls that read the secret and destination health.
- A runtime with HMAC-SHA256 and a constant-time comparison.
- An endpoint that preserves the raw request bytes and, for V2, can build canonical JSON as documented. Do not parse for event processing before verification succeeds.
- A clock synced to a time source, because the freshness window is 300 seconds.
- The exact event names you want. There is no wildcard.
Steps to verify a Didit webhook
- Create the destination and subscribe. Use exact values. For session status changes use
status.updatedand branch on the exact status before a decision. Usedata.updatedfor edits andtransaction.createdfor transaction monitoring. Multiple destinations fan out to different URLs. - Read the signing secret. The list endpoint never returns it, only
secret_last4. The full secret comes from the single destination GET route documented on the Get webhook destination page. - Store secrets per destination. Keep each secret outside your repository. During rotation, keep the current secret and the replaced secret available for the 24-hour overlap.
- Preserve the raw body and choose the signing input. Lead with the recommended V2 path: compute the HMAC over sorted, Unicode-preserved canonical JSON. Beside it, for
X-Signature, compute over the exact raw request bytes. For Simple, use the four envelope fields. - Check freshness. Reject with 401 when
X-Timestampis missing, invalid or more than 300 seconds in either direction. - Recompute and compare. For
X-Signature-V2, compare the canonical JSON HMAC withX-Signature-V2. ForX-Signature, compare the raw-byte HMAC withX-Signature. Do not compare a raw-body HMAC with V2. Use constant-time comparison. When a matching-Previousheader is present, verify the current header with the new secret or the corresponding-Previousheader with the replaced secret. - Defer event processing until verification succeeds. Preserve the raw request bytes and check timestamp freshness. For V2, decode the JSON only to build the documented canonical signing input. For the raw signature, verify the exact bytes before decoding. For Simple, read only the four fields needed for verification. Defer event routing and state changes until verification succeeds. Use
event_idas the dedupe key only after successful V2 or raw-body verification. If Simple is the only verified signature, use the authenticatedsession_idto retrieve the decision and apply the retrieved state idempotently. Do not use the webhook's unauthenticatedevent_idordecision. - Answer 2xx quickly and make the handler idempotent.
- Watch destination health.
health_statusis failing when three or more consecutive events failed their first attempt since the destination last answered successfully. Otherwise, degraded means an attempt failed in the last 24 hours and no later attempt delivered that event. Any successful attempt clears the failing streak. The failure activity endpoint lists recorded failure alerts, not individual attempts or signature failures.
Documented destination list call
This is the documented Management API call for destination inventory and health. It never returns the signing secret. The single destination route returns the secret and a delivery summary.
curl -X GET "https://verification.didit.me/v3/webhook/destinations/" -H "x-api-key: YOUR_API_KEY"
The response is a JSON array ordered by creation time. Each item carries uuid, url, enabled, webhook_version, subscribed_events, secret_last4, 30-day delivery metrics and health_status.
Expected outcomes:
- Valid delivery: your endpoint returns 2xx and processes the event once.
- Signature rejection: your endpoint returns 401 and writes nothing downstream.
- Timestamp rejection: missing, invalid or outside 300 seconds returns 401 and writes nothing downstream.
- Repeated session event after V2 or raw-body verification: the same
event_idleaves the result unchanged. If Simple is the only verified signature, the authenticatedsession_iddrives an idempotent write of the API-fetched decision.
Inputs and outputs
| Item | Direction | Value and source |
|---|---|---|
| Raw request body | Input | Preserve the exact bytes on receipt. For X-Signature, compute HMAC-SHA256 over the exact raw bytes with the destination secret. For X-Signature-V2 use the documented canonical JSON procedure. |
X-Timestamp | Input | Unix epoch seconds at dispatch. Reject missing, invalid or more than 300 seconds in either direction. |
X-Signature-V2 or X-Signature | Input | HMAC-SHA256 from Didit. Compare only with the matching signing input. |
X-Signature-Simple | Input | HMAC over four envelope fields. Deprecated. If used, re-fetch the decision before acting. |
| Signing secret | Input | Per destination, from the single destination GET route. |
event_id, session_id, webhook_type, status | Input | Session-event envelope fields. Use event_id for dedupe only after successful V2 or raw-body verification; with Simple, use the authenticated session_id and the API-fetched decision. For status.updated, branch on the exact status from the verified payload after V2 or raw-body verification. If Simple is the only verified signature, branch on the status returned by the decision API. |
decision | Input | Session-event decision object, present only for Approved, Declined, In Review and Abandoned. |
| 2xx | Output | Acknowledge quickly. Your handler. |
| 401 | Output | Reject on missing or invalid timestamp, or signature mismatch. Your handler. |
GET /v3/session/{session_id}/decision/ | Output | Re-fetch after Simple verification before acting. |
Failure cases and recovery
| Symptom | Likely cause | Recovery |
|---|---|---|
| Mismatch on every request | Your framework re-serialised the body, the secret belongs to another destination or environment, or you used the wrong signing input | For X-Signature, compute HMAC-SHA256 over the exact raw bytes with the destination secret. For X-Signature-V2 follow the canonical JSON procedure and compare with V2. Check the destination secret. |
| Mismatch right after a rotation | The destination secret was replaced in the Business Console | Verify the current header with the new secret or the corresponding -Previous header with the replaced secret while it is available for 24 hours. Deploy the new secret, then remove the fallback. |
| Signature fine, timestamp missing, invalid or stale | Clock drift, a missing header, or a timestamp more than 300 seconds in either direction | Sync the server clock. Reject with 401. Handle a repeated event with event_id as a separate idempotency check after V2 or raw-body verification, or with the authenticated session_id when Simple is the only verified signature. |
health_status is failing | Three or more consecutive events failed their first attempt since the destination last answered successfully | Read destination metrics and failure alerts, fix the endpoint, then resend. Any successful attempt clears the failing streak. |
| Duplicates downstream | The same event delivered more than once | Key the session write on event_id after V2 or raw-body verification. If Simple is the only verified signature, key it on the authenticated session_id and the API-fetched decision, and make the handler idempotent. |
| Decision fields unauthenticated | You verified with X-Signature-Simple | Simple signs four envelope fields, not the decision body. Re-fetch GET /v3/session/{session_id}/decision/ before acting, even when the payload contains a decision. |
| Status carries no decision | The current status is not a decision status | Handle the status without assuming the payload is incomplete. Wait for the event that carries a decision. |
Sandbox rollout checklist
Use only the documented webhook route. If your team asks about ticket attachment, the supplied docs show no ticket connector. Your application's verified webhook handler receives status.updated or data.updated; the docs do not prescribe ticket actions.
- Create a sandbox destination, point it at your endpoint and subscribe to the exact event you need. Sandbox testing is free on every plan.
- Send a signed delivery. Expected: 2xx and one processed event.
- Test each signature path separately by configuring the handler to accept only the signature under test. For V2, change the value of
event_id. ForX-Signature, change one raw byte. For Simple, change a signed field such asstatus. Keep the original signature and expect rejection in each case. Then run a separate Simple-only test that changes just the payload'sdecisionand confirm the handler applies the API-fetched decision. - Send a missing, invalid or old timestamp. Expected: 401 and no downstream write.
- Repeat the same session event. Expected: after V2 or raw-body verification the same
event_idleaves the result unchanged, and with Simple the authenticatedsession_iddrives the same idempotent write.
Received HMAC, expected HMAC, and what Didit signs
When a log says the received HMAC does not match the expected HMAC, two values are compared. Record the header name, the verification outcome and the body length. Do not log signature values, secrets, raw payloads or decision data. An optional local SHA-256 digest is only a fingerprint for a later byte comparison.
The usual causes are a body that was re-encoded before hashing, a secret from another destination or environment, or a proxy that altered a header. HMAC is a keyed hash, not encryption, so there is nothing to decrypt: recompute and compare. A manual copy of JSON can be re-serialised by a viewer or chat window, so use the local digest fingerprint if you need to compare later.
Didit documents a JSON POST body and HMAC signature headers for webhook verification. Use the signing input specified for the header you verify.
Paid steps and review boundaries
The checks that produce events are billed per completed check from prepaid credit:
- Full KYC check $0.33, which is ID document verification $0.15 plus passive liveness $0.10 plus face match 1:1 $0.05 plus device and IP analysis $0.03.
- AML screening $0.20 per check, ongoing AML monitoring $0.07 per person a year.
- Business verification from $2.00 per company, plus $0.20 company AML, plus $0.20 person AML for owners and officers, plus $0.33 for each linked KYC.
- Wallet screening $0.15 per screening. Transaction monitoring $0.001 per transaction beyond the plan allowance.
The destination list call is documented as pay-per-call. Our public price feed does not list a webhook delivery fee. We bill completed verification checks separately. For the checks in our full KYC example, see Didit User Verification. Use Didit pricing and the machine-readable price feed for current numbers.

status.updated webhook points to, with the warnings that drove the decision.A valid signature authenticates the covered material with the shared secret. It does not approve anything. In Review means automated checks raised warnings and a person decides: approve, decline or request a resubmission. Approved and Declined arrive with the decision object for session events, and Kyc Expired uses a single capital K. Status strings are exact and case sensitive, as the verification statuses page lists them.

In Review, a reviewer must make the final decision.Worked cost example
These are verification-check usage figures. Suppose a month brings 10,000 sessions: 8,000 full KYC checks and 2,000 that also need AML screening.
- 8,000 full KYC checks at $0.33 = $2,640.00
- 2,000 compliance bundles at $0.33 + $0.20 = $0.53 each = 2,000 x $0.53 = $1,060.00
- List verification-check total = $2,640.00 + $1,060.00 = $3,700.00
On Growth the discount is 4% before plan fees and credits. $0.33 x 0.96 = $0.3168, so 8,000 x $0.3168 = $2,534.40. $0.53 x 0.96 = $0.5088, so 2,000 x $0.5088 = $1,017.60. Discounted usage total = $3,552.00 before the $99 monthly plan fee and the $115 monthly credit.
On Scale the discount is 10% before plan fees and credits. $0.33 x 0.90 = $0.297, so 8,000 x $0.297 = $2,376.00. $0.53 x 0.90 = $0.477, so 2,000 x $0.477 = $954.00. Discounted usage total = $3,330.00 before the $299 monthly plan fee and the $350 monthly credit.

Sources
- Didit webhooks guide: signature headers, verification order, retries, envelope and event names.
- Didit verification statuses: exact status strings and transitions.
- List webhook destinations API: destination fields, metrics and health values.
- Get webhook destination API: single destination with signing secret and delivery summary.
- Webhook destination failure activity API: recorded failure alerts.
- Didit data models: decision object and per-feature report shapes.
- Didit rate limiting: per-scope limits, 429 shape and
Retry-After. - Didit sandbox testing: scenarios, magic values and documents.
- Didit User Verification product page and available KYC checks.
- Didit MCP server: connect Didit to an AI assistant.
- Didit Business Console: destinations, signing secrets and session review.
- Didit pricing, Didit pricing as JSON and pricing in the docs: unit prices and plan terms, read November 26, 2026.
- Didit integration prompt: the one-prompt integration route for coding agents.
The next step is a sandbox test: create a destination, send a signed delivery, confirm your handler returns 2xx, and repeat the same session event to confirm the result is unchanged. Start free at business.didit.me, no sales call needed.
Try it
Try this in the sandbox
Run the check this guide describes, free.
The product this post is about, taken from its topic. Run it free in the sandbox.
Author
Alejandro Rosas
Co-founder and CTO

Questions
Frequently asked questions
What signature header does Didit send with a webhook?
Didit sends X-Signature-V2, an HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON body, and recommends it. It also sends X-Signature, an HMAC-SHA256 over the exact raw request bytes, and X-Timestamp in Unix epoch seconds. X-Signature-Simple exists as a deprecated fallback that signs four envelope fields: timestamp, session ID, status and webhook type.
Why does my received HMAC not match my expected HMAC?
The values differ when the bytes or canonical form you hashed are not the material Didit signed, or when the secret is from another destination or environment. For X-Signature, recompute over the exact raw body. For X-Signature-V2, follow the documented canonical JSON procedure and compare to X-Signature-V2. HMAC is a keyed hash, not encryption, so there is nothing to decrypt.
How do I verify a Didit webhook signature in Node.js?
In Node.js, preserve the raw request body and validate X-Timestamp. Compute HMAC-SHA256 over the documented V2 canonical JSON, or over the exact raw bytes for X-Signature. Compare with the corresponding header in constant time and reject missing or malformed signatures before processing the event.
How fresh must a webhook be before I reject it?
Reject a missing or invalid X-Timestamp, and reject any timestamp more than 300 seconds away from your clock in either direction. Freshness and idempotency are separate checks. Use the session event event_id for dedupe only after successful V2 or raw-body verification; with Simple, use the authenticated session_id and the API-fetched decision. Keep the server clock synced.
What happens when my endpoint returns an error?
Didit retries failed deliveries a bounded number of times. A failed attempt is one your endpoint answered at HTTP 400 or above, or did not answer at all. Failed first attempts affect destination health: health_status is failing when three or more consecutive events failed their first attempt since the destination last answered successfully. Otherwise, degraded means an attempt failed in the last 24 hours and no later attempt delivered that event. Any successful attempt clears the failing streak.
How do I rotate a webhook signing secret without losing events?
Configure secrets per destination. During rotation, verify the current header with the new secret or the corresponding -Previous header with the replaced secret while it is available for 24 hours. The previous headers are not sent for the legacy application webhook URL.
Is X-Signature-Simple safe to use?
Use X-Signature-Simple only as a last resort. It signs four envelope fields, so the decision fields in the payload are left unauthenticated, not removed. If you verify with it, re-fetch GET /v3/session/{session_id}/decision/ before acting, even when the payload contains a decision.
Do webhook deliveries cost anything?
Our public price feed does not list a webhook delivery fee. Completed verification checks are billed separately, for example $0.33 per completed full KYC check at list price or $0.20 for AML screening. The destination list call is documented as pay-per-call; keep that separate from any delivery fee.
Does Didit send a verification.json file or a bundle SHA-256?
For webhook verification, we document a JSON POST body and HMAC headers rather than a verification.json file or a bundle checksum. Use the signing input specified for the header you verify. For your own records, a local SHA-256 digest over the bytes you received is only a fingerprint for a later byte comparison.
How do I test webhook verification in the sandbox?
Create a sandbox destination, point it at your endpoint and drive a session. Sandbox testing is free on every plan, environment is sandbox, and armed sandbox sessions carry a sandbox_scenario such as decline_aml_hit so you can reproduce a decision on demand. The sandbox guide lists the scenarios and magic values.
How do I see all my destinations and their health?
Call GET https://verification.didit.me/v3/webhook/destinations/ with the x-api-key header. It returns every destination with webhook_version, subscribed_events, secret_last4, 30-day delivery metrics and health_status. The secret itself is only returned by the single destination endpoint.
Compliance built in
Audited, certified and attested.
We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center
- Regulation encoded into your flows
Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.
- Ready for AMLR
Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.
- Tested in Spain's Treasury sandbox
Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.
- Audited, not self-declared
iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.
Your obligations · 3 regions
SOC 2 Type 2
ISO 27001
iBeta Level 1 and Level 2
EU regulator attestation
FSM youth protection
GDPR
EBA remote onboarding
MiCA compatible
FIDO Alliance member
- AMLREU AML Regulation ready
Integration · Didit MCP
Run Didit from your own AI agent
Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.
- Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
- Run investigationsAsk why a session was declined, review cases, search people and companies.
- Change rulesCreate payment rules, test them on past data and switch them on.
- Pull reportsAsk for numbers, exports or the audit log.
Didit Academy


