# Rotate webhook secret

**Documentation:** /reference/api-reference/webhooks/postWebhookSubscriptionsByIdRotateSecret

Generates a new signing secret for the webhook subscription. The new secret is returned only in this response.

---

## POST `/api/v3/webhook_subscriptions/{id}/rotate_secret`

**Endpoint:** `https://backend.composio.dev/api/v3/webhook_subscriptions/{id}/rotate_secret`

**Summary:** Rotate webhook secret

Generates a new signing secret for the webhook subscription. The new secret is returned only in this response.

### Authentication

**ApiKeyAuth** - API Key in `header` header `x-api-key` OR **UserApiKeyAuth** - API Key in `header` header `x-user-api-key`

### Path Parameters

- `id` (string (webhookSubscriptionId)) *(required)*: Webhook subscription ID

### Responses

#### 200 - Webhook secret rotated

**Response Schema:**

- `id` (string (webhookSubscriptionId)) *(required)*: Subscription ID
- `secret` (string) *(required)*: New signing secret

**Example Response:**

```json
{
  "id": "string",
  "secret": "string"
}
```

#### 401 - Unauthorized

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 404 - Subscription not found

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

#### 500 - Internal server error

**Response Schema:**

- `error` (object) *(required)*
  - `message` (string) *(required)*
  - `code` (number) *(required)*
  - `slug` (string) *(required)*
  - `status` (number) *(required)*
  - `request_id` (string)
  - `suggested_fix` (string)
  - `errors` (array<string>)

### Example cURL Request

```bash
curl -X POST "https://backend.composio.dev/api/v3/webhook_subscriptions/string/rotate_secret" \
  -H "x-api-key: YOUR_API_KEY"
```