Didit Webhook Security Patterns: HMAC, Timestamps, Rotation
Capture the raw body, check X-Timestamp within 300 seconds, and verify the HMAC in constant time. Compare the signature with your secret against the current and previous headers for your format. Process each verified event once.

Contents
In this guide
Jump to the part you need.
This guide is for developers who receive Didit verification, business and transaction events and need to verify them safely. A full KYC check costs $0.33 at list price. The pattern: capture the original body, reject requests whose dispatch timestamp differs from your server time by more than 300 seconds, verify the HMAC-SHA256 signature in constant time, then accept each event idempotently. The main caveat is signing: X-Signature-V2 uses canonical JSON, X-Signature uses the exact request bytes, and the deprecated Simple fallback signs only part of the event.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
Webhook security patterns at a glance
| Problem | Pattern | Didit header or field |
|---|---|---|
| Forged request | HMAC-SHA256 with a per-destination secret, compared in constant time | X-Signature-V2 |
| Replay of a captured payload | Reject requests whose dispatch timestamp differs from your server time by more than 300 seconds, then, after full-body verification, deduplicate on the verified event id | X-Timestamp, event_id |
| Duplicate processing | Idempotent state update keyed on the verified event id, applied only after full-body verification | event_id |
| Secret rotation breaking verification | For the header you verify, compare the HMAC computed with your configured secret against both the current header and its -Previous twin for 24 hours, accepting either | X-Signature-V2-Previous |
| Silent delivery failure | Alert on destination health and use endpoint logs to diagnose failures | health_status, failing_streak |
| Schema drift | Pin the payload version you parse | webhook_version, v3 is current |
Start free in the sandbox at https://business.didit.me/, no sales call. For developers who want an assistant to write the endpoint, connect Didit to an AI assistant through the Didit MCP server. Verification events come from the user and business verification flows. Alerts from Transaction Monitoring, the product line that also holds wallet screening, arrive as transaction.created when the initial verdict is ready and transaction.status.updated when a transaction status changes. Use the published prices for the checks that produce these events on the pricing page.
What you are defending against
These checks address tampering, spoofing, replay and flooding.
- Tampering. Someone changes a payload in flight, for example flipping a status to Approved. A valid HMAC authenticates the signed data as coming from a holder of the shared secret and detects changes to that data.
- Spoofing. Someone posts a made-up event to your endpoint. The same signature check makes a forged body fail unless the sender holds the shared secret.
- Replay. Someone resends a real payload later so your system repeats an action. A timestamp window plus idempotency on
event_idlimits the effect. - Flooding. Someone sends volume until the endpoint falls over. Rate limiting and cheap rejection at the edge protect you.
Prerequisites
- A Didit account and application. Sandbox work is free and unlimited.
- An API key authorized for the management endpoint you call. The destination failure activity endpoint requires
read:webhooks. - An HTTPS endpoint that can capture the original request body before middleware consumes it.
- The destination secret in an environment variable or secret manager, never in the repository.
- Somewhere to record the
event_idvalues you have already accepted.
Step by step: verify and process a Didit webhook
List your destinations and what they subscribe to. There is no wildcard, so the subscription list is the source of truth for what will arrive. Multiple destinations each get their own secret, subscriptions and health record, so create more destinations when you need different URLs. This is a pure read with no side effects.
curl -X GET 'https://verification.didit.me/v3/webhook/destinations/' -H 'x-api-key: YOUR_API_KEY'Read the signing secret for the destination you verify. The list call never returns the secret, only
secret_last4, which helps identify a secret. A matching suffix does not verify the full secret. The full secret comes from the single-destination call at/v3/webhook/destinations/{destination_uuid}/, or from the Business Console when the destination is created.Capture the original request body before middleware consumes it. Verify
X-Signatureagainst those exact bytes. ForX-Signature-V2, reconstruct the documented canonical JSON. Process the event only after verification succeeds.Check freshness. Reject requests whose dispatch timestamp differs from your server time by more than 300 seconds.
X-Timestampis Unix epoch seconds from the moment Didit dispatched the webhook. Freshness and event deduplication work together. The timestamp check alone does not authenticate the dispatch value or stop every replay inside the window.Verify the documented signature inputs in constant time.
X-Signature-V2is HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON and is the header we recommend.X-Signatureis HMAC-SHA256 over the exact raw bytes and works only when your stack does not re-encode the body.X-Signature-Simpleis HMAC-SHA256 over{timestamp}:{session_id}:{status}:{webhook_type}and is a deprecated fallback that authenticates the envelope, not the decision. For the signing format you verify, compute the HMAC with your configured secret and compare it in constant time against both the current header and, when present, its-Previoustwin, accepting a match on either. Immediately after rotation, the old configured secret matches the-Previousheader during the 24-hour overlap. Deploy the new secret during that window and verify it against the current header. Apply the same rule toX-Signature-Simple-Previousif you retain the deprecated fallback.Branch on
webhook_typeafter full-body verification. Status values are exact, case-sensitive strings, includingKyc Expiredwith a single capital K. For the deprecated Simple fallback, note that onlytimestamp,session_id,statusandwebhook_typeare signed. A session decision must come fromGET /v3/session/{session_id}/decision/. Keep unsigned fields such asevent_idandmetadataout of processing and deduplication decisions. The sessiondecisionobject appears on Approved, Declined, In Review and Abandoned, and it mirrors that endpoint with plural arrays such asid_verifications[],liveness_checks[]andaml_screenings[].Accept idempotently. After verifying the full body with
X-Signature-V2orX-Signature, record the verifiedevent_idand apply the state change as one atomic operation. Return a 2xx promptly once the event has been safely accepted. Return a 2xx for an event already accepted without repeating its effects. For a Simple-only session notification, fetch the decision fromGET /v3/session/{session_id}/decision/and keep unsigned webhook fields out of processing and deduplication.Watch destination health instead of waiting for a complaint.
health_statusisfailingwhen 3 or more consecutive events failed their first delivery attempt since the destination last answered successfully. It isdegradedonly when it is notfailingand an event with a failed attempt in the last 24 hours still has no later successful delivery. It ishealthyotherwise. Any successful attempt, including a retry or resend, ends the failure streak. Alert on destination health and use endpoint logs to diagnose failures. Recorded failure alerts come from the destination activity call, which paginates withlimitandoffset.Rotate the secret with an overlap. Deploy code that, for the signing format you verify, computes the HMAC with your configured secret and compares it in constant time against both the current header and its
-Previoustwin when present, accepting a match on either. Then rotate the destination secret in the Business Console. During the 24-hour overlap the old configured secret matches the-Previousheader. Deploy the new secret during that window and verify it against the current header, then remove the old secret when the window closes. The legacy applicationwebhook_urlnever receives-Previousheaders.
Expected output
The destination list returns a JSON array, not a paginated object, ordered by creation date. Each item carries uuid, url, enabled, webhook_version, subscribed_events, health_status, failing_streak, secret_last4 and flat 30-day delivery metrics: deliveries_count, failed_deliveries_count, average_response_time_ms and error_rate_percentage. A valid webhook returns your endpoint's 2xx. A stale timestamp or bad signature is rejected and changes no state.

