Working with Webhooks
This guide explains how to register webhooks, handle incoming webhook events, and understand the custom headers and payloads provided by the Diligent AI API.1. Registering and managing webhooks
You can register multiple webhooks (up to 10), each with its own URL, secret, and event filter — for example a production endpoint, a staging endpoint, and a data-warehouse ingester. When an event occurs, Diligent delivers it to every active webhook whose filter includes that event type. Webhooks are managed with a standard CRUD API:| Method & path | Purpose |
|---|---|
POST /webhooks | Create a webhook |
GET /webhooks | List all your webhooks |
GET /webhooks/{webhook_id} | Get a single webhook |
PATCH /webhooks/{webhook_id} | Update a webhook |
DELETE /webhooks/{webhook_id} | Delete a webhook (delivery stops at once) |
POST /webhooks always creates a new webhook. To change an existing one, use PATCH /webhooks/{webhook_id} — re-posting will not update it.id and a has_secret flag (the secret itself is never returned):
secret to keep it, send "" to remove it, or send a new value to replace it:
DELETE /webhooks/{webhook_id} returns 204 and delivery to that endpoint stops immediately.
Per-webhook event filtering: each webhook only receives the event types listed in its events array, so different endpoints can subscribe to different events. The supported types are:
cdd_state_changed: Triggered when the state of a CDD changes to inconclusive or complete.monitoring_alert_fired: Triggered when a monitoring alert is fired on failure.cdd_document_fetched: Triggered when a new document is successfully added to a CDD case.search_completed: Triggered when a name screening search completes and results are available.alert_remediated: Triggered when a name screening alert has been remediated (all hits resolved).flow_run_completed: Triggered when a flow run finishes successfully (COMPLETED).flow_run_failed: Triggered when a flow run fails (FAILED).
2. Receiving Webhooks
When an event occurs, Diligent AI sends an HTTPS POST request to your registered endpoint.Custom Headers
Each webhook request includes custom headers to help you identify and verify the event:| Header | Description |
|---|---|
| Content-Type | Always application/json |
| User-Agent | Sender identifier (e.g., DiligentAI/1.0) |
| X-Webhook-Id | Unique ID of your webhook |
| X-Event-Id | Unique ID of this delivery event |
| X-Customer-Id | Your customer ID |
| X-Target-type | Entity type (CDD, MONITORING_ALERT, NAME_SCREENING_SEARCH, NAME_SCREENING_ALERT, or FLOW_RUN) |
| X-Event-Name | Name of the triggered event (CDD_STATE_CHANGED, MONITORING_ALERT_FIRED, SEARCH_COMPLETED, CDD_DOCUMENT_FETCHED, ALERT_REMEDIATED, FLOW_RUN_COMPLETED, FLOW_RUN_FAILED) |
| X-Signature | HMAC signature for authenticity |
Example Payloads
cdd_state_changed
payload: Full CDD object (see CDD Object).
monitoring_alert_fired
payload: Alert object with details about the triggered alert.
cdd_document_fetched
payload: Full CDD object snapshot including all documents (see CDD Object).
search_completed
payload: Full search object with hits and remediation details.
alert_remediated
payload: Full alert object. See Get Alert for the complete schema reference.- Each hit contains
evidenceswithsupporting_facts— the specific facts that drove the resolution decision, each withpredicate,value, and acitationsarray indicating the data source (HIT,PROFILE,ARTICLE,REGISTRY, orWEB_SEARCH).
flow_run_completed
payload: Full flow run object — the same shape returned byGET /v1/flow-runs/{runId}.- Delivered only when the run status transitions to
COMPLETED(not on intermediate states such asQUEUEDorRUNNING).
flow_run_failed
payload: Full flow run object — the same shape returned byGET /v1/flow-runs/{runId}.- Delivered only when the run status transitions to
FAILED. CANCELLEDruns do not trigger either flow run webhook event.
3. Webhook Flow Diagram
Below is a simple flow of how a webhook is triggered and received:- Diligent AI triggers the webhook when an event occurs.
- Your server receives a POST request with custom headers and event payload.
- Your server should process the event and return a 200 OK status to acknowledge receipt.