Skip to main content
POST
/
v1
/
public
/
webhook
/
subscription
/
{id}
/
rotate
/
secret
Rotate the signing secret
curl --request POST \
  --url https://api.example.com/v1/public/webhook/subscription/{id}/rotate/secret \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.example.com/v1/public/webhook/subscription/{id}/rotate/secret"

headers = {"Authorization": "Bearer <token>"}

response = requests.post(url, headers=headers)

print(response.text)
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.example.com/v1/public/webhook/subscription/{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/v1/public/webhook/subscription/{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: Bearer <token>"
  ],
]);

$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/v1/public/webhook/subscription/{id}/rotate/secret"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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/v1/public/webhook/subscription/{id}/rotate/secret")
  .header("Authorization", "Bearer <token>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/v1/public/webhook/subscription/{id}/rotate/secret")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "secret": "whsec_NEWxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "previous_secret_expires_at": "2026-06-12T10:15:00.000Z"
}
{
  "error": "Authentication",
  "message": "Authentication failed",
  "traceId": "e679120f-1d1c-41d2-947c-34e194d5a4a1"
}
{
  "status": 400,
  "type": "VALIDATION_ERROR",
  "message": "Validation failed",
  "details": {},
  "timestamp": "2023-11-07T05:31:56Z",
  "path": "/v1/public/webhook/subscription",
  "trace_id": "341b5325-a0be-4533-85dd-6f697476dfc3"
}
{
  "status": 400,
  "type": "VALIDATION_ERROR",
  "message": "Validation failed",
  "details": {},
  "timestamp": "2023-11-07T05:31:56Z",
  "path": "/v1/public/webhook/subscription",
  "trace_id": "341b5325-a0be-4533-85dd-6f697476dfc3"
}
{
  "status": 400,
  "type": "VALIDATION_ERROR",
  "message": "Validation failed",
  "details": {},
  "timestamp": "2023-11-07T05:31:56Z",
  "path": "/v1/public/webhook/subscription",
  "trace_id": "341b5325-a0be-4533-85dd-6f697476dfc3"
}

Authorizations

Authorization
string
header
required

API key passed as a Bearer token in the Authorization header: Authorization: Bearer <YOUR_API_KEY>.

Path Parameters

id
string
required

The subscription ID whose secret to rotate.

Response

OK. Returns only the two rotation fields.

Returns only the two rotation fields - not the full subscription object.

secret
string

The new signing secret (whsec_...), returned once.

Example:

"whsec_NEWxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

previous_secret_expires_at
string<date-time>

When the previous secret stops being accepted (rotation time + 72h).

Example:

"2026-06-12T10:15:00.000Z"