# Rotate Endpoint Secret

> Webhooks API, POST /endpoint/{endpoint_id}/secret/rotate: Rotates the endpoint's signing secret.

`POST /endpoint/{endpoint_id}/secret/rotate` on the Webhooks API. Base URL: `https://api.sinay.ai/webhook/api/v1`.

Rotates the endpoint's signing secret.  The previous secret will be valid for the next 24 hours.

## Path parameters

::api-parameters{location="path"}
| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `endpoint_id` | string | Yes | The ep's ID or UID To retrieve your endpoints ids, use GET /endpoint. Example: `unique-ep-identifier`. |
::

## Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `idempotency-key` | string | No | The request's idempotency key. |

## Request body

`application/json`, required.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `key` | string, nullable | No | The endpoint's verification secret. If `null` is passed, a secret is automatically generated.  Format: `base64` encoded random bytes optionally prefixed with `whsec_`. Recommended size: 24. Default: `null`. |

::api-request-body
Example request body:

```json
{
  "key": "whsec_C2FVsBQIhrscChlQIMV+b5sSYspob7oD"
}
```
::

## Responses

::api-response
---
status: "204"
description: No content. Your secret has been rotated, but we won't show it here.
---

No body.

::

::api-response
---
status: "400"
description: Bad request
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | — |
| `detail` | string | Yes | — |

::

::api-response
---
status: "403"
description: Forbidden
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | — |
| `detail` | string | Yes | — |

::

::api-response
---
status: "404"
description: Not Found. Endpoint not found
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | — |
| `detail` | string | Yes | — |

::

::api-response
---
status: "429"
description: Too Many Requests
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | — |
| `detail` | string | Yes | — |

::

::api-response
---
status: "500"
description: Internal Error
---

Body: `application/json`, object.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | — |
| `detail` | string | Yes | — |

::
