Delete a webhook
curl --request DELETE \
--url https://api.kit.com/v4/webhooks/{id} \
--header 'X-Kit-Api-Key: <api-key>'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyconst options = {method: 'DELETE', headers: {'X-Kit-Api-Key': '<api-key>'}};
fetch('https://api.kit.com/v4/webhooks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/webhooks/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Kit-Api-Key", "<api-key>")
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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"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/{id}"
headers = {"X-Kit-Api-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text){
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Not Found"
]
}{
"errors": [
"Unable to destroy the webhook."
]
}Webhooks (Legacy)
Delete a webhook
Legacy: This deletes a previous-generation webhook. If you’re replacing it rather than retiring it, consider recreating it as a webhook endpoint — see the webhooks guides.
Deletes the webhook and stops all future deliveries of its subscribed events to the target URL. Returns 204 No Content on success, 404 when the id doesn’t exist, and 422 when the webhook cannot be deleted.
Find webhook ids with List webhooks; register a replacement with Create a webhook.
DELETE
/
v4
/
webhooks
/
{id}
Delete a webhook
curl --request DELETE \
--url https://api.kit.com/v4/webhooks/{id} \
--header 'X-Kit-Api-Key: <api-key>'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/webhooks/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-Kit-Api-Key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyconst options = {method: 'DELETE', headers: {'X-Kit-Api-Key': '<api-key>'}};
fetch('https://api.kit.com/v4/webhooks/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/webhooks/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-Kit-Api-Key", "<api-key>")
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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"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/{id}"
headers = {"X-Kit-Api-Key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text){
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Not Found"
]
}{
"errors": [
"Unable to destroy the webhook."
]
}Related topics
Upgrading to V4Delete a webhook endpointAPI AuthenticationManaging pluginsWebhooks overviewWas this page helpful?