> This page is for Workspace app.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cloudraker.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cloudraker.com/_mcp/server.

# Update a trigger

PATCH https://api.cloudraker.com/triggers/{triggerId}
Content-Type: application/json

Reference: https://docs.cloudraker.com/workspace/api/workspace-triggers/update-trigger

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `triggerId` (string, required)

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional)
- `enabled` (boolean, optional)
- `when` (TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen, optional)
- `open` (TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaOpen, optional)
- `permissions` (TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaPermissions, optional)

## Response

### 200

The updated trigger.

- `data` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaData, required)

## Errors

### 400 Bad Request Error

`invalid_trigger` — the email address does not belong to this organization and environment; `invalid_schedule` — the schedule is not valid.

- `error` (string, required) — The sentence a human reads.
- `error_code` (string, required) — The stable snake_case branch key.
- `issues` (list of ErrorEnvelopeIssuesItems, optional) — Per-field detail, present only on a validation failure.

### 403 Forbidden Error

`run_as_inactive` — the executing member is not active in this organization.

- `error` (string, required) — The sentence a human reads.
- `error_code` (string, required) — The stable snake_case branch key.
- `issues` (list of ErrorEnvelopeIssuesItems, optional) — Per-field detail, present only on a validation failure.

### 404 Not Found Error

`space_not_found` — a named space does not exist or the executing member may not contribute to it; `agent_not_found` — a named agent does not exist.

- `error` (string, required) — The sentence a human reads.
- `error_code` (string, required) — The stable snake_case branch key.
- `issues` (list of ErrorEnvelopeIssuesItems, optional) — Per-field detail, present only on a validation failure.

### 409 Conflict Error

`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.

- `error` (string, required) — The sentence a human reads.
- `error_code` (string, required) — The stable snake_case branch key.
- `issues` (list of ErrorEnvelopeIssuesItems, optional) — Per-field detail, present only on a validation failure.

### 422 Unprocessable Entity Error

`agent_not_published` — a named agent has no published version.

- `error` (string, required) — The sentence a human reads.
- `error_code` (string, required) — The stable snake_case branch key.
- `issues` (list of ErrorEnvelopeIssuesItems, optional) — Per-field detail, present only on a validation failure.

## Types

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen

- TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen0
- TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen1
- TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen2
- TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen3

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaOpen

- `agentIds` (list of string, required)
- `spaces` (list of TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaOpenSpacesItems, required)
- `instruction` (string, required)
- `threadPolicy` (enum, required)
  - Allowed values: `new`, `reuse`
- `filesFrom` (enum, required)
  - Allowed values: `payload`, `none`
- `title` (string, optional)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaPermissions

- `runAsUserId` (string, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaData

- `name` (string, required)
- `when` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen, required)
- `open` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataOpen, required)
- `permissions` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataPermissions, required)
- `id` (string, required)
- `nextRunAt` (datetime, required, nullable)
- `triggerRef` (string, required)
- `createdAt` (datetime, required)
- `updatedAt` (datetime, required)
- `enabled` (boolean, optional, default: true)
- `lastRun` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataLastRun, optional)
- `legacy` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataLegacy, optional)

### ErrorEnvelopeIssuesItems

- `path` (string, required)
- `code` (string, required)
- `message` (string, required)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen0

- `kind` ("schedule", required)
- `schedule` (TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhenOneOf0Schedule, required)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen1

- `kind` ("email", required)
- `address` (string, required)
- `from` (list of string, optional)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen2

- `kind` ("webhook", required)
- `slug` (string, required)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhen3

- `kind` ("manual", required)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaOpenSpacesItems

- `spaceId` (string, required)
- `access` (enum, required)
  - Allowed values: `read`, `commit`

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen

- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen0
- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen1

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataOpen

- `agentIds` (list of string, required)
- `spaces` (list of TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataOpenSpacesItems, required)
- `instruction` (string, required)
- `threadPolicy` (enum, required)
  - Allowed values: `new`, `reuse`
- `filesFrom` (enum, required)
  - Allowed values: `payload`, `none`
- `title` (string, optional)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataPermissions

- `runAsUserId` (string, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataLastRun

- `status` (enum, required)
  - Allowed values: `opened`, `busy`, `needs_input`, `blocked`, `error`
- `at` (datetime, required)
- `sessionId` (string, optional)
- `message` (string, optional)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataLegacy

- `channelId` (string, optional)
- `channelType` (enum, optional)
  - Allowed values: `email`, `webhook`
- `automationId` (string, optional)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhenOneOf0Schedule

- TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhenOneOf0Schedule0
- TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhenOneOf0Schedule1

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen0

- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen00
- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen01
- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen02
- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen03

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen1

- `kind` ("webhook", required)
- `slug` (string, required)
- `secretPreview` (string, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataOpenSpacesItems

- `spaceId` (string, required)
- `access` (enum, required)
  - Allowed values: `read`, `commit`

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhenOneOf0Schedule0

- `kind` ("cron", required)
- `expression` (string, required)
- `timezone` (string, required)

### TriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaWhenOneOf0Schedule1

- `kind` ("once", required)
- `at` (datetime, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen00

- `kind` ("schedule", required)
- `schedule` (TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhenOneOf0OneOf0Schedule, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen01

- `kind` ("email", required)
- `address` (string, required)
- `from` (list of string, optional)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen02

- `kind` ("webhook", required)
- `slug` (string, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhen03

- `kind` ("manual", required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhenOneOf0OneOf0Schedule

- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhenOneOf0OneOf0Schedule0
- TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhenOneOf0OneOf0Schedule1

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhenOneOf0OneOf0Schedule0

- `kind` ("cron", required)
- `expression` (string, required)
- `timezone` (string, required)

### TriggersTriggerIdPatchResponsesContentApplicationJsonSchemaDataWhenOneOf0OneOf0Schedule1

- `kind` ("once", required)
- `at` (datetime, required)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "name": "string",
    "when": {
      "kind": "string",
      "schedule": {
        "expression": "string",
        "kind": "string",
        "timezone": "string"
      }
    },
    "open": {
      "agentIds": [
        "string"
      ],
      "spaces": [
        {
          "spaceId": "string",
          "access": "read"
        }
      ],
      "instruction": "string",
      "threadPolicy": "new",
      "filesFrom": "payload",
      "title": "string"
    },
    "permissions": {
      "runAsUserId": "string"
    },
    "id": "string",
    "nextRunAt": "2024-01-15T09:30:00Z",
    "triggerRef": "string",
    "createdAt": "2024-01-15T09:30:00Z",
    "updatedAt": "2024-01-15T09:30:00Z",
    "enabled": true,
    "lastRun": {
      "status": "opened",
      "at": "2024-01-15T09:30:00Z",
      "sessionId": "string",
      "message": "string"
    },
    "legacy": {
      "channelId": "string",
      "channelType": "email",
      "automationId": "string"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.cloudraker.com/triggers/triggerId"

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

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

print(response.json())
```

```javascript
const url = 'https://api.cloudraker.com/triggers/triggerId';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cloudraker.com/triggers/triggerId"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cloudraker.com/triggers/triggerId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("https://api.cloudraker.com/triggers/triggerId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.cloudraker.com/triggers/triggerId', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/triggers/triggerId");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/triggers/triggerId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```