Subscriptions
Rotate signing secret
Mint a new signing secret and invalidate the previous one
POST
/
api
/
webhooks
/
subscriptions
/
{id}
/
rotate-secret
Rotate signing secret
curl --request POST \
--url https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret', 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.example.com/api/webhooks/subscriptions/{id}/rotate-secret",
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>"
],
]);
$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.example.com/api/webhooks/subscriptions/{id}/rotate-secret"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.example.com/api/webhooks/subscriptions/{id}/rotate-secret")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "1c84203c-b4e3-40de-83a9-51bc0d9c991f",
"secret": "whsec_Qx9_NK7gh-ZbR43210uVdMcEw2pf3CYn5pAUmeU1XYW8",
"secretPrefix": "whsec_Qx9_NK"
}
Mints a new
whsec_… secret and returns it once. The previous secret is invalidated immediately — there is no overlap window.
If you need overlap (e.g. rolling deploys), use this flow:
- Pause the subscription.
- Rotate the secret here.
- Deploy your verifier with the new secret.
- Unpause the subscription via Update.
Scope
webhooks:write · rate-limitedHeaders
string
required
API key.
Path parameters
string
required
Subscription UUID.
Response
string
Subscription UUID.
string
The new signing secret in plaintext. Returned only here — store it immediately.
string
First few characters of the new secret.
{
"id": "1c84203c-b4e3-40de-83a9-51bc0d9c991f",
"secret": "whsec_Qx9_NK7gh-ZbR43210uVdMcEw2pf3CYn5pAUmeU1XYW8",
"secretPrefix": "whsec_Qx9_NK"
}
⌘I
Rotate signing secret
curl --request POST \
--url https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret', 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.example.com/api/webhooks/subscriptions/{id}/rotate-secret",
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>"
],
]);
$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.example.com/api/webhooks/subscriptions/{id}/rotate-secret"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.example.com/api/webhooks/subscriptions/{id}/rotate-secret")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/webhooks/subscriptions/{id}/rotate-secret")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "1c84203c-b4e3-40de-83a9-51bc0d9c991f",
"secret": "whsec_Qx9_NK7gh-ZbR43210uVdMcEw2pf3CYn5pAUmeU1XYW8",
"secretPrefix": "whsec_Qx9_NK"
}