status.updated webhook carries the same status string the Console shows.Sandbox checklist
Use a sandbox destination and a test event to prove each outcome before production.
- Valid event: the endpoint captures the original body, verifies the signature, accepts the event once and returns 2xx.
- Stale timestamp: change the test request so
X-Timestampdiffers from your server time by more than 300 seconds. The endpoint rejects it and changes no state. - Repeated event id: send the same
event_idtwice. The first request applies the change; the second returns 2xx without repeating its effects. - Verification during secret rotation: deploy code that matches current and previous headers, rotate the destination secret, send a test event, and confirm both header sets verify during the 24-hour overlap.
Failure cases and recovery
| Layer | Symptom | Cause | Recovery |
|---|---|---|---|
| Management API | 401 on the destination list | Missing, malformed, revoked or expired API key | Check DIDIT_API_KEY or create a new key. Do not retry the call as is. |
| Management API | 403 | Missing credentials or access denied | Check that x-api-key is present, then read the response detail and verify endpoint permissions and any IP restrictions. |
| Management API | 429 | Rate limit or quota reached | Wait for Retry-After, then retry. |
| Incoming webhook rejection | Every signature fails | Body was parsed before verification, wrong secret, or the wrong input for the header | Use exact bytes for X-Signature, canonical JSON for X-Signature-V2, and compare secret_last4 against the secret you hold. |
| Incoming webhook rejection | Fresh payload rejected as stale | Server clock drift, or a genuine replay | Sync the clock, keep the 300 second absolute difference, and reject the request. |
| Incoming webhook rejection | Same event handled twice | Your 2xx was lost and Didit retried | Verify the full body with X-Signature-V2 or X-Signature, deduplicate on the verified event_id, and return a 2xx for an event already accepted without repeating its effects. |
| Incoming webhook rejection | Only the Simple signature was verified | Only timestamp, session_id, status and webhook_type are signed | Fetch the decision from GET /v3/session/{session_id}/decision/ and keep unsigned fields out of processing and deduplication. |
| Destination health state | Destination reports degraded | Not failing, but an event with a failed attempt in the last 24 hours still has no later successful delivery | Check endpoint logs for the failed event. Any successful attempt ends the failure streak. A retry or resend clears this event's contribution to degraded only when it successfully delivers that event. The destination stays degraded if another qualifying event remains undelivered and the destination is not failing. |
| Destination health state | Destination reports failing | 3 or more consecutive first-attempt failures | Read failing_streak and failing_since, then the activity call, and fix the endpoint. |
| Destination health state | No deliveries at all | Destination disabled, or no events match its subscribed_events | Check both enabled and subscribed_events. Health status is independent of enabled. |
Inputs and outputs
| Direction | Item | Notes |
|---|---|---|
| Input | X-Signature-V2, X-Signature, X-Signature-Simple | V2 is recommended. Simple covers the envelope only and is a deprecated fallback. |
| Input | X-Timestamp | Unix epoch seconds, checked as an absolute difference of at most 300 seconds. |
| Input | Envelope body | event_id, session_id, status, webhook_type, created_at, environment, workflow_id, vendor_data, metadata, plus decision on Approved, Declined, In Review and Abandoned. |
| Input | Destination secret | Per destination, from the Console or the single-destination call. |
| Output | HTTP status | 2xx means accepted. 4xx means rejected and should be investigated, not retried blindly. |
| Output | State change | Applied once per event_id. |
| Output | Delivery metrics | deliveries_count, failed_deliveries_count, average_response_time_ms, error_rate_percentage over a 30 day window. |

