Skip to main content

Overview

Generates a new signing secret for a webhook subscription and returns it. The previous secret is immediately invalidated. Use this endpoint if your secret is compromised, as part of a regular rotation policy, or after onboarding a new team member who should not have access to the old secret.
After rotation, all future webhook deliveries will be signed with the new secret. You must update your verification logic immediately after receiving the new secret — there is no grace period during which both secrets are valid simultaneously.

Endpoint

POST /partners/webhooks/subscriptions/:id/rotate-secret

Authentication

Requires a valid API Key with the partner_webhooks_manage permission.

Path Parameters

ParameterTypeRequiredDescription
idUUIDYesThe subscription ID.

Example Request

curl -X POST "https://apiv3.thecleanlife.dev/v1/partners/webhooks/subscriptions/gggggggg-0000-0000-0000-000000000001/rotate-secret" \
  -H "x-api-key: YOUR_API_KEY"

Success Response

HTTP Status: 200 OK
{
  "success": true,
  "data": {
    "id": "gggggggg-0000-0000-0000-000000000001",
    "secret": "9f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1f0e9d8c7b6a5f4e3d2c1b0a9f8e"
  }
}
Critical: Save the new secret immediately. This is the only time it will be returned.

Error Responses

HTTP StatusCodeDescription
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENMissing partner_webhooks_manage permission
404RESOURCE_NOT_FOUNDSubscription not found

Rotation Strategy

To rotate with zero downtime:
  1. Call this endpoint to get the new secret.
  2. Update your environment variable / secrets manager with the new value.
  3. Deploy the new configuration.
  4. Verify a test webhook event is processed successfully.
Because there is no dual-secret window, it is recommended to:
  • Do this rotation during low-traffic periods.
  • Have monitoring in place to detect signature verification failures immediately after rotation.