> This page is for Itential Platform Cloud.

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

# Update a trigger

PATCH https://example.itential.io/trigger-service/triggers/{triggerId}
Content-Type: application/json

Edits a trigger, such as its name, description, resource action, manual form and inputs, POST body schema, endpoint route name, or event source, topic, and schema. Can also enable or disable the trigger set that owns it.

Reference: https://docs.itential.com/itential-cloud/api-reference/trigger-service/triggers-edit-trigger

## Authentication

- `Authorization` header (basic auth, required) — Basic authentication of the form `Basic <base64(username:password)>`.

## Request

### Path parameters

- `triggerId` (string, required) — The trigger's unique identifier (triggers._id), a UUIDv7.

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional) — The Trigger's new name, shared by every Trigger under the same owning set. Must contain at least one character that is not whitespace.
- `description` (string, optional)
- `enabled` (boolean, optional) — Master switch that determines whether the trigger and any services associated with it can fire. Omit to leave unchanged.
- `resourceAction` (TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaResourceAction, optional) — Replaces the Trigger's whole resource action setting. Omit to leave it unchanged. Only for a Trigger of a resource model.
- `bodySchema` (TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaBodySchema, optional) — Replaces the stored POST body schema of an API on-demand Trigger, whole. Omit to leave it unchanged; it can't be cleared. It is stored as given, and a body that does not match it is rejected when the endpoint is called. A schema that cannot be used (an unknown keyword, a $ref to nothing, an unknown $schema or format, or $async) is rejected with a 400 and the reason. Rejected for any other kind of Trigger.
- `legacyWrapper` (boolean, optional) — Legacy field, kept only to support workflows written for the old input shape: before July 2023, Operations Manager passed form values to the workflow inside one variable named `formData`. Omit to leave unchanged. Turning it on is refused unless the trigger's asset is a workflow, and supplying it for an API on-demand trigger is refused.
- `source` (string, optional) — Points an event Trigger at another event source, which the platform must declare. Omit to keep the current one. Rejected for any other kind of Trigger.
- `topic` (string, optional) — Points an event Trigger at another topic, which the platform must declare under the source. Omit to keep the current one. 'jobStart' and 'jobComplete' are rejected. Rejected for any other kind of Trigger.
- `formId` (string, optional) — Points a manual on-demand Trigger, and its service, at another form. Omit to leave it unchanged; to remove the form, use `clearForm`. The new form is looked up and the stored form values are cleaned against it: a form that cannot be loaded refuses the edit. Resending the stored value changes nothing and makes no lookup. Rejected for an API on-demand Trigger or a manual one with no service, and for a schedule or event Trigger. The platform removes a null or an empty string from a call before it is validated, so either one is the same as leaving the field out.
- `inputs` (TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaInputs, optional) — Replaces the form values stored on a manual on-demand Trigger, whole; an empty object is a value. Omit to leave them unchanged. They are cleaned against the Trigger's form, as when a Trigger is created, so values the form no longer has are dropped, and a form that cannot be loaded refuses the edit, an empty object included. A Trigger with no form stores them as sent. Resending the stored value changes nothing and makes no lookup. Rejected in the same cases as `formId`. The platform removes a null from a call before it is validated, so it is the same as leaving the field out.
- `clearForm` (boolean, optional) — Removes the form from a manual on-demand Trigger and from its service; false, or leaving it out, changes nothing. No form is looked up. It is a flag because the platform removes a null from a call before it is validated, so a null formId could never arrive. Rejected together with `formId`, and in the same cases as `formId`.
- `routeName` (string, optional) — Gives an API on-demand Trigger another route name. Letters of either case, digits, underscores and hyphens; case-sensitive and stored exactly as typed, so the same letters in another case are another route. Omit to leave it unchanged. Rejected when another API Trigger, enabled or disabled, already has the new route name. A set that is being enabled is checked the same way, even when its route name is not edited; an edit that changes neither is not checked. Rejected for a manual on-demand Trigger and for a schedule or event Trigger.
- `jst` (string, optional) — Replaces the JST of an API on-demand Trigger or an event Trigger, by id (an event Trigger stores it as `jstId`); it is not looked up. Omit to leave it unchanged; to remove it, use `clearJst`. Rejected for a manual on-demand Trigger and for a schedule Trigger.
- `schema` (TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaSchema, optional) — Replaces the payload schema an event Trigger filters received events by, whole. Omit to leave it unchanged; it can't be removed. An empty object is a schema that accepts every payload. It is stored as given and not tested against any event; it is read from the stored Trigger when an event arrives. A schema that cannot be used (an unknown keyword, a $ref to nothing, an unknown $schema or format, or $async) is rejected with a 400 and the reason. Rejected for any other kind of Trigger.
- `clearJst` (boolean, optional) — Removes the JST of an API on-demand Trigger or an event Trigger; false, or leaving it out, changes nothing, and so does a Trigger that has no JST. It is a flag because the platform removes a null from a call before it is validated, so a null jst could never arrive. Rejected together with `jst`, and in the same cases as `jst`.

