# Rotate the signing secret (/docs/api/webhook-endpoints/rotate-webhook-endpoint-secret)

## Rotate the signing secret

`POST https://runepay.co/api/v1/webhook_endpoints/{id}/rotate`

Returns the new secret once. Deliveries are signed with both secrets during the overlap unless `immediate` is true. A retry with the same Idempotency-Key gets `409 secret_not_replayable`; rotate again for a new secret.

Scope: `webhook_endpoints:write`

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` (required) | path | string | The object id. |
| `Idempotency-Key` | header | string | Makes a retry safe: the same key and body within 24 hours does not repeat the request. |

Body:

| Field | Type | Description |
| --- | --- | --- |
| `immediate` | boolean | Retire the current and any previous secret now, e.g. after a leak. |

Example request body:

```json
{
  "immediate": false
}
```

Response `200`:

```json
{
  "id": "we_01KA9F6G8H0J2K4M6N8P0Q2R4S",
  "object": "webhook_endpoint",
  "url": "https://merchant.example/hooks",
  "livemode": false,
  "enabled_events": [
    "*"
  ],
  "status": "enabled",
  "api_version": "2026-12-15",
  "description": null,
  "metadata": {},
  "created": 1767225600,
  "secret": "whsec_9fK2mQ7xR4tV1wY8zA3bC6dE0gH5jL"
}
```

Errors: 400, 401, 403, 404, 409, 413, 422, 500, 503, with the [error shape](/docs/api/errors).
