Create Webhook
curl --request POST \
--url https://api.example.com/v1/webhooks \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [
{}
],
"description": "<string>",
"active": true
}
'import requests
url = "https://api.example.com/v1/webhooks"
payload = {
"url": "<string>",
"events": [{}],
"description": "<string>",
"active": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', events: [{}], description: '<string>', active: true})
};
fetch('https://api.example.com/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'events' => [
[
]
],
'description' => '<string>',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n {}\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/webhooks")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n {}\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [\n {}\n ],\n \"description\": \"<string>\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"webhook": {
"id": "<string>",
"url": "<string>",
"events": [
{}
],
"description": "<string>",
"active": true,
"secret": "<string>",
"created_at": "<string>"
}
}
}Webhooks
Create Webhook
Register a new webhook endpoint and receive its signing secret
POST
/
v1
/
webhooks
Create Webhook
curl --request POST \
--url https://api.example.com/v1/webhooks \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"events": [
{}
],
"description": "<string>",
"active": true
}
'import requests
url = "https://api.example.com/v1/webhooks"
payload = {
"url": "<string>",
"events": [{}],
"description": "<string>",
"active": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', events: [{}], description: '<string>', active: true})
};
fetch('https://api.example.com/v1/webhooks', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/webhooks",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'events' => [
[
]
],
'description' => '<string>',
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/webhooks"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"events\": [\n {}\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/webhooks")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"events\": [\n {}\n ],\n \"description\": \"<string>\",\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"events\": [\n {}\n ],\n \"description\": \"<string>\",\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"webhook": {
"id": "<string>",
"url": "<string>",
"events": [
{}
],
"description": "<string>",
"active": true,
"secret": "<string>",
"created_at": "<string>"
}
}
}Request
Headers
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
Requires an API key with the
webhooks:write permission.Body Parameters
string
required
HTTPS URL that will receive event deliveries. Must start with
https://. URLs that resolve to private IP ranges are rejected (SSRF protection).array
required
Array of event type strings to subscribe to. See Webhooks for the full list of 28 supported events.
string
Optional human-readable description (max 200 chars).
boolean
default:"true"
Whether the webhook should be active immediately. Set to
false to register but pause deliveries.Response
The
secret field is returned only once — at creation time. Store it in a secure secret manager immediately. It cannot be retrieved later; if lost, delete and recreate the webhook to rotate.object
Show properties
Show properties
curl -X POST https://data.leadlex.com/functions/v1/api-gateway/v1/webhooks \
-H "Authorization: Bearer wbk_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/leadlex/webhook",
"events": ["contact.created", "deal.updated"],
"description": "Production CRM sync",
"active": true
}'
import requests
API_KEY = "wbk_your_api_key_here"
BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"
response = requests.post(
f"{BASE_URL}/v1/webhooks",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"url": "https://example.com/leadlex/webhook",
"events": ["contact.created", "deal.updated"],
"description": "Production CRM sync",
"active": True,
},
)
webhook = response.json()["data"]["webhook"]
print("SAVE THIS SECRET:", webhook["secret"]) # shown ONCE
const response = await fetch(
'https://data.leadlex.com/functions/v1/api-gateway/v1/webhooks',
{
method: 'POST',
headers: {
'Authorization': 'Bearer wbk_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com/leadlex/webhook',
events: ['contact.created', 'deal.updated'],
description: 'Production CRM sync',
active: true,
}),
}
);
const { data } = await response.json();
console.log('SAVE THIS SECRET:', data.webhook.secret); // shown ONCE
Example Response
{
"data": {
"webhook": {
"id": "7f3c4d2a-1b8e-4a9c-9d6f-2e5b8c7a1f3d",
"url": "https://example.com/leadlex/webhook",
"events": ["contact.created", "deal.updated"],
"description": "Production CRM sync",
"active": true,
"secret": "whsec_9a8b7c6d5e4f3a2b1c0d9e8f7a6b5c4d3e2f1a0b9c8d7e6f",
"created_at": "2026-04-17T14:23:05Z"
}
}
}
Errors
| Status | Code | Description |
|---|---|---|
| 400 | invalid_url | URL is not HTTPS, is malformed, or resolves to a private IP range |
| 400 | invalid_events | One or more event names are not recognized |
| 400 | missing_required_field | url or events is missing |
| 401 | invalid_key | Invalid or expired API key |
| 403 | insufficient_permissions | Missing webhooks:write permission |
| 409 | duplicate_webhook | A webhook with this URL already exists |
| 429 | rate_limited | Rate limit exceeded |