# rotate_webhook_secret

Rotate a webhook signing secret

`POST /v1/webhook-endpoints/{endpoint_id}/rotate-secret`

| | |
| --- | --- |
| Risk | write |
| Authentication | API key or OAuth access token |
| Scopes | `webhooks:write` |
| Idempotency | supported: send an Idempotency-Key header to make retries safe |
| Dry run | not applicable |
| Success status | 200 |
| Response type | application/json |

## What it does

- Use when: A secret may have leaked or you rotate secrets on a schedule.
- Do not use when: you only changed the address (call update_webhook_endpoint).
- Side effects: Issues a new secret, returned once; The old secret keeps signing beside the new one for 24 hours.
- Reversible: No.
- Required scope: webhooks:write.
- Idempotency: supported (Idempotency-Key header).
- Typical next step: deploy the new secret to your receiver within 24 hours, then call send_test_webhook.

## Scopes

- `webhooks:write`: Create, change and delete webhook endpoints.

## Side effects

- Issues a new secret, returned once
- The old secret keeps signing beside the new one for 24 hours

## Request

### Path parameters

| Field | Type | Description |
| --- | --- | --- |
| `endpoint_id` | string |  |

### Query parameters

None.

## Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes |  |
| `secret` | string | yes | whsec_... Shown only in this response. |
| `previous_secret_expires_at` | string | yes | RFC 3339 UTC timestamp. |

## Examples

### rotated

Request:

```bash
curl -X POST 'https://api.seemly.com/v1/webhook-endpoints/whe_4d8x2p0q7r3m9k1v5t6w8y0z/rotate-secret' \
  -H "Authorization: Bearer $SEEMLY_API_KEY"
```

Response: `200`:

```json
{
  "id": "whe_4d8x2p0q7r3m9k1v5t6w8y0z",
  "secret": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw",
  "previous_secret_expires_at": "2026-12-03T09:30:00Z"
}
```

## Errors

| Status | Codes |
| --- | --- |
| 400 | [`validation_failed`](/developers/md/errors/validation_failed) |
| 401 | [`unauthenticated`](/developers/md/errors/unauthenticated), [`credential_revoked`](/developers/md/errors/credential_revoked), [`credential_expired`](/developers/md/errors/credential_expired) |
| 403 | [`insufficient_scope`](/developers/md/errors/insufficient_scope), [`plan_does_not_include`](/developers/md/errors/plan_does_not_include), [`workspace_paused`](/developers/md/errors/workspace_paused), [`api_suspended`](/developers/md/errors/api_suspended), [`consent_required`](/developers/md/errors/consent_required) |
| 404 | [`not_found`](/developers/md/errors/not_found) |
| 409 | [`conflict`](/developers/md/errors/conflict), [`idempotency_key_reused`](/developers/md/errors/idempotency_key_reused), [`request_in_progress`](/developers/md/errors/request_in_progress) |
| 429 | [`rate_limited`](/developers/md/errors/rate_limited), [`quota_exceeded`](/developers/md/errors/quota_exceeded) |
| 503 | [`service_unavailable`](/developers/md/errors/service_unavailable) |

Every error is an `application/problem+json` body with a `code`, a `fix` sentence and `next_actions`. See [reading a problem response](/developers/md/guides/agents#reading-a-problem-response).

## Typical next steps

- [`send_test_webhook`](/developers/md/operations/send_test_webhook)

## Related

- [OpenAPI document](https://api.seemly.com/v1/openapi.json)
- [Agent guide](/developers/md/guides/agents)
