Create a webhook endpoint
curl --request POST \
--url https://api.kit.com/v4/webhook_endpoints \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"url": "https://hooks.example.com/incoming",
"events": [
"subscriber.created",
"custom_field.created"
],
"name": "My webhook",
"description": "Listens for things"
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/webhook_endpoints")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://hooks.example.com/incoming\",\n \"events\": [\n \"subscriber.created\",\n \"custom_field.created\"\n ],\n \"name\": \"My webhook\",\n \"description\": \"Listens for things\"\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'POST',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://hooks.example.com/incoming',
events: ['subscriber.created', 'custom_field.created'],
name: 'My webhook',
description: 'Listens for things'
})
};
fetch('https://api.kit.com/v4/webhook_endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/webhook_endpoints"
payload := strings.NewReader("{\n \"url\": \"https://hooks.example.com/incoming\",\n \"events\": [\n \"subscriber.created\",\n \"custom_field.created\"\n ],\n \"name\": \"My webhook\",\n \"description\": \"Listens for things\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Kit-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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/webhook_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://hooks.example.com/incoming',
'events' => [
'subscriber.created',
'custom_field.created'
],
'name' => 'My webhook',
'description' => 'Listens for things'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/webhook_endpoints"
payload = {
"url": "https://hooks.example.com/incoming",
"events": ["subscriber.created", "custom_field.created"],
"name": "My webhook",
"description": "Listens for things"
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"webhook_endpoint": {
"id": 20,
"name": "My webhook",
"url": "https://hooks.example.com/incoming",
"events": [
"custom_field.created",
"subscriber.created"
],
"status": "active",
"source": "creator",
"description": "Listens for things",
"created_by_app": null,
"created_at": "2023-02-17T11:43:55Z",
"previous_secret_expires_at": null,
"secret": "whsec_YOUR_SIGNING_SECRET_HERE"
}
}Webhooks
Create a webhook endpoint
Registers a URL to receive deliveries for the event types listed in events. The url must be publicly reachable over HTTP(S) — private, internal, and loopback addresses are rejected.
The response is the only time the signing secret is returned in plaintext. Store it securely; you need it to verify the signature on every delivery. If you lose it, rotate the secret to get a new one.
Note: This resource supersedes the legacy Webhooks resource. Legacy webhooks keep working, but new integrations should be built here — see getting started for a full walkthrough.
POST
/
v4
/
webhook_endpoints
Create a webhook endpoint
curl --request POST \
--url https://api.kit.com/v4/webhook_endpoints \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"url": "https://hooks.example.com/incoming",
"events": [
"subscriber.created",
"custom_field.created"
],
"name": "My webhook",
"description": "Listens for things"
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/webhook_endpoints")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://hooks.example.com/incoming\",\n \"events\": [\n \"subscriber.created\",\n \"custom_field.created\"\n ],\n \"name\": \"My webhook\",\n \"description\": \"Listens for things\"\n}"
response = http.request(request)
puts response.read_bodyconst options = {
method: 'POST',
headers: {'X-Kit-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://hooks.example.com/incoming',
events: ['subscriber.created', 'custom_field.created'],
name: 'My webhook',
description: 'Listens for things'
})
};
fetch('https://api.kit.com/v4/webhook_endpoints', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/webhook_endpoints"
payload := strings.NewReader("{\n \"url\": \"https://hooks.example.com/incoming\",\n \"events\": [\n \"subscriber.created\",\n \"custom_field.created\"\n ],\n \"name\": \"My webhook\",\n \"description\": \"Listens for things\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Kit-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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/webhook_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://hooks.example.com/incoming',
'events' => [
'subscriber.created',
'custom_field.created'
],
'name' => 'My webhook',
'description' => 'Listens for things'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Kit-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/webhook_endpoints"
payload = {
"url": "https://hooks.example.com/incoming",
"events": ["subscriber.created", "custom_field.created"],
"name": "My webhook",
"description": "Listens for things"
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"webhook_endpoint": {
"id": 20,
"name": "My webhook",
"url": "https://hooks.example.com/incoming",
"events": [
"custom_field.created",
"subscriber.created"
],
"status": "active",
"source": "creator",
"description": "Listens for things",
"created_by_app": null,
"created_at": "2023-02-17T11:43:55Z",
"previous_secret_expires_at": null,
"secret": "whsec_YOUR_SIGNING_SECRET_HERE"
}
}Authorizations
API KeyOAuth2
Authenticate API requests via an API Key
Body
application/json
Response
201 - application/json
Creates a webhook endpoint
Show child attributes
Show child attributes
Related topics
Create a webhookDelete a webhookGet a webhook endpointWebhooks overviewList webhook endpointsWas this page helpful?