> ## Documentation Index
> Fetch the complete documentation index at: https://docs.secapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/webhook_endpoints/{webhook_id}/rotate_secret

> Rotate the signing secret for a webhook endpoint

Rotate the signing secret for a webhook endpoint

<Info>
  Audience: application and admin.
</Info>

## Rotate safely

Rotation returns a new `signingSecret` once and future deliveries use it. A missing endpoint returns `404`. Update the receiver with the new value before relying on future requests; do not log the secret or expect it in a later endpoint-list response.

## Canonical metadata

* `requestId`
* `traceparent`

## Example request

<RequestExample>
  ```bash theme={null}
  curl -X POST \
    -H "Authorization: Bearer $SECAPI_BEARER_TOKEN" \
    -H "secapi-version: 2026-03-19" \
    -H "content-type: application/json" \
    -d '{}' \
    "https://api.secapi.ai/v1/webhook_endpoints/wh_example_123/rotate_secret"
  ```
</RequestExample>

<Info>
  This organization control-plane action accepts bearer organization REST authentication. API keys cannot mutate webhook endpoints. The dashboard is optional.
</Info>

## Example response

<ResponseExample>
  ```json theme={null}
  {
    "object": "webhook_endpoint",
    "id": "wh_2ZK8Q1W9F4M6P7R3",
    "createdAt": "2026-06-25T15:00:00.000Z",
    "updatedAt": "2026-06-25T15:00:00.000Z",
    "livemode": false,
    "orgId": "org_example_123",
    "description": "Production monitor matches",
    "destinationUrl": "https://example.com/hooks/secapi",
    "subscribedEventTypes": [
      "monitor.match",
      "webhook.test"
    ],
    "status": "active",
    "lastDeliveredAt": null,
    "signingSecret": "whsec_example_reveal_once_on_create_or_rotate",
    "requestId": "req_2ZK8Q1W9F4M6P7R3"
  }
  ```
</ResponseExample>

## Give this prompt to your agent

<Prompt>
  Rotate the signing secret with bearer organization REST authentication, then update the receiver atomically. API keys cannot mutate webhook endpoints; the dashboard is optional. The new secret is revealed once.
</Prompt>

## Failure posture

* treat non-2xx responses as contract-aware failures, not free-form errors
* preserve `requestId` and `traceparent` in logs and downstream reports
* if provenance or freshness metadata is present, return it unchanged so trust is not lost in the handoff
