# Rotate a webhook URL (/en/docs/api/native/automation/rotateTriggerWebhook)





For webhook triggers only: invalidate the old token immediately and return a new full webhook_url. Later detail reads do not reveal the full URL.

`POST /automation/v1/triggers/{id}/rotate-webhook`

## Authentication [#authentication]

`Authorization: Bearer $PRAXIS_API_KEY`

## Request fields [#request-fields]

| Parameter | Type | Description |
| --- | --- | --- |
| path: id | `string` | required; Trigger ID (trg_). |

## Examples [#examples]

[SDK installation and example environment](/en/docs/api/native/automation)

Set these environment variables to your own resources:

| Variable | Source |
| --- | --- |
| TRIGGER_ID | [Trigger id; resume before sending a webhook](/en/docs/api/native/automation/createTrigger) |

```bash
: "${TRIGGER_ID:?Set TRIGGER_ID}"
curl --fail-with-body -X POST "https://api.deepraxis.ai/automation/v1/triggers/${TRIGGER_ID}/rotate-webhook" \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{}'
```

```typescript
import { createAutomationClient } from '@deepraxis/sdk/automation';

function env(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
}
const automation = createAutomationClient({
  apiKey: env('PRAXIS_API_KEY'),
  baseUrl: 'https://api.deepraxis.ai',
  maxRetries: 0,
  timeoutMs: 90_000,
});
const result = await automation.triggers.rotateWebhook({
  "path": {
    "id": env("TRIGGER_ID")
  },
  "body": {}
});
console.log(result);
```

## Response [#response]

### HTTP 200 [#http-200]

Success

`application/json`

| Field | Type | Description |
| --- | --- | --- |
| webhook_url | `string` | required; The new full webhook URL including its secret token; returned only once, so store it safely, and rotate again if it is lost. The previous URL stops working immediately. format: "uri" |

### Measured response [#measured-response]

HTTP 200

```json
{
  "webhook_url": "https://api-develop.deepraxis.ai/automation/v1/hooks/trg_00mv67mzzqa0d63b98d72446dd9d1331051a3e100e/${WEBHOOK_TOKEN}"
}
```

## Errors [#errors]

| HTTP | Codes and description |
| --- | --- |
| 400 | INVALID_PARAMS: Invalid request parameters, path, cursor, or body format. |
| 404 | TRIGGER_NOT_FOUND: The trigger does not exist or is inaccessible. Webhook authentication failures also use this code. |
| default | RFC 9457 automation problem. 429 includes Retry-After. |

[Authentication and common errors](/en/docs/api/errors) · Retain the `X-Request-Id` response header for troubleshooting.
