Skip to content
Hayonix

API reference · Webhooks

Replace the signing secret (returned once); the previous one keeps signing during the overlap

POST/v1/webhooks/{webhook_id}/rotate-secret
API keywebhook:updateProject
TypeScript
client.webhooks.rotateSecret()
Python
client.webhooks.rotate_secret()
CLI
hayonix webhooks rotate-secret

During the overlap every delivery carries two signatures in Webhook-Signature, one per secret, so you can switch your receiver to the new secret without missing events. The body is optional.

Project API key (Authorization: Bearer sk_…), or a console session. Requires the webhook:update permission (a key's scope, or a role that includes it).

Examples

The samples read API_KEY and API_BASE_URL from the environment (see Setup). Values are examples.

curl -sS "$API_BASE_URL/webhooks/whk_01jc5zq4m8k3v6x9t2w7r0b1e4/rotate-secret" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "overlap_seconds": 86400
}'

Request

Headers
HeaderRequiredDescription
AuthorizationyesBearer and your API key. The key implies its project.
X-Project-Idsession onlyThe project to act in, for console sessions. Requests with an API key leave it out.

Path parameters

  • webhook_idstringrequired

    ID of the webhook

    ID with prefix whk_

Body

JSON (application/json): RotateWebhookSecretRequest, optional.

  • overlap_secondsinteger

    How long the previous secret keeps signing deliveries next to the new one (default 86400; 0 revokes it at once)

    0–604800

Response

200 WebhookSecret — The new secret

  • objectstringrequired

    Always `webhook_secret`: the type of this object

    One ofwebhook_secret

  • webhook_idstringrequired

    ID of the webhook

    ID with prefix whk_

  • secretstringrequired

    The new signing secret. Shown only now.

  • previous_secret_expires_atstring (date-time) | nullrequired

    Time previous secret expires (ISO 8601, UTC)

Example response
Example response
{
  "object": "webhook_secret",
  "webhook_id": "whk_01jc5zq4m8k3v6x9t2w7r0b1e4",
  "secret": "string",
  "previous_secret_expires_at": "2026-01-01T00:00:00.000Z"
}

Errors

Errors use the standard envelope. What this operation can answer:

Errors
StatusTypeWhen
400invalid_request_errorA parameter or body field is missing or not allowed; param names it.
401authentication_errorThe key or session is missing, revoked or expired.
403permission_errorThe credential lacks the permission this needs, or the organization is suspended.
404not_found_errorNo such resource in this project (an ID from another project is answered the same way).
409conflict_errorThe resource's current state does not allow this.
429rate_limit_error rate_limitedToo many requests; retry after retry-after seconds.