POST
/
api
/
v0
/
webhooks
Create a new webhook
curl --request POST \
  --url https://api.devdraft.ai/api/v0/webhooks \
  --header 'Content-Type: application/json' \
  --header 'x-client-secret: <api-key>' \
  --data '{
  "name": "Payment Notifications",
  "url": "https://api.example.com/webhooks/payments",
  "isActive": true,
  "signing_secret": "whsec_123456789",
  "encrypted": false
}'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Payment Notifications",
  "url": "https://api.example.com/webhooks/payments",
  "isActive": true,
  "encrypted": false,
  "created_at": "2024-03-20T12:00:00.000Z",
  "updated_at": "2024-03-20T12:00:00.000Z",
  "delivery_stats": {
    "total_events": 150,
    "successful_deliveries": 145,
    "failed_deliveries": 5,
    "last_delivery": "2024-03-20T11:55:00.000Z"
  }
}

Authorizations

x-client-secret
string
header
required

Your secret API key. Keep this secure and never expose it in client-side code.

Body

application/json

Webhook configuration details

name
string
required

Name of the webhook for identification purposes

Required string length: 3 - 100
Example:

"Payment Notifications"

url
string<uri>
required

URL where webhook events will be sent

Example:

"https://api.example.com/webhooks/payments"

isActive
boolean
default:true
required

Whether the webhook is active and will receive events

Example:

true

encrypted
boolean
default:false
required

Whether webhook payloads should be encrypted

Example:

false

signing_secret
string

Secret key used to sign webhook payloads for verification

Example:

"whsec_123456789"

Response

The webhook has been successfully created.

id
string
required

Unique identifier for the webhook

Example:

"550e8400-e29b-41d4-a716-446655440000"

name
string
required

Name of the webhook

Example:

"Payment Notifications"

url
string
required

URL where webhook events are sent

Example:

"https://api.example.com/webhooks/payments"

isActive
boolean
required

Whether the webhook is currently active

Example:

true

encrypted
boolean
required

Whether webhook payloads are encrypted

Example:

false

created_at
string
required

Timestamp when the webhook was created

Example:

"2024-03-20T12:00:00.000Z"

updated_at
string
required

Timestamp when the webhook was last updated

Example:

"2024-03-20T12:00:00.000Z"

delivery_stats
object
required

Webhook delivery statistics

Example:
{
"total_events": 150,
"successful_deliveries": 145,
"failed_deliveries": 5,
"last_delivery": "2024-03-20T11:55:00.000Z"
}