# Rotate a webhook endpoint's signing secret

> Rotate a webhook endpoint's signing secret: CustomDomain™ API reference in the webhooks group. Covers parameters, request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/webhooks/rotateWebhookSecret

## `POST https://api.customdomain.ai/v1/webhooks/{id}/secret:rotate`

Gives the endpoint a new `secret`, returned once. The old secret keeps signing for `overlap_seconds` (a day when omitted, at most a week, 0 ends it at once): while it does, each signature header holds one `sha256=` value per secret, joined by a comma, and a delivery verifies with either secret. Answers 404 where rotation is not switched on for the workspace.

### Authentication

`widgetJWT`, `apiKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Request body (JSON)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `overlap_seconds` | integer | no | How long the old secret keeps signing. Defaults to 86400; 0 ends it at once. |

### Responses

| Status | Description |
| --- | --- |
| `200` | The new secret (shown once) and when the old one stops signing |
| `400` | Error envelope: {code, title, details, request_id}. |
| `401` | Error envelope: {code, title, details, request_id}. |
| `403` | Error envelope: {code, title, details, request_id}. |
| `404` | Error envelope: {code, title, details, request_id}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `secret` | string | yes | The new secret (whsec_…), shown once. |
| `previous_secret_expires_at` | string or null | no | When the old secret stops signing; absent when it ended at once. |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
