Skip to main content
Get started with Onchain Webhooks in just a few steps. This guide will help you create a webhook subscription via our REST endpoints and receive the events at a target destination.

Prerequisites

You will need:
  • Your CDP API Key ID and secret
  • A server exposed via an HTTPS URL to receive the webhook events
  • cdpcurl installed

Create a webhook subscription

  1. Prepare your subscription configuration:
{
  "description": "KyberSwap Bot USDC Transfers",
  "eventTypes": [
    "onchain.activity.detected",
  ],
  "target": {
    "url": "https://your-webhook-url.com",
    "method": "POST"
  },
  "labels": {
    "contract_address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", # USDC Contract Address
    "event_name": "Transfer",
    "transaction_from": "0xf20d2e37514195ebedb0bc735ba6090ce103d38c" # Transfers that originate from a KyberSwap Bot Wallet
  },
  "isEnabled": true
}
Important configuration notes:
  • target.url should be your webhook endpoint that will receive the events. E.g., your server endpoint.
  • isEnabled can be set to false if you don’t want to immediately receive events.
  • labels requires both a contract_address and event_name field. All other fields (e.g. transaction_from) are optional.
  • eventTypes should follow the three-dot format service.resource.verb.
  • You can also set a headers object in target if your url requires specific headers:
"target": {
    "url": "https://your-webhook-url.com",
    "method": "POST",
    "headers": {
      "custom-header": "value"
    }
},
  1. Create the webhook subscription:
cdpcurl -X POST \
  -i "YOUR_API_KEY_ID" \
  -s "YOUR_API_KEY_SECRET" \
  "https://api.cdp.coinbase.com/platform/v2/data/webhooks/subscriptions" \
  -d '{
  "description": "KyberSwap Bot USDC Transfers",
  "eventTypes": [
    "onchain.activity.detected",
  ],
  "target": {
    "url": "https://your-webhook-url.com",
    "method": "POST"
  },
  "labels": {
    "contract_address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", # USDC Contract Address
    "event_name": "Transfer",
    "transaction_from": "0xf20d2e37514195ebedb0bc735ba6090ce103d38c" # Transfers that originate from a KyberSwap Bot Wallet
  },
  "isEnabled": true
}'
Sample webhook subscription response:
201 Created
{
  "createdAt": "2025-10-08T13:58:38.681893Z",
  "description": "KyberSwap Bot USDC Transfers",
  "eventTypes": [
    "onchain.activity.detected"
  ],
  "isEnabled": true,
  "labels": {
    "project": "<YOUR_CDP_PROJECT_ID>",
    "contract_address": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
    "event_name": "Transfer",
    "transaction_from": "0xf20d2e37514195ebedb0bc735ba6090ce103d38c"
  },
  "metadata": {
    "secret": "<SECRET_FOR_WEBHOOK_VERIFICATION>"
  },
  "subscriptionId": "<YOUR_SUBSCRIPTION_ID>",
  "target": {
    "url": "https://your-webhook-url.com"
  }
}
Once you’ve created the webhook subscription, you can use the subscriptionId from the response to view, update, or delete the subscription. List all subscriptions
cdpcurl -X GET \
  -i "YOUR_API_KEY_ID" \
  -s "YOUR_API_KEY_SECRET" \
  "https://api.cdp.coinbase.com/platform/v2/data/webhooks/subscriptions"
View specified subscription details by subscription ID
cdpcurl -X GET \
  -i "YOUR_API_KEY_ID" \
  -s "YOUR_API_KEY_SECRET" \
  "https://api.cdp.coinbase.com/platform/v2/data/webhooks/subscriptions/<SUBSCRIPTION_ID>"
Update subscription
cdpcurl -X PUT \
  -i "YOUR_API_KEY_ID" \
  -s "YOUR_API_KEY_SECRET" \
  "https://api.cdp.coinbase.com/platform/v2/data/webhooks/subscriptions/<SUBSCRIPTION_ID>" \
  -d '{
    "description": "Updated: KyberSwap Bot USDC Transfers",
    "eventTypes": [
    "onchain.activity.detected",
    ],
    "target": {
      "url": "https://your-webhook-url.com",
      "method": "POST"
    },
    "labels": {},
    "isEnabled": true
  }'
Delete subscription
cdpcurl -X DELETE \
  -i "YOUR_API_KEY_ID" \
  -s "YOUR_API_KEY_SECRET" \
  "https://api.cdp.coinbase.com/platform/v2/data/webhooks/subscriptions/<SUBSCRIPTION_ID>"
I