Create a webhook endpoint
curl --request POST \
--url http://127.0.0.1:8787/v1/webhooks/endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhooks/kayle",
"name": "<string>",
"labels": [
"<string>"
],
"enabled": true,
"subscribed_event_types": [],
"undelivered_payload_retention_hours": 72
}
'import requests
url = "http://127.0.0.1:8787/v1/webhooks/endpoints"
payload = {
"url": "https://example.com/webhooks/kayle",
"name": "<string>",
"labels": ["<string>"],
"enabled": True,
"subscribed_event_types": [],
"undelivered_payload_retention_hours": 72
}
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({
url: 'https://example.com/webhooks/kayle',
name: '<string>',
labels: ['<string>'],
enabled: true,
subscribed_event_types: [],
undelivered_payload_retention_hours: 72
})
};
fetch('http://127.0.0.1:8787/v1/webhooks/endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8787",
CURLOPT_URL => "http://127.0.0.1:8787/v1/webhooks/endpoints",
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' => 'https://example.com/webhooks/kayle',
'name' => '<string>',
'labels' => [
'<string>'
],
'enabled' => true,
'subscribed_event_types' => [
],
'undelivered_payload_retention_hours' => 72
]),
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 := "http://127.0.0.1:8787/v1/webhooks/endpoints"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhooks/kayle\",\n \"name\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"subscribed_event_types\": [],\n \"undelivered_payload_retention_hours\": 72\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("http://127.0.0.1:8787/v1/webhooks/endpoints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhooks/kayle\",\n \"name\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"subscribed_event_types\": [],\n \"undelivered_payload_retention_hours\": 72\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8787/v1/webhooks/endpoints")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhooks/kayle\",\n \"name\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"subscribed_event_types\": [],\n \"undelivered_payload_retention_hours\": 72\n}"
response = http.request(request)
puts response.read_body{
"data": {
"endpoint": {
"id": "<string>",
"organization_id": "<string>",
"name": "<string>",
"labels": [
"<string>"
],
"url": "<string>",
"enabled": true,
"subscribed_event_types": [
"verification.session.succeeded"
],
"created_at": "<string>",
"updated_at": "<string>",
"disabled_at": "<string>",
"undelivered_payload_retention_hours": 72
},
"signing_secret": "<string>"
},
"error": null
}{
"data": null,
"error": {
"code": "BAD_REQUEST",
"message": "Bad request.",
"hint": "The request payload is invalid.",
"docs": "https://kayle.id/docs/api/webhooks/endpoints#create"
}
}{
"data": null,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error.",
"hint": "The server encountered an error.",
"docs": "https://kayle.id/docs/api/errors"
}
}Webhooks
Create a webhook endpoint
Create a webhook endpoint for the authenticated organization.
POST
/
v1
/
webhooks
/
endpoints
Create a webhook endpoint
curl --request POST \
--url http://127.0.0.1:8787/v1/webhooks/endpoints \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://example.com/webhooks/kayle",
"name": "<string>",
"labels": [
"<string>"
],
"enabled": true,
"subscribed_event_types": [],
"undelivered_payload_retention_hours": 72
}
'import requests
url = "http://127.0.0.1:8787/v1/webhooks/endpoints"
payload = {
"url": "https://example.com/webhooks/kayle",
"name": "<string>",
"labels": ["<string>"],
"enabled": True,
"subscribed_event_types": [],
"undelivered_payload_retention_hours": 72
}
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({
url: 'https://example.com/webhooks/kayle',
name: '<string>',
labels: ['<string>'],
enabled: true,
subscribed_event_types: [],
undelivered_payload_retention_hours: 72
})
};
fetch('http://127.0.0.1:8787/v1/webhooks/endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8787",
CURLOPT_URL => "http://127.0.0.1:8787/v1/webhooks/endpoints",
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' => 'https://example.com/webhooks/kayle',
'name' => '<string>',
'labels' => [
'<string>'
],
'enabled' => true,
'subscribed_event_types' => [
],
'undelivered_payload_retention_hours' => 72
]),
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 := "http://127.0.0.1:8787/v1/webhooks/endpoints"
payload := strings.NewReader("{\n \"url\": \"https://example.com/webhooks/kayle\",\n \"name\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"subscribed_event_types\": [],\n \"undelivered_payload_retention_hours\": 72\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("http://127.0.0.1:8787/v1/webhooks/endpoints")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com/webhooks/kayle\",\n \"name\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"subscribed_event_types\": [],\n \"undelivered_payload_retention_hours\": 72\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://127.0.0.1:8787/v1/webhooks/endpoints")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com/webhooks/kayle\",\n \"name\": \"<string>\",\n \"labels\": [\n \"<string>\"\n ],\n \"enabled\": true,\n \"subscribed_event_types\": [],\n \"undelivered_payload_retention_hours\": 72\n}"
response = http.request(request)
puts response.read_body{
"data": {
"endpoint": {
"id": "<string>",
"organization_id": "<string>",
"name": "<string>",
"labels": [
"<string>"
],
"url": "<string>",
"enabled": true,
"subscribed_event_types": [
"verification.session.succeeded"
],
"created_at": "<string>",
"updated_at": "<string>",
"disabled_at": "<string>",
"undelivered_payload_retention_hours": 72
},
"signing_secret": "<string>"
},
"error": null
}{
"data": null,
"error": {
"code": "BAD_REQUEST",
"message": "Bad request.",
"hint": "The request payload is invalid.",
"docs": "https://kayle.id/docs/api/webhooks/endpoints#create"
}
}{
"data": null,
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error.",
"hint": "The server encountered an error.",
"docs": "https://kayle.id/docs/api/errors"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The URL of the webhook endpoint. Must use https:// (http:// is only accepted for localhost in development).
Maximum string length:
2048Example:
"https://example.com/webhooks/kayle"
An optional display name for the webhook endpoint.
Required string length:
1 - 120Optional tag-style purpose labels for this endpoint.
Maximum array length:
8Whether the endpoint should be enabled immediately. Defaults to true.
The event types this endpoint should receive.
Available options:
verification.session.succeeded, verification.session.failed, verification.session.expired, verification.session.cancelled undelivered_payload_retention_hours
Option 1 · enum<number>Option 2 · enum<number>Option 3 · enum<number>Option 4 · enum<number>
default:72
How long Kayle should retain encrypted undelivered payloads after terminal delivery failure.
Available options:
0 ⌘I