curl --request POST \
--url https://api.lehar.ai/ca/api/v0/webhooks/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"agent_id": "agent_sales_hi",
"url": "https://hooks.example.com/lehar",
"events": [
"call_completed"
],
"headers": {
"Authorization": "Bearer your-receiver-token"
},
"description": "CRM sync"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/webhooks/subscriptions"
payload = {
"agent_id": "agent_sales_hi",
"url": "https://hooks.example.com/lehar",
"events": ["call_completed"],
"headers": { "Authorization": "Bearer your-receiver-token" },
"description": "CRM sync"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: 'agent_sales_hi',
url: 'https://hooks.example.com/lehar',
events: ['call_completed'],
headers: {Authorization: 'Bearer your-receiver-token'},
description: 'CRM sync'
})
};
fetch('https://api.lehar.ai/ca/api/v0/webhooks/subscriptions', 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.lehar.ai/ca/api/v0/webhooks/subscriptions",
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([
'agent_id' => 'agent_sales_hi',
'url' => 'https://hooks.example.com/lehar',
'events' => [
'call_completed'
],
'headers' => [
'Authorization' => 'Bearer your-receiver-token'
],
'description' => 'CRM sync'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/webhooks/subscriptions"
payload := strings.NewReader("{\n \"agent_id\": \"agent_sales_hi\",\n \"url\": \"https://hooks.example.com/lehar\",\n \"events\": [\n \"call_completed\"\n ],\n \"headers\": {\n \"Authorization\": \"Bearer your-receiver-token\"\n },\n \"description\": \"CRM sync\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/webhooks/subscriptions")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agent_sales_hi\",\n \"url\": \"https://hooks.example.com/lehar\",\n \"events\": [\n \"call_completed\"\n ],\n \"headers\": {\n \"Authorization\": \"Bearer your-receiver-token\"\n },\n \"description\": \"CRM sync\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/webhooks/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"agent_sales_hi\",\n \"url\": \"https://hooks.example.com/lehar\",\n \"events\": [\n \"call_completed\"\n ],\n \"headers\": {\n \"Authorization\": \"Bearer your-receiver-token\"\n },\n \"description\": \"CRM sync\"\n}"
response = http.request(request)
puts response.read_body{
"id": "whsub_01EXAMPLE",
"agent_id": "agent_sales_hi",
"url": "https://hooks.example.com/lehar",
"description": "CRM sync",
"events": [
"call_completed"
],
"status": "active",
"payload_format": "native",
"signing_enabled": false,
"header_names": [
"Authorization"
],
"last_delivery_at": null,
"last_error": null,
"created_at": "2026-08-11T09:00:00Z",
"updated_at": "2026-08-11T09:00:00Z"
}Register a webhook endpoint
Per-agent outbound webhook subscription. An agent with no subscription emits nothing. headers are replayed verbatim on every delivery and authenticate it; their values are never returned by any read. Signing is opt-in — signing_secret is returned on create only when signing_enabled is true, and thereafter only from PATCH when a rotate or re-enable mints a new one. Scope api_keys:write.
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/webhooks/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"agent_id": "agent_sales_hi",
"url": "https://hooks.example.com/lehar",
"events": [
"call_completed"
],
"headers": {
"Authorization": "Bearer your-receiver-token"
},
"description": "CRM sync"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/webhooks/subscriptions"
payload = {
"agent_id": "agent_sales_hi",
"url": "https://hooks.example.com/lehar",
"events": ["call_completed"],
"headers": { "Authorization": "Bearer your-receiver-token" },
"description": "CRM sync"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_id: 'agent_sales_hi',
url: 'https://hooks.example.com/lehar',
events: ['call_completed'],
headers: {Authorization: 'Bearer your-receiver-token'},
description: 'CRM sync'
})
};
fetch('https://api.lehar.ai/ca/api/v0/webhooks/subscriptions', 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.lehar.ai/ca/api/v0/webhooks/subscriptions",
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([
'agent_id' => 'agent_sales_hi',
'url' => 'https://hooks.example.com/lehar',
'events' => [
'call_completed'
],
'headers' => [
'Authorization' => 'Bearer your-receiver-token'
],
'description' => 'CRM sync'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.lehar.ai/ca/api/v0/webhooks/subscriptions"
payload := strings.NewReader("{\n \"agent_id\": \"agent_sales_hi\",\n \"url\": \"https://hooks.example.com/lehar\",\n \"events\": [\n \"call_completed\"\n ],\n \"headers\": {\n \"Authorization\": \"Bearer your-receiver-token\"\n },\n \"description\": \"CRM sync\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/webhooks/subscriptions")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agent_sales_hi\",\n \"url\": \"https://hooks.example.com/lehar\",\n \"events\": [\n \"call_completed\"\n ],\n \"headers\": {\n \"Authorization\": \"Bearer your-receiver-token\"\n },\n \"description\": \"CRM sync\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/webhooks/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"agent_sales_hi\",\n \"url\": \"https://hooks.example.com/lehar\",\n \"events\": [\n \"call_completed\"\n ],\n \"headers\": {\n \"Authorization\": \"Bearer your-receiver-token\"\n },\n \"description\": \"CRM sync\"\n}"
response = http.request(request)
puts response.read_body{
"id": "whsub_01EXAMPLE",
"agent_id": "agent_sales_hi",
"url": "https://hooks.example.com/lehar",
"description": "CRM sync",
"events": [
"call_completed"
],
"status": "active",
"payload_format": "native",
"signing_enabled": false,
"header_names": [
"Authorization"
],
"last_delivery_at": null,
"last_error": null,
"created_at": "2026-08-11T09:00:00Z",
"updated_at": "2026-08-11T09:00:00Z"
}Authorizations
Body
The agent whose call events this endpoint receives. Cannot be changed later; delete and recreate to move a subscription.
Absolute https:// URL. Max 2048 chars. Private and loopback addresses are rejected.
Event types to receive. Empty or omitted means all.
call_started, call_completed, recording_completed Static headers sent with every delivery — this is how your endpoint authenticates us. Max 20 headers, 8 KB total. Framing headers (Content-Type, Host, …) and the X-Webhook-* family are reserved. Values are write-only.
Show child attributes
Show child attributes
Also send X-Webhook-Signature / X-Webhook-Timestamp. Off by default: the headers above are the primary authentication.
Delivery wire shape. native (the default) is the documented contract. A custom format is available for integrations that need a different shape — set this to the exact value Lehar provides during integration.
Response
Created. Carries signing_secret only when signing was enabled on this request (PATCH also returns it when it mints one).

