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

# Rotate a webhook secret

> Replace the signing secret without missing a verification.

Replaces the webhook's signing secret. The response includes the new `secret`; like [Create](/computer-use-agents/webhooks/create), this is the only time it is returned, so store it securely. Deliveries are signed at send time, so events (including retries already in flight) are signed with the new secret from this point on.

**Returns** the webhook object plus its new `secret`.

<Warning>
  Update your receiver to accept both the old and the new secret **before** calling this endpoint. The SDK verify helpers accept a list of secrets for exactly this overlap: `verify_webhook(body, sig, ts, ["whsec_old", "whsec_new"])`. Remove the old secret once deliveries verify against the new one.
</Warning>

***

## Path parameters

<ParamField path="webhook_id" type="string" required>
  The webhook's `id` (UUID).
</ParamField>

***

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://agp.eu.hcompany.ai/api/v2/webhooks/f47ac10b-58cc-4372-a567-0e02b2c3d479/rotate \
    -H "Authorization: Bearer $HAI_API_KEY"
  ```

  ```python Python theme={null}
  from hai_agents import Client

  client = Client()  # reads HAI_API_KEY from the environment

  webhook = client.webhooks.rotate_webhook_secret(webhook_id="f47ac10b-58cc-4372-a567-0e02b2c3d479")
  print(webhook.secret)  # store it now; it is never returned again
  ```

  ```typescript TypeScript theme={null}
  import { HaiAgentsClient } from "hai-agents";

  const client = new HaiAgentsClient(); // reads HAI_API_KEY from the environment

  const webhook = await client.webhooks.rotateWebhookSecret({ webhookId: "f47ac10b-58cc-4372-a567-0e02b2c3d479" });
  console.log(webhook.secret); // store it now; it is never returned again
  ```
</CodeGroup>

```json Response theme={null}
{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "url": "https://example.com/hooks/h",
  "enabled_events": ["*"],
  "description": "Production listener",
  "disabled": false,
  "created_at": "2026-06-11T15:04:05Z",
  "updated_at": "2026-07-02T09:00:00Z",
  "secret": "whsec_nZbY0eXaMpLeOnLyDoNotUse0aQ3rT5uV7wX9yZ1aB3c"
}
```

***

## Errors

| Status | Cause                                       |
| ------ | ------------------------------------------- |
| `404`  | Webhook not found or you don't have access. |
