---
title: Rotate webhook secret
url: https://anyrow.ai/docs/api/webhooks/rotate-secret
canonical_url: https://anyrow.ai/docs/api/webhooks/rotate-secret
---

# Rotate webhook secret

`POST /v1/organizations/{organization_id}/webhooks/{id}/rotate-secret`

Authentication: `Authorization: ApiKey {your_api_key}`.

## Path parameters

- `organization_id` (string, required)
- `id` (string, required)

## Returns

200 `application/json`.

- `created_at` (integer, required): At least 0.
- `updated_at` (integer, required): At least 0.
- `id` (string, required): 1 to 48 characters.
- `name` (string, required, nullable): Up to 64 characters.
- `organization_id` (string, required): 1 to 48 characters.
- `url` (string, required): Up to 2048 characters.
- `secret_rotated_at` (integer, required, nullable): At least 0.
- `active` (boolean, required)
- `failure_count` (integer, required): At least 0.
- `last_triggered_at` (integer, required, nullable): At least 0.
- `events` (array of strings, required): At least 1 items.
- `secret` (string, required)

## Errors

- 404: `not_found`, `webhook_not_found`

Errors every endpoint can return: [Errors](https://anyrow.ai/docs/api/errors.md).

## Request

```ts title="Node.js"
import { AnyrowSDK } from "@anyrow/sdk"

const anyrow = new AnyrowSDK({
  baseURL: "https://api.anyrow.ai",
  headers: { Authorization: `ApiKey ${process.env.ANYROW_API_KEY}` },
})

const { data, error } = await anyrow.webhook.rotateSecret({
  params: {
    organization_id: "{organization_id}",
    id: "{id}"
  },
})
```

```bash title="cURL"
curl -X POST 'https://api.anyrow.ai/v1/organizations/{organization_id}/webhooks/{id}/rotate-secret' \
  -H 'Authorization: ApiKey {your_api_key}'
```

```js title="JavaScript"
const response = await fetch("https://api.anyrow.ai/v1/organizations/{organization_id}/webhooks/{id}/rotate-secret", {
  method: "POST",
  headers: {
    Authorization: "ApiKey {your_api_key}",
  },
})
const data = await response.json()
```

```python title="Python"
import requests

response = requests.post(
    "https://api.anyrow.ai/v1/organizations/{organization_id}/webhooks/{id}/rotate-secret",
    headers={
        "Authorization": "ApiKey {your_api_key}",
    },
)
print(response.json())
```

## Response

```json title="200"
{
  "created_at": 1711468800000,
  "updated_at": 1711468800000,
  "id": "whook_01h5a3g8k9m2n4p6q8r0t2v4x6",
  "name": "string",
  "organization_id": "string",
  "url": "https://example.com",
  "secret_rotated_at": 1711468800000,
  "active": true,
  "failure_count": 42,
  "last_triggered_at": 1711468800000,
  "events": [
    "batch.complete"
  ],
  "secret": "string"
}
```
