# Rotate the secret

Replace an endpoint's signing secret without missing a delivery.

Each endpoint has one signing secret: `whsec_` and 32 random bytes in base64. It is returned when you create the endpoint and when you rotate it, and never again.

Rotate it when someone who shouldn't have it may have seen it, or if you lost it.

## How a rotation works

[Rotate the signing secret](https://chatwise.so/docs/api/rotate-webhook-secret.md), in the dashboard or with the API:

```bash
curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/rotate-secret' \
  -H "Authorization: Bearer $CHATWISE_API_KEY"
```

```json
{
  "data": {
    "signingSecret": "whsec_ZXhhbXBsZS1zZWNyZXQtZG8tbm90LXVzZS0wMDAwMDA=",
    "previousSecretExpiresAt": "2026-12-01T10:00:00.000Z"
  }
}
```

For the next **24 hours** every delivery carries two signatures, made with the new secret and the previous one:

```http
webhook-signature: v1,L1bPoz66MpwZv1+qbTZ/JIqM6Q++GR68lDnkBgwUnw8= v1,DNb+TcqHMMG6Ay8s5t9N3mfeugBMQi6Li09ENz7mWDY=
```

A receiver that accepts a request when **any** signature matches, as the [samples](https://chatwise.so/docs/webhooks/verify-signatures.md) do, works with either secret. So:

1. Rotate the secret.
2. Put the new one in your receiver, within 24 hours.
3. [Send a test event](https://chatwise.so/docs/webhooks/testing.md).

After 24 hours only the new secret signs.

> Rotating again within the 24 hours replaces the previous secret too. Deliveries are then signed with the two latest secrets, and a receiver that still has an older one refuses them.
