Rotate a webhook's signing secret

Rotate a webhook's signing secret

POST/api/v1/webhooks/{id}/rotate-secret

POST /webhooks/{id}/rotate-secret
curl -X POST 'https://www.unitpost.com/api/v1/webhooks/wh_123/rotate-secret' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0'
Response · 200
{
  "object": "webhook",
  "id": "id_123",
  "name": "Example",
  "url": "https://example.com",
  "events": [
    "email.sent"
  ],
  "status": "enabled",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z",
  "signing_secret": "string",
  "previous_secret_expires_at": "2026-01-01T00:00:00.000Z"
}

Mint a new signing secret for the endpoint. The response carries the new signing_secret exactly once, as Create a webhook endpoint does. For 24 hours (until previous_secret_expires_at) every delivery is signed with the new and the old secret, so switch your receiver to the new one inside that window without dropping a delivery. Rotating again inside the window retires the older secret at once. Requires the webhooks:manage capability.

Parameters1 field
FieldTypeDescription
idrequiredstring · path—
Response · 200 fields1 field
FieldTypeDescription
previous_secret_expires_atrequiredstringUntil this time deliveries are signed with the new AND the old secret, so switch your receiver to the new one before then.
200401403404409

Search docs and guides

Search the docs and product guides.