Rotate Webhook Secret
Issues a new signing secret (whsec_...) for one of the caller’s webhooks. Use it to switch on signing for a webhook created before signing existed (its deliveries stay unsigned until you do), or to replace a secret which may have leaked. The previous secret keeps signing for 7 days: during the overlap every delivery carries one signature per secret in webhook-signature, so receivers can switch without downtime. Only the user who created the webhook, or a user of the same vendor, can rotate its secret. The new secret appears only in the rotate response. Rotating needs its own Webhooks permission, Rotate a webhook signing secret; keys that can already create webhooks receive it automatically. Send the Content-Type: application/json header even though the request has no body; without it the call fails with code 20001.
curl --request POST \
--url https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate"
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'}
};
fetch('https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate', 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.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
response = http.request(request)
puts response.read_body{
"subscribeId": 1234,
"secret": "whsec_bG9mdHktc2FtcGxlLXNpZ25pbmctc2VjcmV0LTAwMDE=",
"previousSecretExpiresAt": "2026-11-30T08:00:00Z"
}"<string>""<string>""<string>""<string>"Response
New secret issued.
Until when the previous secret keeps signing deliveries (ISO 8601, UTC): 7 days after the rotation. Absent when there was no previous secret. During the overlap each delivery carries a signature for both secrets, so receivers can switch without downtime.
"2026-11-30T08:00:00Z"
curl --request POST \
--url https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>'import requests
url = "https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate"
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'}
};
fetch('https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate', 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.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lofty.com/v1.0/webhook/{subscribeId}/secret/rotate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
response = http.request(request)
puts response.read_body{
"subscribeId": 1234,
"secret": "whsec_bG9mdHktc2FtcGxlLXNpZ25pbmctc2VjcmV0LTAwMDE=",
"previousSecretExpiresAt": "2026-11-30T08:00:00Z"
}"<string>""<string>""<string>""<string>"