# Rotate the signing secret for a webhook subscription

**POST /v1/webhooks/{subscriptionId}/rotate-secret**

Generates and returns a NEW signing secret, invalidating the old one immediately. The response is one of only two places the secret ever appears (the other is the 201 from POST /v1/webhooks). Each call rotates again, so a blind retry after a timeout can leave you holding a stale secret - fetch deliveries failing signature verification is the symptom. Rotate, store, then verify with POST /v1/webhooks/{subscriptionId}/test.

## Servers
- https://api.isnotai.com (Production (US))
- https://api-eu.isnotai.com (Production (EU))

API keys are region-bound: a key authenticates only against the base URL of the region it was minted in. The other region returns 401 INVALID_API_KEY.

## Authentication methods
- bearer_auth
- api_key

Send the API key as `Authorization: Bearer aik_v1_...` (preferred) or in the `x-api-key` header. Per-key rate-limit isolation applies only to the Bearer form. See [Authentication](https://www.isnotai.com/developers/authentication.md).

## Path parameters

- **subscriptionId** (string) *Required*
  Subscription id.


## Responses
### 200
Payload of WebhookSubscriptionCreatedResponse

Response body (application/json):
- **data** (object)
  - **id** (string)
  - **integrationId** (string)
  - **url** (string)
  - **eventType** (string) [enum: [BotDetected, SessionAnomaly, ThresholdExceeded, AlertTriggered, ReportReady, SessionCorrelated, WritingSessionScored]]
    Event type name (string). Requests accept the name case-insensitively; responses return the PascalCase form shown here. Integers never appear on the wire.
  - **name** (string)
  - **enabled** (boolean)
  - **threshold** (any)
  - **createdAt** (string(date-time))
  - **updatedAt** (string(date-time))
  - **lastDeliveryAt** (string(date-time))
  - **lastDeliveryStatus** (string) [enum: [Pending, Delivered, Failed, MaxRetriesExceeded, PermanentFailure, PoisonAborted, ]]
    Outcome of the most recent delivery attempt (string). Null until the first delivery.
  - **disabledAt** (string(date-time))
  - **disabledReason** (string)
  - **disabledFailureClass** (string)
  - **disabledDeliveryId** (string)
  - **secret** (string)
    One-time signing secret for X-Webhook-Signature verification. Returned ONLY by POST /v1/webhooks and POST /v1/webhooks/{subscriptionId}/rotate-secret; no other response ever includes it. Store it immediately; if lost, rotate.

### 401
Payload of ErrorEnvelope

Response body (application/json):
- **error** (object)
  - **code** (string) *Required*
  - **message** (string) *Required*
  - **details** (object) *Required*
    Always present and null unless the error carries field-level context (validation errors set details.field to the offending parameter name).

### 404
Payload of ErrorEnvelope

Response body (application/json):
- **error** (object)
  - **code** (string) *Required*
  - **message** (string) *Required*
  - **details** (object) *Required*
    Always present and null unless the error carries field-level context (validation errors set details.field to the offending parameter name).

Any authenticated route can also return 401 (missing or invalid key), 429 RATE_LIMITED (edge rate limit; Retry-After is an integer number of seconds), and 5xx errors, even where not listed above. See [Error Handling](https://www.isnotai.com/developers/error-handling.md) and [Rate Limits](https://www.isnotai.com/developers/rate-limits.md).

