How to Secure Event-Driven Architectures With Signed API Events
Secure event flows by creating a Didit session before a sensitive event, subscribing to only the webhooks you act on, verifying the HMAC signature, and treating each decision as idempotent state.

Contents
In this guide
Jump to the part you need.
This guide fits teams running event-driven systems on a broker such as Kafka, Amazon SNS/SQS or RabbitMQ, where a sensitive event has to carry proof of who triggered it. A completed full Didit ID check costs $0.33, and the Workflow Orchestrator and the MCP server are free. The main caveat: Didit secures the identity decision and the signed delivery of that decision, not your broker's own authorization, which stays your job.
Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.
| Step | Didit surface | Published price |
|---|---|---|
| Authenticate API calls | Scoped key on the x-api-key header | No separate price listed in the published price feed |
| Create a verification session | POST /v3/session/ | $0.33 per completed full ID check |
| Add AML screening to the flow | AML Screening, 1,300+ lists | $0.20 per check |
| Keep the decision current | Ongoing AML Monitoring | $0.07 per person per year |
| Receive identity events and check delivery health | Webhook destinations with HMAC-SHA256 signing, and GET /v3/webhook/destinations/ | Webhook destination list calls are billed per call |
Start free in the sandbox at business.didit.me, with no sales call. For developers, connect Didit to an AI assistant through the Didit MCP server, and read the full list on Didit pricing.
Prerequisites before you touch the event flow
- A Didit application with a sandbox key, created in the Business Console under Developers, API keys, or through the programmatic register and verify-email calls.
- A published workflow and its
workflow_id, so the session knows which checks to run. - An HTTPS endpoint that can read a raw request body before any JSON parser touches it.
- A secret store for the destination signing secret and the API key. Both are server-side secrets.
- A written list of which events need identity proof, and which of your services consume them.
Step-by-step method
Step 1: Draw the trust boundary first
Three things stay yours no matter what you integrate: service-to-service authentication between producers and consumers, authorization on who may subscribe to a topic, and encryption of the broker and its stored events. Didit sits at the point where an event needs a verified identity. Write down which event types carry a person or a business, attach the identity decision to those, and leave the rest alone.
One concrete mapping keeps that boundary honest. If the session is approved, a session created with vendor_data set to user-42 produces a status.updated event with status: Approved. Your webhook endpoint verifies the signature, then publishes exactly one internal event, user.verified, carrying vendor_data and event_id. The payout service consumes user.verified, resolves user-42, writes the decision once keyed on event_id, and no other consumer in the broker ever sees the raw Didit payload. Everything downstream reads your event, not Didit's.
Step 2: Create the application and keep the key server side
Keys are scoped to an application. The Primary key has full access; create extra keys for a partner or a service with only the access it needs. New keys start with sk_live_ for a live application or sk_test_ for a sandbox application, followed by 43 URL-safe characters, and older keys without a prefix keep working, so never validate a key by its prefix. The verification API uses the x-api-key header, not an OAuth bearer token. Treat the key as a password and keep it out of browser and mobile bundles. The full flow is documented at API authentication.
Step 3: Create the verification session before the sensitive event is published
The session is the record your event will point at. Create it first, store the returned session id against your own user id, and only then let the event that needs identity proof proceed.
curl -X POST https://verification.didit.me/v3/session/ \
-H "x-api-key: $DIDIT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"workflow_id":"<WORKFLOW_ID>","vendor_data":"user-42","callback":"https://myapp.com/return"}'
Put your own identifier in vendor_data and keep personal data out of it, because that value comes back in every webhook and travels through your event bus. The callback is where the user returns after the flow.
Step 4: Subscribe a webhook destination to only the events you consume
There is no wildcard. List every event family you want, and create several destinations if different services need different families. For an identity-driven flow the usual starting set is status.updated for session decisions, user.status.updated when a person entity becomes ACTIVE, FLAGGED or BLOCKED, business.status.updated for KYB, transaction.created and transaction.status.updated for monitoring, and workflow.compliance_changed when a published workflow's compliance status changes after re-evaluation. Rotating a destination's signing secret sends the old signatures in the -Previous headers for 24 hours so you can deploy the new secret without dropping events.
Step 5: Verify the signature and the timestamp before parsing JSON
Read the raw body first. Didit recommends X-Signature-V2, an HMAC-SHA256 over the sorted, Unicode-preserved canonical JSON of the body, computed with the destination secret. X-Signature is the same HMAC over the exact raw bytes and only works if your stack does not re-encode the body. X-Signature-Simple is deprecated and authenticates the envelope only, so if you fall back to it, re-fetch the decision from GET /v3/session/{session_id}/decision/ instead of trusting the payload. Reject any request where the difference between now and X-Timestamp is more than 300 seconds, compare in constant time, and accept a match on either the current header or its -Previous pair during rotation.
Read the raw request body. Do not parse JSON before signature verification.
Step 6: Treat each decision as state, not as a message
Return 2xx as fast as you can, then update state idempotently keyed on event_id. Status strings are exact and case-sensitive: Not Started, In Progress, Approved, Declined, In Review, Awaiting User, Resubmitted, Expired, Abandoned and Kyc Expired, which uses a single capital K. An approved session moves to Kyc Expired when the verified document's expiry date passes, which is the default expiration mode, and a resubmitted child session in KYB sends its parent back to Awaiting User. A duplicate delivery must not create a second account or a second payout. The lifecycle is documented at verification statuses.

