Skip to main content

What is a webhook?

ChainPatrol uses webhooks to notify you about changes to our global blocklist. This allows you to update your blocklist in real-time, without having to wait for a scheduled cron job to run. This is especially useful if you opt to use our Asset List endpoint to sync our data as you can update your blocklist as soon as we update ours.

Managing Webhooks

You can manage your webhooks through the ChainPatrol dashboard under Developer › Webhooks in the sidebar. From here you can:
  1. Create new webhooks
  2. View and monitor webhook deliveries
  3. Test webhooks with sample events
  4. Enable/disable webhooks
  5. Update webhook configurations
  6. Delete webhooks
Each webhook delivery is logged and can be inspected for debugging purposes, including the full request and response details.

Event Types

debug.test

This event is used for testing your webhook endpoint. It is sent when you click the “Test” button for a webhook in the dashboard.

asset.status-updated

This event is sent when the status of an asset changes. The status field can be one of BLOCKED, ALLOWED, or UNKNOWN.

asset.status-escalated

This event is sent when ChainPatrol escalates a threat to your organization for review. Subscribe to it to find out when something needs a decision from your team, for example to open a ticket or ping an on-call channel. It fires when:
  • A ChainPatrol analyst passes a proposal to your organization for review.
  • Your organization has Obligatory Admin Approval enabled and an analyst approves a proposal. The proposal then waits for your organization’s final approval.
It is not sent when a proposal is escalated internally within the ChainPatrol team. It is also not sent for items moved into your review queue in bulk when Obligatory Admin Approval is first turned on.
If a proposal is escalated to your organization more than once, you receive an event each time. Use proposal_id to deduplicate.

asset.escalation-resolved

This event is the counterpart of asset.status-escalated. It is sent once when a threat that was escalated to your organization no longer needs your review, so you can close whatever you opened when the escalation arrived. It fires when:
  • Someone in your organization approves, rejects, or watchlists the proposal, or passes it back to the ChainPatrol team.
  • ChainPatrol resolves the escalation on your behalf, for example when an analyst pushes the proposal through while it is still waiting on you.
It is not sent for reviews that leave the proposal waiting on your organization.
The payload does not include the asset’s status. Approving a proposal blocks the asset shortly afterwards rather than immediately, so subscribe to asset.status-updated if you need the final status.

organization.threat-detection-added

This event is sent when a new suspected threat is added to the Suspected Threats page for your organization. A suspected threat is unconfirmed until it is reviewed. The event name and the threat_detection_result_id key keep the API’s detection naming.

audit-log.created

This event is sent when an action is recorded in your organization’s Audit Log, such as a brand being edited, a member being added or removed, or an API key being created. It carries what your admins see on the Audit Log page. Use it to stream those changes into a SIEM.

Takedown events

Takedown events tell you what ChainPatrol is doing on your organization’s takedowns: when a takedown is filed with a provider, when the provider replies, and when the takedown completes, is cancelled, or is waiting on something. Use them to keep a ticket or dashboard in sync without logging in to the dashboard. Every takedown event carries these fields in data, plus the event-specific fields listed under each event:

takedown.filed

This event is sent each time ChainPatrol files a takedown with a provider, such as a hosting provider, registrar, or platform. A takedown can be filed with several providers, and filed again with the same provider, so you can receive this event more than once for one takedown.

takedown.provider-replied

This event is sent when a provider replies by email about a takedown. It is also sent when the ChainPatrol team links a reply to a takedown by hand after it arrived. The event tells you a reply arrived. It does not include the reply itself; open url to read it in the dashboard.

takedown.completed

This event is sent when a takedown moves to COMPLETED, meaning the provider removed the asset. If a completed takedown is reopened and completes again, you receive the event again.

takedown.unactionable

This event is sent when a takedown moves to CANCELLED, meaning ChainPatrol won’t act on it, for example because the asset turned out to be legitimate or a duplicate.

takedown.awaiting-input

This event is sent when a takedown moves to PENDING_EVIDENCE or PENDING_INPUT. ChainPatrol still intends to act on it, but something is missing first, such as more evidence or a decision from your team. See Takedown Statuses for when each status is used.
For takedown.completed, takedown.unactionable, and takedown.awaiting-input, status is the status the takedown moved to when the event happened. The takedown may have changed status again by the time you receive the event.

Webhook Configuration

When creating a webhook, you’ll need to provide:
  1. An HTTPS endpoint URL that will receive the webhook events
  2. An optional description to help identify the webhook’s purpose
  3. The events you want to receive (available events include asset.status-updated, asset.status-escalated, asset.escalation-resolved, organization.threat-detection-added, audit-log.created, and the takedown events takedown.filed, takedown.provider-replied, takedown.completed, takedown.unactionable, and takedown.awaiting-input)
  4. Optional HTTP headers for supported integrations (currently Google SecOps headers are available)
The webhook secret will be automatically generated and shown to you once when creating the webhook. Make sure to copy it as it won’t be displayed again.

Custom HTTP Headers

ChainPatrol supports specific hardcoded HTTP headers that can be configured for webhook requests. Currently, the following headers are available for Google SecOps integration:
  • X-goog-api-key: Your Google API key
  • X-Webhook-Access-Key: Your webhook access key
When configuring a webhook for Google SecOps, you can provide values for these headers, and they will be automatically included in all webhook requests sent to your endpoint, allowing Google SecOps to authenticate and process the webhook events.

Signature Verification

ChainPatrol signs each webhook request with a signature to verify that the request originated from ChainPatrol. The signature is included in the X-ChainPatrol-Signature header of each request. The signature is computed by taking the SHA256 HMAC of the request body using your webhook secret as the key. The signature is encoded as a hex string.
You can verify the signature of a request by computing the signature yourself and comparing it to the signature included in the request. If the two signatures match, then you can be sure that the request originated from ChainPatrol. Here’s an example of how to verify the signature in Node.js:

Delivery Status and Retries

Each webhook delivery attempt is logged with one of the following statuses:
  • PENDING: The delivery is queued
  • IN_PROGRESS: The delivery is being attempted
  • SUCCESS: The delivery was successful (received 2xx response)
  • FAILURE: The delivery failed
A delivery is retried only when ChainPatrol couldn’t reach your endpoint at all, for example if the connection was refused. In that case it is retried up to 3 times. Once your endpoint answers, the delivery is not retried, whatever the answer:
  • A 2xx status code is recorded as SUCCESS.
  • Any other status code is recorded as FAILURE. Redirects (3xx) are not followed, so set the webhook URL to the final address.
  • If your endpoint doesn’t answer within 30 seconds, the delivery is recorded as FAILURE and not retried, because your endpoint may already have processed it.
You can view the delivery status, payload, request, and response details for each webhook attempt in the dashboard.

Security

Webhooks are sent over HTTPS and are signed with a secret that is unique to your account. You should:
  1. Only use HTTPS endpoints
  2. Keep your webhook secret secure and never commit it to version control
  3. Always verify the signature of incoming webhooks
  4. Contact us immediately if you suspect your webhook secret has been compromised
If you need to rotate your webhook secret, you can delete the existing webhook and create a new one with the same configuration.