Create a webhook
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": {
"id": "<string>",
"eventTriggers": [],
"subscriberUrl": "<string>",
"active": true,
"payloadTemplate": "<string>",
"platformOAuthClientId": "<string>",
"secret": "<string>"
},
"message": "<string>",
"meta": {
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"totalPages": 123
}
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Webhook
Create a webhook
Created webhook by id
POST
/
webhook
/
Create a webhook
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": {
"id": "<string>",
"eventTriggers": [],
"subscriberUrl": "<string>",
"active": true,
"payloadTemplate": "<string>",
"platformOAuthClientId": "<string>",
"secret": "<string>"
},
"message": "<string>",
"meta": {
"pagination": {
"page": 123,
"limit": 123,
"total": 123,
"totalPages": 123
}
}
}{
"success": false,
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
}
}Authorizations
Use the Authorization header with Bearer scheme.
Examples:
- API Key: Authorization: Bearer calid_xxxxx
Body
application/json
Webhook events that should trigger delivery.
Available options:
BOOKING_CREATED, BOOKING_PAYMENT_INITIATED, BOOKING_PAID, BOOKING_RESCHEDULED, BOOKING_REQUESTED, BOOKING_CANCELLED, BOOKING_REJECTED, BOOKING_NO_SHOW_UPDATED, FORM_SUBMITTED, OOO_CREATED Example:
["BOOKING_CREATED"]
Destination URL that receives webhook requests.
Example:
"https://example.com/webhooks/calid"
Optional custom payload template delivered to the subscriber.
Example:
"{\"event\":\"BOOKING_CREATED\",\"bookingId\":\"bk_123\"}"
Whether this webhook is currently enabled.
Example:
true
Optional shared secret used to sign webhook payloads.
Example:
"whsec_1234567890"
Related topics
Setting Up Event-Specific WebhooksIntegrating Cal ID with PabblyWebhook in Cal IDWebhook eventsBuild a webhook receiverWas this page helpful?
⌘I