status.updated event.Step 7: Bound your retries and respect 429
Two retry loops exist and they are not the same. Didit retries webhook deliveries on its side, using the bounded retries described in its webhook documentation, and reports the outcome through health_status, failing_streak and the 30-day delivery metrics; a retry that succeeds ends the streak. Your own API calls are a different loop, and that one is yours to bound.
Rate limits apply per identifier, your x-api-key or the client IP, in a 60-second fixed window. Plan capacity around the scopes that matter to an event flow: session-v2-create allows 600 requests a minute for POST /v3/session/, event ingestion on POST /v3/events/ and POST /v3/events/batch/ has its own ingest-write scope at 600 a minute instead of the 300 a minute write ceiling, and reads sit under generic-get at 600 a minute. On a 429, wait at least the Retry-After value, then layer exponential backoff with jitter, stop after a small ceiling such as 5 attempts, and use one key per workload so one noisy service cannot starve the rest. Do not put a second retry loop behind the webhook handler that re-runs side effects; make the handler idempotent instead.
| Scope | Endpoint | Limit |
|---|---|---|
session-v2-create | POST /v3/session/ | 600 per minute |
ingest-write | POST /v3/events/, POST /v3/events/batch/, POST /v3/transactions/ | 600 per minute |
generic-write | Other POST, PATCH and DELETE calls | 300 per minute |
generic-get | GET calls, including GET /v3/session/{id}/decision/ | 600 per minute |
Step 8: Operate with continuous assurance, not a launch checklist
Read your destinations on a schedule and alert on the health field rather than on raw volume. The list call returns health_status, failing_streak, failing_since, 30-day delivery metrics and 30 daily points per destination, and it never returns the signing secret, only secret_last4. failing means 3 or more consecutive events failed their first delivery attempt since the destination last answered successfully, degraded means an attempt failed in the last 24 hours and no later attempt delivered that event, and healthy is everything else.
curl -X GET "https://verification.didit.me/v3/webhook/destinations/" \
-H "x-api-key: $DIDIT_API_KEY"
The operation that carries a price here is the read, not the setup. The List Webhook Destinations API is documented as pay per call, so a poll every minute across several destinations is real spend. Pick an interval you can defend, and call GET /v3/webhook/destinations/{destination_uuid}/ only when you need a destination's full delivery summary or its secret.
Pair that with the destination failure activity feed, which lists recorded failure alerts newest first with occurred_at and failure_count. For the compliance side of the same flow, AML Screening covers 1,300+ lists at $0.20 per check, and Ongoing AML Monitoring keeps each person screened at $0.07 per person per year, so ongoing monitoring keeps an approval current as lists move.

