curl --request POST \
--url https://api.kit.com/v4/webhooks \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"target_url": "https://example.convertkit.dev/",
"event": {
"name": "subscriber.subscriber_activate",
"form_id": null,
"tag_id": null,
"sequence_id": null,
"product_id": null,
"initiator_value": null,
"custom_field_id": null
}
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/webhooks")
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 \"target_url\": \"https://example.convertkit.dev/\",\n \"event\": {\n \"name\": \"subscriber.subscriber_activate\",\n \"form_id\": null,\n \"tag_id\": null,\n \"sequence_id\": null,\n \"product_id\": null,\n \"initiator_value\": null,\n \"custom_field_id\": null\n }\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({
target_url: 'https://example.convertkit.dev/',
event: {
name: 'subscriber.subscriber_activate',
form_id: null,
tag_id: null,
sequence_id: null,
product_id: null,
initiator_value: null,
custom_field_id: null
}
})
};
fetch('https://api.kit.com/v4/webhooks', 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/webhooks"
payload := strings.NewReader("{\n \"target_url\": \"https://example.convertkit.dev/\",\n \"event\": {\n \"name\": \"subscriber.subscriber_activate\",\n \"form_id\": null,\n \"tag_id\": null,\n \"sequence_id\": null,\n \"product_id\": null,\n \"initiator_value\": null,\n \"custom_field_id\": null\n }\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/webhooks",
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([
'target_url' => 'https://example.convertkit.dev/',
'event' => [
'name' => 'subscriber.subscriber_activate',
'form_id' => null,
'tag_id' => null,
'sequence_id' => null,
'product_id' => null,
'initiator_value' => null,
'custom_field_id' => null
]
]),
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/webhooks"
payload = {
"target_url": "https://example.convertkit.dev/",
"event": {
"name": "subscriber.subscriber_activate",
"form_id": None,
"tag_id": None,
"sequence_id": None,
"product_id": None,
"initiator_value": None,
"custom_field_id": None
}
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"webhook": {
"id": 9,
"account_id": 1788,
"event": {
"name": "subscriber_activate",
"initiator_value": null
},
"target_url": "https://example.convertkit.dev/"
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"`event` and `target` parameters must be provided"
]
}Create a webhook
Available event types:
- subscriber.subscriber_activate
- subscriber.subscriber_unsubscribe
- subscriber.subscriber_bounce
- subscriber.subscriber_complain
- subscriber.form_subscribe, required parameter form_id [Integer]
- subscriber.course_subscribe, required parameter sequence_id [Integer]
- subscriber.course_complete, required parameter sequence_id [Integer]
- subscriber.link_click, required parameter initiator_value [String] as a link URL
- subscriber.product_purchase, required parameter product_id [Integer]
- subscriber.tag_add, required parameter tag_id [Integer]
- subscriber.tag_remove, required parameter tag_id [Integer]
- purchase.purchase_create
- custom_field.field_created
- custom_field.field_deleted
- custom_field.field_value_updated, required parameter custom_field_id [Integer]
curl --request POST \
--url https://api.kit.com/v4/webhooks \
--header 'Content-Type: application/json' \
--header 'X-Kit-Api-Key: <api-key>' \
--data '
{
"target_url": "https://example.convertkit.dev/",
"event": {
"name": "subscriber.subscriber_activate",
"form_id": null,
"tag_id": null,
"sequence_id": null,
"product_id": null,
"initiator_value": null,
"custom_field_id": null
}
}
'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/webhooks")
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 \"target_url\": \"https://example.convertkit.dev/\",\n \"event\": {\n \"name\": \"subscriber.subscriber_activate\",\n \"form_id\": null,\n \"tag_id\": null,\n \"sequence_id\": null,\n \"product_id\": null,\n \"initiator_value\": null,\n \"custom_field_id\": null\n }\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({
target_url: 'https://example.convertkit.dev/',
event: {
name: 'subscriber.subscriber_activate',
form_id: null,
tag_id: null,
sequence_id: null,
product_id: null,
initiator_value: null,
custom_field_id: null
}
})
};
fetch('https://api.kit.com/v4/webhooks', 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/webhooks"
payload := strings.NewReader("{\n \"target_url\": \"https://example.convertkit.dev/\",\n \"event\": {\n \"name\": \"subscriber.subscriber_activate\",\n \"form_id\": null,\n \"tag_id\": null,\n \"sequence_id\": null,\n \"product_id\": null,\n \"initiator_value\": null,\n \"custom_field_id\": null\n }\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/webhooks",
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([
'target_url' => 'https://example.convertkit.dev/',
'event' => [
'name' => 'subscriber.subscriber_activate',
'form_id' => null,
'tag_id' => null,
'sequence_id' => null,
'product_id' => null,
'initiator_value' => null,
'custom_field_id' => null
]
]),
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/webhooks"
payload = {
"target_url": "https://example.convertkit.dev/",
"event": {
"name": "subscriber.subscriber_activate",
"form_id": None,
"tag_id": None,
"sequence_id": None,
"product_id": None,
"initiator_value": None,
"custom_field_id": None
}
}
headers = {
"X-Kit-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"webhook": {
"id": 9,
"account_id": 1788,
"event": {
"name": "subscriber_activate",
"initiator_value": null
},
"target_url": "https://example.convertkit.dev/"
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"`event` and `target` parameters must be provided"
]
}Was this page helpful?