---
title: "Rotate a trigger secret"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cloudraker.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rotate a trigger secret

Path: CloudRaker Workspace API › Workspace Triggers

`POST /triggers/{triggerId}/rotate-secret`

## Authentication

- `bearerAuth`, http, header `Authorization`

## Path parameters

- `triggerId` (`rotateTriggerSecret.path.triggerId`; string, required)
  - maxLength 128; pattern `^trg_[A-Za-z0-9_-]+$`

## Request body

_Required._

- `requestId` (`rotateTriggerSecret.requestId`; string, required)
  - minLength 1; maxLength 200

## Example request

```json
{
  "requestId": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url 'https://api.cloudraker.com/triggers/<triggerId>/rotate-secret' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "requestId": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.cloudraker.com/triggers/<triggerId>/rotate-secret';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({requestId: 'string'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.cloudraker.com/triggers/<triggerId>/rotate-secret"

payload = { "requestId": "string" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

The one-time replacement secret.

#### Example

```json
{
  "data": {
    "secret": "string",
    "secretPreview": "string"
  }
}
```

- `data` (`rotateTriggerSecret.response.200.data`; object, required)
  - `secret` (`rotateTriggerSecret.response.200.data.secret`; string, required)
  - `secretPreview` (`rotateTriggerSecret.response.200.data.secretPreview`; string, required)

### 400

`validation_failed`: a request parameter or body field is invalid.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`rotateTriggerSecret.response.400.error`; string, required) — The sentence a human reads.
- `error_code` (`rotateTriggerSecret.response.400.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`rotateTriggerSecret.response.400.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`rotateTriggerSecret.response.400.issues.path`; string, required)
  - `code` (`rotateTriggerSecret.response.400.issues.code`; string, required)
  - `message` (`rotateTriggerSecret.response.400.issues.message`; string, required)

### 404

`not_found` — No such trigger, or the caller may not see it.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`rotateTriggerSecret.response.404.error`; string, required) — The sentence a human reads.
- `error_code` (`rotateTriggerSecret.response.404.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`rotateTriggerSecret.response.404.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`rotateTriggerSecret.response.404.issues.path`; string, required)
  - `code` (`rotateTriggerSecret.response.404.issues.code`; string, required)
  - `message` (`rotateTriggerSecret.response.404.issues.message`; string, required)

### 409

`trigger_conflict` — that webhook address or email address is already used in this organization, or a channel key rotation is unsettled; `trigger_limit` — 50 enabled triggers is the maximum; `trigger_migration_in_progress` — a legacy transfer still owns this source.

#### Example

```json
{
  "error": "string",
  "error_code": "string",
  "issues": [
    {
      "path": "string",
      "code": "string",
      "message": "string"
    }
  ]
}
```

- `error` (`rotateTriggerSecret.response.409.error`; string, required) — The sentence a human reads.
- `error_code` (`rotateTriggerSecret.response.409.error_code`; string, required) — The stable snake_case branch key.
- `issues` (`rotateTriggerSecret.response.409.issues`; array<object>, optional) — Per-field detail, present only on a validation failure.
  - `path` (`rotateTriggerSecret.response.409.issues.path`; string, required)
  - `code` (`rotateTriggerSecret.response.409.issues.code`; string, required)
  - `message` (`rotateTriggerSecret.response.409.issues.message`; string, required)


Source: https://docs.cloudraker.com/workspace/api/workspace-triggers/rotate-trigger-secret/index.md
