Developer's Guide: Dynamic AML Policy Enforcement with Webhooks
Learn how to implement webhooks for real-time, dynamic AML policy enforcement. This guide covers signature verification, data retention, and how Didit's modular, AI-native platform streamlines compliance and fraud prevention.

Contents
In this guide
Jump to the part you need.
Real-time ComplianceWebhooks enable instant notification of identity verification outcomes, crucial for dynamic AML policy enforcement and rapid response to risk changes.
Enhanced SecurityImplementing robust signature verification (HMAC-SHA256) is paramount to ensure the authenticity and integrity of webhook payloads, preventing tampering and spoofing.
Data Privacy & RetentionEffective data retention policies, configurable within platforms like Didit, are vital for GDPR compliance and managing sensitive user data responsibly, allowing for flexible storage options.
Didit's AdvantageDidit provides a developer-first approach with secure webhooks, configurable data retention, and a modular architecture for seamless integration, offering Core KYC and AI-native tools for advanced AML Screening & Monitoring.
The Power of Webhooks in AML Compliance
In the rapidly evolving landscape of financial regulations and anti-money laundering (AML) requirements, static compliance checks are no longer sufficient. Businesses need dynamic systems that can react in real-time to new information and emerging threats. Webhooks are a game-changer in this regard, providing an automated, event-driven mechanism to enforce AML policies as soon as identity verification results are available.
Instead of constantly polling an API for updates, webhooks push notifications to your application whenever a significant event occurs, such as the completion of an identity verification session or a change in a user's risk profile. This real-time capability allows for immediate action, whether it's flagging a suspicious transaction, updating a user's compliance status, or triggering further investigation. For businesses leveraging Didit's AML Screening & Monitoring, webhooks ensure that any high-risk matches or watchlist alerts are instantly communicated, enabling swift and decisive action.
Implementing webhooks effectively means your system can stay agile, reducing the window of opportunity for illicit activities and ensuring continuous compliance with regulatory mandates. This proactive approach minimizes manual intervention, reduces operational costs, and significantly strengthens your overall fraud prevention strategy.
Implementing Secure Webhooks: A Developer's Checklist
While the benefits of webhooks are clear, their implementation requires careful attention to security and reliability. Here's a developer's checklist for building a robust webhook endpoint:
-
Dedicated Endpoint: Create a dedicated POST endpoint (e.g.,
/api/webhooks/didit) in your application specifically for receiving webhook payloads. This keeps your architecture clean and focused. -
Raw Body Processing: Crucially, your endpoint must read the raw request body before any JSON parsing. This is essential for signature verification, as parsing can alter the body's format, invalidating the signature.
-
HMAC-SHA256 Signature Verification: This is your primary defense against spoofed or tampered payloads. Didit, for instance, sends a signature in the
X-Signatureheader. You must compute your own HMAC-SHA256 hash of the raw payload using the shared secret key provided by Didit (retrievable via the management API'sGET /v3/webhook/endpoint) and compare it to the received signature. If they don't match, the payload is compromised and should be rejected. -
Timestamp Validation: Webhooks should include a timestamp. Validate that the timestamp is fresh, typically within a 5-minute window, to mitigate replay attacks where old payloads are resent. Didit's V3 API webhook format includes this for enhanced security.
-
Asynchronous Processing: Webhook endpoints should respond quickly (within a few seconds). If processing the payload takes longer, immediately acknowledge receipt with a 2xx HTTP status code and then queue the processing for background tasks. This prevents the sender from retrying the webhook unnecessarily.
-
Idempotency: Design your webhook handler to be idempotent. This means that processing the same webhook payload multiple times (due to retries) should have the same effect as processing it once, preventing duplicate data or unintended side effects.
Didit's developer-first approach provides clear documentation and examples (in Node.js, Python, PHP) for secure webhook integration, ensuring you can confidently process real-time KYC notifications.
Data Retention and Privacy Compliance
Managing data retention is a critical aspect of AML compliance and overall data privacy, especially under regulations like GDPR. As a data controller, you are responsible for defining how long sensitive user data is stored. Didit acts as a data processor, offering flexible controls to help you meet these obligations.
With Didit, you can configure your data retention policy directly within the Business Console, choosing retention windows from 1 month to 10 years, or even unlimited. This policy applies to all verification inputs, outputs, derived results, and operational metadata. This granular control is vital for balancing compliance requirements with the need to minimize data exposure. For enterprise accounts, Didit even offers in-country processing for local data residency, supporting stringent local data protection regimes.
By leveraging webhooks, you can efficiently retrieve verification results and then configure Didit to purge data after a specified period, ensuring you only retain data for as long as legally necessary. This privacy-preserving approach, combined with Didit's secure infrastructure, allows you to build compliant and trustworthy identity verification workflows.
How Didit Helps
Didit is engineered to be the AI-native, developer-first identity platform that simplifies complex AML and KYC challenges. Our modular architecture and clean APIs empower developers to integrate advanced identity verification capabilities with ease. Here's how Didit specifically helps:
- Real-time AML Screening & Monitoring: Didit's robust AML Screening & Monitoring product integrates seamlessly with webhooks, delivering instant alerts for sanctions, PEPs, and adverse media matches. This enables dynamic enforcement of your AML policies, ensuring you're always up-to-date on your users' risk profiles.
- Secure and Reliable Webhooks: Didit provides a secure webhook infrastructure, complete with HMAC-SHA256 signature verification and V3 API payload formats. Our documentation offers practical examples and guidance for rapid integration, ensuring you receive authentic, untampered data for real-time decision-making.
- Configurable Data Retention: Meet your privacy and compliance obligations with Didit's flexible data retention controls. You define how long verification data is stored, supporting GDPR and other data protection regulations.
- Core KYC: Get started with essential identity verification. Didit's Core KYC allows you to implement foundational checks without initial investment, scaling as your needs grow.
- AI-Native and Modular: Our AI-native platform ensures high accuracy in ID Verification, Passive & Active Liveness, and 1:1 Face Match, while the modular design lets you pick and choose the identity primitives you need, creating custom, orchestrated workflows without setup fees.
- Developer-First Experience: With an instant sandbox, comprehensive public documentation, and clean APIs, Didit prioritizes the developer experience, making integration straightforward and efficient.
Ready to Get Started?
Ready to see Didit in action? Get a free demo today.
Start verifying identities for free with Didit's free tier.
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
Blog questions
Who writes the Didit blog?
Which topics does the blog cover?
Is the blog available in my language?
Where do I find product updates?
Are these posts legal advice?
How do I find posts on one topic?
Are posts dated?
Do posts link to the docs?
Is the blog the same as the docs?
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


