Skip to main content
Search...C
Webhooks

Create Webhook

Creates a new webhook endpoint that will receive HTTP POST requests when specified events occur. All webhook deliveries include a signature header for verification.

Endpoint

POST/api/v1/webhooks

Request Body

NameTypeDescription
urlrequiredstringThe URL that will receive webhook events
eventsrequiredstring[]Array of event types to subscribe to
descriptionstringOptional description for this webhook
activebooleanWhether the webhook is active (default: true)

Response

Returns the created webhook object including its unique ID and secret for signature verification.

Response Schema
{
  "id": "wh_abc123",
  "url": "https://yourapp.com/webhooks/adbuy",
  "events": ["lead.created", "lead.updated"],
  "description": "My webhook endpoint",
  "active": true,
  "secret": "whsec_xxxxxxxxxxxxxxxxxxxxxxxx",
  "created_at": "2024-01-15T10:30:00Z"
}

Important: The secret is only returned when the webhook is created. Store it securely as you'll need it to verify webhook signatures.

Example

cURL
curl -X POST "https://api.adbuy.ai/api/v1/webhooks" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://yourapp.com/webhooks/adbuy",
    "events": ["lead.created", "lead.updated"],
    "description": "Production webhook"
  }'

Event Types

Available events you can subscribe to:

EventDescription
lead.createdA new lead was created
lead.updatedA lead was updated
lead.convertedA lead was marked as converted
campaign.startedA campaign was activated
campaign.pausedA campaign was paused