Declined or In Review status your event consumer will see.Expected output
A successful destination produces a signed envelope. This is the documented session shape, with the decision object present only for Approved, Declined, In Review and Abandoned:
{
"event_id": "uuid",
"session_id": "uuid",
"status": "Approved",
"webhook_type": "status.updated",
"created_at": 1627680000,
"timestamp": 1627680000,
"application_id": "uuid",
"environment": "live",
"workflow_id": "uuid",
"workflow_version": 1,
"vendor_data": "your-internal-user-id",
"metadata": { "user_type": "premium" },
"decision": { }
}
Match session_id to the session you created, match vendor_data to your own user, and read status as the state. The decision object mirrors GET /v3/session/decision/, with per-feature results in plural arrays such as id_verifications, liveness_checks, face_matches and aml_screenings. Sandbox sessions carry environment set to sandbox and an optional sandbox_scenario slug.
Failure cases and recovery
| Failure | Signal | Recovery |
|---|---|---|
| Wrong, malformed, revoked or expired key | 401 with Authentication credentials were not provided or are invalid, or This API key has expired | Re-fetch a key through the recover-key flow or create a new key, then retry |
| No key, key without access, or use from outside the key's IP list | 403, including This API key can't be used from this IP address | Use a key with that access, from an allowed address |
| Check could not be paid for | 402, or 403 with insufficient_credits, or a 400 on session create | Top up the balance, then retry |
| Signature mismatch or stale timestamp | Your verification fails locally | Reject and log. Confirm you read the raw body, that the secret matches the destination, and that X-Timestamp is within 300 seconds |
| Destination stopped answering | health_status of degraded then failing | Fix the endpoint, then reconcile pending sessions with GET /v3/session/{session_id}/decision/ |
| Rate limit | 429 with Retry-After and a reference value | Wait out Retry-After, back off with jitter, stop after your retry ceiling, save the reference when reporting |
| Reused idempotency key or a step that already ran | 409 | Read the code, reload the current state, and do not repeat the write |
| Application was deleted | 403 with application_deleted | Do not retry. The application and its keys no longer exist |
Inputs and outputs
| Item | Direction | What it does |
|---|---|---|
DIDIT_API_KEY | Input | Scoped secret sent in the x-api-key header on every verification API call |
workflow_id | Input | Selects the checks the session runs |
vendor_data | Input and output | Your internal identifier, echoed in every webhook |
callback | Input | Where the user returns after the flow |
| Destination signing secret | Input | Key for the HMAC-SHA256 signature check |
session_id | Output | Joins your record to every event about that verification |
status | Output | The exact state string your consumer writes |
decision | Output | Per-feature results, present on final and review statuses |
health_status | Output | Delivery state per destination: healthy, degraded or failing |
Paid steps and review boundaries
Most of this flow carries no charge, but the checks that run and a few operations around them are metered. Session creation bills the checks in the workflow per completed check: a full ID check is $0.33, AML Screening is $0.20 per check, and Wallet Screening inside Transaction Monitoring is $0.15 per screening, while Transaction Monitoring itself is $0.001 per transaction beyond the plan's monthly allowance. The Workflow Orchestrator, Reusable KYC and the MCP server are free. Webhook destination list calls are billed per call, so put that monitoring poll in your budget alongside the checks. Sandbox checks are mocked and unlimited.
Human review is a separate boundary. Automated checks drive most moves, but In Review means warnings need a person and Declined means a check failed. A reviewer approves, declines or requests resubmission in the Business Console, and the Investigator Agent can write a report on an item before a person decides. Plan review capacity, not just per-check spend. Never let automation overwrite a reviewer's decision, and remember that an approval can later become Kyc Expired.