## Response

### 200

result

- `triggerId` (string, required)
- `name` (string, required)
- `description` (string, required)
- `enabled` (boolean, required)
- `resourceAction` (TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaResourceAction, optional)
- `legacyWrapper` (boolean, optional) — Legacy field, kept only to support workflows written for the old input shape. Absent for an API on-demand trigger.
- `bodySchema` (TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaBodySchema, optional) — The POST body schema stored after the edit. Present only for an API on-demand Trigger that has one.
- `source` (string, optional) — The event source stored after the edit. Present only for an event Trigger.
- `topic` (string, optional) — The event topic stored after the edit. Present only for an event Trigger.
- `formId` (string, optional) — The form the Trigger references after the edit. Present only for a manual on-demand Trigger that has one.
- `inputs` (TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaInputs, optional) — The form values stored after the edit. Present only for a manual on-demand Trigger.
- `routeName` (string, optional) — The route name stored after the edit, exactly as typed. Present only for an API on-demand Trigger.
- `jst` (string, optional) — The id of the JST stored after the edit. Present only for an API on-demand or an event Trigger that has one.
- `schema` (TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaSchema, optional) — The payload schema stored after the edit. Present only for an event Trigger that has one.

## Errors

### 500 Internal Server Error

Error response from API

- `any`

## Types

### TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaResourceAction

Replaces the Trigger's whole resource action setting. Omit to leave it unchanged. Only for a Trigger of a resource model.

- `actionId` (string, required) — Id of the Lifecycle Manager action to run: four hexadecimal characters.
- `targetType` (enum, optional) — Whether the target is one instance or a group. Goes with targetIdentifier.
  - Allowed values: `instance`, `group`
- `targetIdentifier` (string, optional) — Name of the target instance or group.
- `chooseTargetAtRuntime` (boolean, optional) — Choose the target each time the Trigger is fired instead of storing one. Only for on-demand Triggers; any target given with it is dropped.

### TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaBodySchema

Replaces the stored POST body schema of an API on-demand Trigger, whole. Omit to leave it unchanged; it can't be cleared. It is stored as given, and a body that does not match it is rejected when the endpoint is called. A schema that cannot be used (an unknown keyword, a $ref to nothing, an unknown $schema or format, or $async) is rejected with a 400 and the reason. Rejected for any other kind of Trigger.

### TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaInputs

Replaces the form values stored on a manual on-demand Trigger, whole; an empty object is a value. Omit to leave them unchanged. They are cleaned against the Trigger's form, as when a Trigger is created, so values the form no longer has are dropped, and a form that cannot be loaded refuses the edit, an empty object included. A Trigger with no form stores them as sent. Resending the stored value changes nothing and makes no lookup. Rejected in the same cases as `formId`. The platform removes a null from a call before it is validated, so it is the same as leaving the field out.

### TriggerServiceTriggersTriggerIdPatchRequestBodyContentApplicationJsonSchemaSchema

Replaces the payload schema an event Trigger filters received events by, whole. Omit to leave it unchanged; it can't be removed. An empty object is a schema that accepts every payload. It is stored as given and not tested against any event; it is read from the stored Trigger when an event arrives. A schema that cannot be used (an unknown keyword, a $ref to nothing, an unknown $schema or format, or $async) is rejected with a 400 and the reason. Rejected for any other kind of Trigger.

### TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaResourceAction

- `actionId` (string, required)
- `chooseTargetAtRuntime` (boolean, required)
- `targetType` (enum, optional)
  - Allowed values: `instance`, `group`
- `targetIdentifier` (string, optional)

### TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaBodySchema

The POST body schema stored after the edit. Present only for an API on-demand Trigger that has one.

### TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaInputs

The form values stored after the edit. Present only for a manual on-demand Trigger.

### TriggerServiceTriggersTriggerIdPatchResponsesContentApplicationJsonSchemaSchema

The payload schema stored after the edit. Present only for an event Trigger that has one.

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "triggerId": "string",
  "name": "string",
  "description": "string",
  "enabled": true,
  "resourceAction": {
    "actionId": "string",
    "chooseTargetAtRuntime": true,
    "targetType": "instance",
    "targetIdentifier": "string"
  },
  "legacyWrapper": true,
  "bodySchema": {},
  "source": "string",
  "topic": "string",
  "formId": "string",
  "inputs": {},
  "routeName": "string",
  "jst": "string",
  "schema": {}
}
```

**SDK Code**

```python
import requests

url = "https://example.itential.io/trigger-service/triggers/triggerId"

payload = {}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://example.itential.io/trigger-service/triggers/triggerId';
const options = {method: 'PATCH', headers: {'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://example.itential.io/trigger-service/triggers/triggerId"

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

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

	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://example.itential.io/trigger-service/triggers/triggerId")

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

request = Net::HTTP::Patch.new(url)
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://example.itential.io/trigger-service/triggers/triggerId")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://example.itential.io/trigger-service/triggers/triggerId', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://example.itential.io/trigger-service/triggers/triggerId");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://example.itential.io/trigger-service/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()
```