transaction.created when the initial verdict is ready and transaction.status.updated when the transaction status changes. Events point at records like this one.Didit retry triage walkthrough
Use this when a destination stops delivering or when the Console shows a health problem. Start with the destination record, then move to the failure alerts, then test the receiver in sandbox.
Read the destination state. Call the list destinations endpoint or open the destination in the Business Console. Read
health_status,failing_streak,failing_since,last_success_atand the 30-day metrics.Separate failure alerts from delivery attempts. The destination activity endpoint returns recorded failure alerts, newest first, each with
typeset tofailure_alert,occurred_atandfailure_count. These alerts are not individual delivery attempts and they are not outbound event types.Check how first attempts affect the streak. A failed attempt is one the destination answered with HTTP 400 or above, or did not answer at all. Only first-attempt failures increase
failing_streak. Retries do not add to it. Any successful attempt, including a retry or resend, ends the failure streak. Classify a destination asdegradedonly when it is notfailingand an event with a failed attempt in the last 24 hours still has no later successful delivery.Validate the receiver with a sandbox test event. Send a test event to the sandbox destination and confirm the endpoint returns 2xx, accepts the event once and records no duplicate effect. If the sandbox passes, compare the production endpoint configuration, secret and network path.
Payload versions, retries and signing headers
webhook_version describes the payload schema, not the signing format. It is v1, v2 or v3, and v3 is current. X-Signature-V2 names a signing format. When you move a destination between payload versions, treat it as a deployment: parse the new shape in staging, keep the old handler until the new one has delivered real events, then cut over.
Worked cost example
Use the published prices for the checks that produce these events. The numbers come from the live pricing feed and the pricing page.
- 10,000 full KYC checks a month at list: 10,000 x $0.33 = $3,300.00.
- Scale prices full KYC at $0.297 per completed check and includes $350 in monthly credit. The same 10,000 checks on Scale: 10,000 x $0.297 = $2,970.00. Minus the $350.00 monthly credit = $2,620.00 of usage, plus the $299.00 monthly fee = $2,919.00. That is $381.00 less than list.
- Add AML screening to every user: 10,000 x ($0.33 + $0.20) = $5,300.00 at list. On Scale: 10,000 x ($0.297 + $0.18) = $4,770.00 of usage before credit and plan fees.
The full list sits on https://didit.me/pricing/ and in the pricing docs.

