curl --request POST \
--url https://api.cal.id/webhook/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriberUrl": "https://example.com/webhooks/calid",
"eventTriggers": [
"BOOKING_CREATED"
],
"active": true
}
'import requests
url = "https://api.cal.id/webhook/"
payload = {
"subscriberUrl": "https://example.com/webhooks/calid",
"eventTriggers": ["BOOKING_CREATED"],
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriberUrl: 'https://example.com/webhooks/calid',
eventTriggers: ['BOOKING_CREATED'],
active: true
})
};
fetch('https://api.cal.id/webhook/', 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.cal.id/webhook/",
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([
'subscriberUrl' => 'https://example.com/webhooks/calid',
'eventTriggers' => [
'BOOKING_CREATED'
],
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cal.id/webhook/"
payload := strings.NewReader("{\n \"subscriberUrl\": \"https://example.com/webhooks/calid\",\n \"eventTriggers\": [\n \"BOOKING_CREATED\"\n ],\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.cal.id/webhook/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriberUrl\": \"https://example.com/webhooks/calid\",\n \"eventTriggers\": [\n \"BOOKING_CREATED\"\n ],\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.id/webhook/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriberUrl\": \"https://example.com/webhooks/calid\",\n \"eventTriggers\": [\n \"BOOKING_CREATED\"\n ],\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"payloadTemplate": null,
"platformOAuthClientId": null,
"id": "wh_6f0c2a3b8d41",
"eventTriggers": [
"BOOKING_CREATED",
"BOOKING_RESCHEDULED",
"BOOKING_CANCELLED"
],
"subscriberUrl": "https://hooks.example.com/cal-id/bookings",
"active": true,
"secret": "whsec_2f8c41d7b93e4a06"
},
"message": "Webhook created"
}{
"success": false,
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"message": "Rate limit exceeded",
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Too many requests. Please retry after the rate limit window resets."
}
}Create a webhook
Registers a webhook so Cal ID POSTs to your subscriberUrl whenever one of the events you list in eventTriggers occurs — BOOKING_CREATED, BOOKING_RESCHEDULED, BOOKING_CANCELLED, BOOKING_REQUESTED, BOOKING_PAID and BOOKING_PAYMENT_INITIATED. Supply a secret so deliveries are signed, and an optional payloadTemplate to reshape the body your endpoint receives. The stored subscription is returned including its generated id. Requires Content-Type: application/json.
curl --request POST \
--url https://api.cal.id/webhook/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriberUrl": "https://example.com/webhooks/calid",
"eventTriggers": [
"BOOKING_CREATED"
],
"active": true
}
'import requests
url = "https://api.cal.id/webhook/"
payload = {
"subscriberUrl": "https://example.com/webhooks/calid",
"eventTriggers": ["BOOKING_CREATED"],
"active": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriberUrl: 'https://example.com/webhooks/calid',
eventTriggers: ['BOOKING_CREATED'],
active: true
})
};
fetch('https://api.cal.id/webhook/', 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.cal.id/webhook/",
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([
'subscriberUrl' => 'https://example.com/webhooks/calid',
'eventTriggers' => [
'BOOKING_CREATED'
],
'active' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.cal.id/webhook/"
payload := strings.NewReader("{\n \"subscriberUrl\": \"https://example.com/webhooks/calid\",\n \"eventTriggers\": [\n \"BOOKING_CREATED\"\n ],\n \"active\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.cal.id/webhook/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriberUrl\": \"https://example.com/webhooks/calid\",\n \"eventTriggers\": [\n \"BOOKING_CREATED\"\n ],\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cal.id/webhook/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriberUrl\": \"https://example.com/webhooks/calid\",\n \"eventTriggers\": [\n \"BOOKING_CREATED\"\n ],\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"payloadTemplate": null,
"platformOAuthClientId": null,
"id": "wh_6f0c2a3b8d41",
"eventTriggers": [
"BOOKING_CREATED",
"BOOKING_RESCHEDULED",
"BOOKING_CANCELLED"
],
"subscriberUrl": "https://hooks.example.com/cal-id/bookings",
"active": true,
"secret": "whsec_2f8c41d7b93e4a06"
},
"message": "Webhook created"
}{
"success": false,
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}{
"success": false,
"message": "Rate limit exceeded",
"error": {
"code": "TOO_MANY_REQUESTS",
"message": "Too many requests. Please retry after the rate limit window resets."
}
}Authorizations
Use the Authorization header with Bearer scheme.
Examples:
- API Key: Authorization: Bearer calid_xxxxx
Body
Webhook events that should trigger delivery.
BOOKING_CREATED, BOOKING_PAYMENT_INITIATED, BOOKING_PAID, BOOKING_RESCHEDULED, BOOKING_REQUESTED, BOOKING_CANCELLED, BOOKING_REJECTED, BOOKING_NO_SHOW_UPDATED, FORM_SUBMITTED, OOO_CREATED ["BOOKING_CREATED"]
Destination URL that receives webhook requests.
"https://example.com/webhooks/calid"
Optional custom payload template delivered to the subscriber.
"{\"event\":\"BOOKING_CREATED\",\"bookingId\":\"bk_123\"}"
Whether this webhook is currently enabled.
true
Optional shared secret used to sign webhook payloads.
"whsec_1234567890"
Was this page helpful?