Worked cost example
Take 10,000 new users a month, each running a full ID check plus AML screening. The compliance bundle is $0.33 + $0.20 = $0.53 per user, so 10,000 x $0.53 = $5,300. Suppose 2,000 of those users withdraw crypto and each withdrawal is screened once: 2,000 x $0.15 = $300. The month totals $5,300 + $300 = $5,600 at list price. On Growth the Didit prices are 4% lower: $5,300 x 0.96 = $5,088 and $300 x 0.96 = $288, so $5,376. On Scale, 10% lower: $5,300 x 0.90 = $4,770 and $300 x 0.90 = $270, so $5,040. Add the destination list calls you actually make on top of that. The sandbox run of the same flow costs $0.
Sources
- Didit docs: API authentication
- Didit docs: webhooks, HMAC signing and retries
- Didit docs: verification statuses and session lifecycle
- Didit docs: API errors, status codes and retry safety
- Didit docs: rate limiting, scopes and 429 backoff
- Didit docs: list webhook destinations
- Didit docs: webhook destination failure activity
- Didit pricing and pricing.json, read November 26, 2026
- Didit MCP server
- Didit AML Screening product page
- Didit Transaction Monitoring product page
The next step is the sandbox: create an application at business.didit.me, copy the sk_test_ key, run the session call above, and watch the signed event arrive at your endpoint. No sales call is needed to start.
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
How do I secure an event-driven architecture with Didit?
Create a Didit verification session before a sensitive event is published, keep the API key server side, and subscribe a webhook destination to the events your consumers act on. Verify the HMAC signature and the 300-second timestamp window before parsing, then write state idempotently on the exact status string. Didit handles the identity decision and its signed delivery; your broker still handles service authentication, topic authorization and encryption.
What is an API security event?
An API security event is a recorded action that changes your security posture or your knowledge of a party, such as a verification status change, a refused API key or a failed webhook delivery. In Didit, the signed webhook families status.updated, user.status.updated, transaction.created and travel_rule.status.updated are the security events you subscribe to, and the destination activity feed records delivery failures. There is no wildcard, so you list every family you want.
What should an API security day cover?
A one-day review should walk the whole event path: rotate or re-scope API keys, rehearse secret rotation with the -Previous signature headers, replay a stale timestamp and a tampered body to prove they are rejected, and read health_status plus 30-day error rates on every destination. Confirm your 429 handling honours Retry-After and your retry ceiling. Close by listing which event types carry identity proof and which do not.
What is API-driven authentication?
API-driven authentication means the sign-in decision is made by an API call rather than by a password your app stores. Didit Biometric Authentication is $0.10 per auth and is called server side with the same x-api-key header, so the result arrives as a decision you can attach to an event. The first 50,000 authentication active users each month are free.
What does continuous assurance mean for API security?
Continuous assurance means your controls keep reporting after go-live instead of being checked once at launch. In Didit that means the 30-day delivery metrics and health_status on each webhook destination, the destination failure activity feed, Ongoing AML Monitoring at $0.07 per person per year, and the workflow.compliance_changed event when a published workflow's compliance status changes after re-evaluation. Screening lists and obligations such as those set by FATF keep moving, so the checks have to keep running.
Does Didit sign its webhooks?
Yes. Didit sends X-Signature-V2, an HMAC-SHA256 over the sorted canonical JSON of the body, plus X-Timestamp in Unix seconds. X-Signature covers the exact raw bytes, and X-Signature-Simple is a deprecated envelope-only fallback. Reject anything older than 300 seconds and compare in constant time, accepting the -Previous headers for 24 hours after a secret rotation.
What happens if my webhook endpoint is down?
Didit retries the delivery, and the destination's health_status moves to degraded after a failed attempt in the last 24 hours and to failing after 3 or more consecutive events failed their first delivery attempt. Retries do not add to failing_streak, and any successful attempt, including a resend, ends the streak. Return 2xx quickly, finish the work asynchronously, and reconcile with GET /v3/session/{session_id}/decision/.
Are Didit webhook destinations free?
Listing them is not. The List Webhook Destinations API is documented as pay per call, so every read of GET /v3/webhook/destinations/ costs and a tight monitoring loop across several destinations adds up. Budget the poll interval the way you budget the checks themselves, and read one destination only when you need its delivery summary or its secret.
How much does it cost to add identity checks to an event flow?
A full ID check is $0.33 and AML Screening is $0.20 per check, so a KYC plus AML flow is $0.53 per user, which makes 10,000 users a month $5,300 at list price, or $5,088 on Growth with its 4% discount. Ongoing AML Monitoring adds $0.07 per person per year. The Workflow Orchestrator, Reusable KYC and the MCP server are free, and webhook destination list calls are billed per call.
Can I test this in the sandbox for free?
Yes. Create an application with a work email and use the sk_test_ key as DIDIT_API_KEY. Sandbox checks are mocked and unlimited, and the webhook envelope carries environment set to sandbox with an optional sandbox_scenario. Switch to the sk_live_ key only when the organization has credit.
Where does a human review fit in an automated event flow?
Automated checks drive most status moves, but In Review means warnings need a person and Declined means a check failed, with resubmission possible when the issue is fixable. A reviewer approves, declines or requests resubmission in the Business Console, and your consumer writes whichever state the reviewer chose. Treat Approved as final until the verified document expires and the session moves to Kyc Expired.
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