Sources
- Didit docs: Webhooks, real-time KYC and KYB events, HMAC signing
- Didit docs: List webhook destinations API
- Didit docs: Get webhook destination API
- Didit docs: Webhook destination failure activity API
- Didit docs: webhook delivery attempts
- Didit docs: webhook destination analytics
- Didit docs: Verification statuses and session lifecycle
- Didit docs: API errors, status codes and fixes
- Didit docs: API rate limiting and 429 backoff
- Didit docs: Data models for every report object
- Didit pricing page and pricing in the docs and the live pricing feed
- Didit integration prompt for coding agents
- Didit MCP server setup
Next step: open the sandbox at https://business.didit.me/, create a destination, and send yourself a test event. There is no sales call. Use the curl call above to list destinations and confirm what will arrive.
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 is the most important webhook security pattern?
HMAC-SHA256 signature verification with a per-destination secret, compared in constant time. A valid HMAC authenticates the signed data as coming from a holder of the shared secret and detects changes to that data. Timestamps and idempotency then cover replay and duplicate processing.
Which signature header should I verify on Didit webhooks?
Verify X-Signature-V2, which is HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON. Fall back to X-Signature over the exact raw bytes only when your stack does not re-encode the body. X-Signature-Simple is a deprecated last resort: it signs only timestamp, session_id, status and webhook_type, so a session decision must come from GET /v3/session/{session_id}/decision/ and unsigned fields stay out of processing and deduplication.
How fresh must a Didit webhook be?
Compare X-Timestamp with your server clock and reject any request outside the 300-second window. With X-Signature-V2 or raw-body signing, the HMAC covers the body. Deduplicate on the verified event_id before applying state changes.
What counts as a failed Didit webhook delivery?
A failed attempt is one the destination answered with HTTP 400 or above, or did not answer at all. A 2xx is the endpoint's recommended acknowledgment. Retries do not add to failing_streak, and any successful attempt, including a retry or resend, ends the streak.
How do I rotate a webhook signing secret without downtime?
Before rotating the destination secret in the Business Console, deploy a verifier that computes the HMAC with its configured secret and compares it in constant time against the current signature and its -Previous counterpart when present, accepting either match. During the 24-hour overlap, the old secret verifies the previous header, so deploy the new secret during that window and confirm it verifies the current header. Apply the same logic to X-Signature-Simple-Previous if you retain Simple signing. The legacy application webhook_url never receives previous signature headers.
Can I verify Didit webhooks in PHP?
Yes, but the input depends on the header you verify. PHP can compute HMAC-SHA256 over the documented canonical JSON for X-Signature-V2, or over the exact request bytes for X-Signature, then compare the result in constant time.
Do all webhook providers use the same HMAC header name?
No. Each provider names its own headers and defines its own signed string, so a header that works for one integration means nothing on another. For Didit, read X-Signature-V2 first, then X-Signature, and always pair the check with X-Timestamp.
How do I stop the same event being processed twice?
Verify the full body with X-Signature-V2 or X-Signature first, then record the verified event_id and apply its state change as one atomic operation, so concurrent deliveries cannot both apply it. A lost acknowledgment is one common cause of duplicates, because a retry then delivers a payload your system already applied. Return a 2xx for an event already accepted without repeating its effects.
Is there a wildcard event subscription?
No. A destination receives only the events named in subscribed_events, so list every event family you need, for example status.updated, data.updated, transaction.created and travel_rule.status.updated. If you need different URLs, create multiple destinations and fan out.
How do I triage a Didit webhook retry problem?
Start with health_status, failing_streak and failing_since, then read recorded failure alerts from the destination activity endpoint; those alerts are distinct from individual delivery attempts. A first-attempt failure can increase the streak, and any successful attempt, including a retry or resend, ends the failure streak. A destination is degraded only when it is not failing and an event with a failed attempt in the last 24 hours still has no later successful delivery. Validate the receiver with a sandbox test event before changing production.
Do webhooks cost extra?
The List Webhook Destinations API is documented as pay-per-call, and this estimate includes no webhook delivery total. Billing is per completed check from prepaid credit. A full KYC is $0.33, AML screening is $0.20 and wallet screening is $0.15.
Is HTTPS enough on its own?
No. TLS protects the payload in transit between the sender and your host, and it does nothing about a forged request posted straight at your endpoint or a real payload replayed later. You need HTTPS plus signature verification plus a timestamp window and idempotent acceptance.
What does secret_last4 tell me?
It helps identify a secret. The destination list never returns the full secret, and a matching suffix does not verify the full secret. Read the full secret from the single-destination call or from the Business Console when the destination is created.
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


