An object trigger consists of one or more actions performed when the specified custom object's records are created or updated. The actions are performed only if certain conditions are met. For example, with a custom object named Asset, an object trigger can notify the asset owner any time their asset's record is updated or a new asset is created and they're listed as the owner.

For more information on conditions and actions, see the following article:

Ordering object triggers

Object triggers are checked from first to last, based on their position parameter, each time an object is created or updated. The order of object triggers is important because the actions of one object trigger may affect another trigger. New object triggers are added in last place by default. A deactivated trigger preserves its position value, and position values must be unique across all triggers (active and inactive) associated with the same object.

For more information, see Understanding object triggers.

For ticket trigger API docs, see Ticket Triggers.

JSON format

Object Triggers are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
actionsarrayfalsetrueAn array of actions the trigger does when its conditions are met. See Actions reference
activebooleanfalsefalseWhether the trigger is active
conditionsobjectfalsetrueAn object that describes the circumstances under which the trigger performs its actions. See Conditions reference
created_atstringtruefalseThe time the trigger was created
defaultbooleantruefalseAlways false for object triggers
descriptionstringfalsefalseThe description of the trigger
idintegertruefalseAutomatically assigned when created
positionintegerfalsefalsePosition of the trigger, determines the order they will execute in
raw_titlestringfalsefalseThe raw format of the title of the trigger
titlestringfalsetrueThe title of the trigger
updated_atstringtruefalseThe time of the last update of the trigger
urlstringtruefalseThe url of the trigger

Example

{  "actions": [    {}  ],  "active": true,  "conditions": {},  "created_at": "2024-07-08T20:44:32Z",  "default": false,  "description": "Sets mile count when heat not present on order custom object",  "id": 25,  "position": 8,  "raw_title": "CO trigger with tagger field condition",  "title": "CO trigger with tagger field condition",  "updated_at": "2024-07-08T20:44:32Z",  "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/25.json"}

List Object Triggers

  • GET /api/v2/custom_objects/{custom_object_key}/triggers

Lists all triggers for the specified custom object.

Allowed For

  • Agents

Parameters

NameTypeInRequiredDescription
activebooleanQueryfalseFilter by active triggers if true or inactive triggers if false
sort_bystringQueryfalseOffset pagination only. Possible values are "alphabetical", "created_at", "updated_at", "usage_1h", "usage_24h", or "usage_7d". Defaults to "position"
sort_orderstringQueryfalseOne of "asc" or "desc". Defaults to "asc" for alphabetical and position sort, "desc" for all others
custom_object_keystringPathtrueThe key of a custom object

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers.json \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers?active=true&sort_by=position&sort_order=desc"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers")		.newBuilder()		.addQueryParameter("active", "true")		.addQueryParameter("sort_by", "position")		.addQueryParameter("sort_order", "desc");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'active': 'true',    'sort_by': 'position',    'sort_order': 'desc',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers?active=true&sort_by=position&sort_order=desc"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers")uri.query = URI.encode_www_form("active": "true", "sort_by": "position", "sort_order": "desc")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "count": 2,  "next_page": null,  "previous_page": null,  "triggers": [    {      "actions": [],      "active": true,      "conditions": {},      "created_at": "2024-06-27T16:51:54Z",      "description": "A trigger for custom object of type = order",      "id": 25,      "position": 1,      "raw_title": "Order object trigger",      "title": "Order object trigger",      "updated_at": "2024-06-27T16:51:54Z",      "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/25.json"    },    {      "actions": [],      "active": false,      "conditions": {        "all": [          {            "field": "custom_object.order.custom_fields.heat",            "operator": "not_present"          }        ],        "any": []      },      "created_at": "2024-07-08T20:44:32Z",      "description": "Check order's heat and set field as needed",      "id": 26,      "position": 2,      "raw_title": "Set order miles when heat not present",      "title": "Set order miles when heat not present",      "updated_at": "2024-07-08T20:44:32Z",      "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/26.json"    }  ]}

List Active Object Triggers

  • GET /api/v2/custom_objects/{custom_object_key}/triggers/active

Lists all active object triggers.

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

See Pagination.

Returns a maximum of 100 records per page.

Allowed For

  • Administrators
  • Agents in custom roles with the manage_triggers permission (Enterprise only)

Parameters

NameTypeInRequiredDescription
sort_bystringQueryfalseOffset pagination only. Possible values are "alphabetical", "created_at", "updated_at", "usage_1h", "usage_24h", or "usage_7d". Defaults to "position"
sort_orderstringQueryfalseOne of "asc" or "desc". Defaults to "asc" for alphabetical and position sort, "desc" for all others
custom_object_keystringPathtrueThe key of a custom object

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/active \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/active?sort_by=position&sort_order=desc"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/active")		.newBuilder()		.addQueryParameter("sort_by", "position")		.addQueryParameter("sort_order", "desc");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/active',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'sort_by': 'position',    'sort_order': 'desc',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/active?sort_by=position&sort_order=desc"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/active")uri.query = URI.encode_www_form("sort_by": "position", "sort_order": "desc")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "count": 1,  "next_page": null,  "previous_page": null,  "triggers": [    {      "actions": [],      "active": true,      "conditions": {},      "created_at": "2024-06-27T16:51:54Z",      "description": "A trigger for custom object of type = order",      "id": 25,      "position": 1,      "raw_title": "Order object trigger",      "title": "Order object trigger",      "updated_at": "2024-06-27T16:51:54Z",      "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/25.json"    }  ]}

Search Object Triggers

  • GET /api/v2/custom_objects/{custom_object_key}/triggers/search?query={query}

Returns a list of object triggers that meet your filter or search criteria.

Pagination

  • Offset pagination only

See Using Offset Pagination.

Allowed For

  • Agents

Filter

Use the filter query parameter to filter an object trigger search by one or more attributes. For example, the following filter argument filters object triggers by the title attribute:

{  "json": {    "title": "test"  }}

Parameters

NameTypeInRequiredDescription
activebooleanQueryfalseFilter by active triggers if true or inactive triggers if false
filterobjectQueryfalseTrigger attribute filters for the search. See Filter
includestringQueryfalseA sideload to include in the response. See Sideloads
querystringQuerytrueQuery string used to find all triggers with matching title
sortstringQueryfalseCursor-based pagination only. Possible values are "alphabetical", "created_at", "updated_at", or "position".
sort_bystringQueryfalseOffset pagination only. Possible values are "alphabetical", "created_at", "updated_at", "usage_1h", "usage_24h", or "usage_7d". Defaults to "position"
sort_orderstringQueryfalseOne of "asc" or "desc". Defaults to "asc" for alphabetical and position sort, "desc" for all others
custom_object_keystringPathtrueThe key of a custom object

Code Samples

curl
# With `query`:curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/search.json?query=close \  -v -u {email_address}/token:{api_token}
# With `filter`:curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/search.json \  -G --data-urlencode 'filter={"json":{"title":"test"}}' \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/search?active=true&filter=&include=usage_24h&query=important_trigger&sort=position&sort_by=position&sort_order=desc"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/search")		.newBuilder()		.addQueryParameter("active", "true")		.addQueryParameter("filter", "")		.addQueryParameter("include", "usage_24h")		.addQueryParameter("query", "important_trigger")		.addQueryParameter("sort", "position")		.addQueryParameter("sort_by", "position")		.addQueryParameter("sort_order", "desc");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/search',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'active': 'true',    'filter': '',    'include': 'usage_24h',    'query': 'important_trigger',    'sort': 'position',    'sort_by': 'position',    'sort_order': 'desc',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/search?active=true&filter=&include=usage_24h&query=important_trigger&sort=position&sort_by=position&sort_order=desc"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/search")uri.query = URI.encode_www_form("active": "true", "filter": "", "include": "usage_24h", "query": "important_trigger", "sort": "position", "sort_by": "position", "sort_order": "desc")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "count": 1,  "next_page": null,  "previous_page": null,  "triggers": [    {      "actions": [        {          "field": "custom_object.order.custom_fields.miles",          "value": "100"        }      ],      "active": true,      "conditions": {        "all": [          {            "field": "custom_object.order.custom_fields.heat",            "operator": "is",            "value": "1"          }        ],        "any": []      },      "created_at": "2024-07-09T21:29:59Z",      "description": "",      "id": 28,      "position": 1,      "raw_title": "Testing CO trigger with tagger field condition",      "title": "Testing CO trigger with tagger field condition",      "updated_at": "2024-07-09T21:29:59Z",      "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/28.json"    }  ]}

Show Object Trigger

  • GET /api/v2/custom_objects/{custom_object_key}/triggers/{trigger_id}

Returns details of a specific object trigger.

Allowed For

  • Agents

Parameters

NameTypeInRequiredDescription
custom_object_keystringPathtrueThe key of a custom object
trigger_idintegerPathtrueThe ID of the trigger

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/{trigger_id}.json \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/198"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/198")		.newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/198',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/198"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/198")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "active": true,    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "created_at": "2024-07-08T22:34:49Z",    "description": "",    "id": 27,    "position": 3,    "raw_title": "active test order trigger with any conditions",    "title": "active test order trigger with any conditions",    "updated_at": "2024-07-08T22:34:49Z",    "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/27.json"  }}

List Object Trigger Action and Condition Definitions

  • GET /api/v2/custom_objects/{custom_object_key}/triggers/definitions

Lists the conditions and actions of all triggers for the specified custom object.

Allowed For

  • Agents

Parameters

NameTypeInRequiredDescription
custom_object_keystringPathtrueThe key of a custom object

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/definitions.json \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/definitions"	method := "GET"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/definitions")		.newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("GET", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'GET',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/definitions',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/definitions"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"GET",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/definitions")request = Net::HTTP::Get.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "definitions": {    "actions": [      {        "group": "custom_object",        "nullable": true,        "repeatable": false,        "subject": "custom_object.order.custom_fields.due",        "title": "due",        "type": "date",        "values": [          {            "enabled": true,            "format": "date",            "title": "Set to a specific date",            "value": "specific_date"          },          {            "enabled": true,            "format": "text",            "title": "Set to a number of days from now",            "value": "days_from_now"          }        ]      },      {        "group": "custom_object",        "nullable": true,        "repeatable": false,        "subject": "custom_object.order.custom_fields.fulfilled",        "title": "Fulfilled",        "type": "list",        "values": [          {            "enabled": true,            "title": "Checked",            "value": "true"          },          {            "enabled": true,            "title": "Unchecked",            "value": "false"          }        ]      },      {        "group": "custom_object",        "nullable": true,        "repeatable": false,        "subject": "custom_object.order.custom_fields.heat",        "title": "heat",        "type": "text"      },      {        "group": "custom_object",        "nullable": true,        "repeatable": false,        "subject": "custom_object.order.custom_fields.miles",        "title": "miles",        "type": "text"      }    ],    "conditions_all": [      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          }        ],        "repeatable": false,        "subject": "update_type",        "title": "Order",        "type": "list",        "values": [          {            "enabled": true,            "title": "Created",            "value": "Create"          },          {            "enabled": true,            "title": "Updated",            "value": "Change"          }        ]      },      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "format": "date",            "terminal": false,            "title": "Is",            "value": "is"          },          {            "format": "date",            "terminal": false,            "title": "Is not",            "value": "is_not"          },          {            "format": "date",            "terminal": true,            "title": "Present",            "value": "present"          },          {            "format": "date",            "terminal": true,            "title": "Not present",            "value": "not_present"          },          {            "format": "date",            "terminal": false,            "title": "Before",            "value": "less_than"          },          {            "format": "date",            "terminal": false,            "title": "Before or on",            "value": "less_than_equal"          },          {            "format": "date",            "terminal": false,            "title": "After",            "value": "greater_than"          },          {            "format": "date",            "terminal": false,            "title": "After or on",            "value": "greater_than_equal"          },          {            "format": "integer",            "terminal": false,            "title": "Is within the previous",            "value": "within_previous_n_days"          },          {            "format": "integer",            "terminal": false,            "title": "Is within the next",            "value": "within_next_n_days"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.due",        "title": "due",        "type": "date"      },      {        "group": "custom_object",        "nullable": true,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.fulfilled",        "title": "Fulfilled",        "type": "list",        "values": [          {            "enabled": true,            "title": "Checked",            "value": "true"          },          {            "enabled": true,            "title": "Unchecked",            "value": "false"          }        ]      },      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          },          {            "terminal": false,            "title": "Is not",            "value": "is_not"          },          {            "terminal": true,            "title": "Present",            "value": "present"          },          {            "terminal": true,            "title": "Not present",            "value": "not_present"          },          {            "terminal": false,            "title": "Contains at least one of the following words",            "value": "includes_words"          },          {            "terminal": false,            "title": "Contains none of the following words",            "value": "not_includes_words"          },          {            "terminal": false,            "title": "Contains the following string",            "value": "includes_string"          },          {            "terminal": false,            "title": "Does not contain the following string",            "value": "not_includes_string"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.heat",        "title": "heat",        "type": "text"      },      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          },          {            "terminal": false,            "title": "Less than",            "value": "less_than"          },          {            "terminal": false,            "title": "Less than or equal to",            "value": "less_than_equal"          },          {            "terminal": false,            "title": "Greater than",            "value": "greater_than"          },          {            "terminal": false,            "title": "Greater than or equal to",            "value": "greater_than_equal"          },          {            "terminal": false,            "title": "Is not",            "value": "is_not"          },          {            "terminal": true,            "title": "Present",            "value": "present"          },          {            "terminal": true,            "title": "Not present",            "value": "not_present"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.miles",        "title": "miles",        "type": "text"      }    ],    "conditions_any": [      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          }        ],        "repeatable": false,        "subject": "update_type",        "title": "Order",        "type": "list",        "values": [          {            "enabled": true,            "title": "Created",            "value": "Create"          },          {            "enabled": true,            "title": "Updated",            "value": "Change"          }        ]      },      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "format": "date",            "terminal": false,            "title": "Is",            "value": "is"          },          {            "format": "date",            "terminal": false,            "title": "Is not",            "value": "is_not"          },          {            "format": "date",            "terminal": true,            "title": "Present",            "value": "present"          },          {            "format": "date",            "terminal": true,            "title": "Not present",            "value": "not_present"          },          {            "format": "date",            "terminal": false,            "title": "Before",            "value": "less_than"          },          {            "format": "date",            "terminal": false,            "title": "Before or on",            "value": "less_than_equal"          },          {            "format": "date",            "terminal": false,            "title": "After",            "value": "greater_than"          },          {            "format": "date",            "terminal": false,            "title": "After or on",            "value": "greater_than_equal"          },          {            "format": "integer",            "terminal": false,            "title": "Is within the previous",            "value": "within_previous_n_days"          },          {            "format": "integer",            "terminal": false,            "title": "Is within the next",            "value": "within_next_n_days"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.due",        "title": "due",        "type": "date"      },      {        "group": "custom_object",        "nullable": true,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.fulfilled",        "title": "Fulfilled",        "type": "list",        "values": [          {            "enabled": true,            "title": "Checked",            "value": "true"          },          {            "enabled": true,            "title": "Unchecked",            "value": "false"          }        ]      },      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          },          {            "terminal": false,            "title": "Is not",            "value": "is_not"          },          {            "terminal": true,            "title": "Present",            "value": "present"          },          {            "terminal": true,            "title": "Not present",            "value": "not_present"          },          {            "terminal": false,            "title": "Contains at least one of the following words",            "value": "includes_words"          },          {            "terminal": false,            "title": "Contains none of the following words",            "value": "not_includes_words"          },          {            "terminal": false,            "title": "Contains the following string",            "value": "includes_string"          },          {            "terminal": false,            "title": "Does not contain the following string",            "value": "not_includes_string"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.heat",        "title": "heat",        "type": "text"      },      {        "group": "custom_object",        "nullable": false,        "operators": [          {            "terminal": false,            "title": "Is",            "value": "is"          },          {            "terminal": false,            "title": "Less than",            "value": "less_than"          },          {            "terminal": false,            "title": "Less than or equal to",            "value": "less_than_equal"          },          {            "terminal": false,            "title": "Greater than",            "value": "greater_than"          },          {            "terminal": false,            "title": "Greater than or equal to",            "value": "greater_than_equal"          },          {            "terminal": false,            "title": "Is not",            "value": "is_not"          },          {            "terminal": true,            "title": "Present",            "value": "present"          },          {            "terminal": true,            "title": "Not present",            "value": "not_present"          }        ],        "repeatable": false,        "subject": "custom_object.order.custom_fields.miles",        "title": "miles",        "type": "text"      }    ]  }}

Create Object Trigger

  • POST /api/v2/custom_objects/{custom_object_key}/triggers

Creates a new object trigger for a specified object.

Allowed For

  • Administrators
  • Agents in custom roles with the manage_triggers permission (Enterprise only)

Parameters

NameTypeInRequiredDescription
custom_object_keystringPathtrueThe key of a custom object

Example body

{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }}

Code Samples

curl
curl -u {email_address}/token:{api_token} https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers.json \  -H "Content-Type: application/json" -X POST -d \  '{    "trigger": {        "actions": [            {                "field": "custom_object.order.custom_fields.miles",                "value": "100"            }        ],        "conditions": {            "all": [                {                    "field": "custom_object.order.custom_fields.heat",                    "operator": "not_present"                }            ],            "any": []        },        "title": "Testing CO trigger with tagger field condition"    }  }'
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers"	method := "POST"	payload := strings.NewReader(`{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }}`)	req, err := http.NewRequest(method, url, payload)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""{  \"trigger\": {    \"actions\": [      {        \"field\": \"custom_object.order.custom_fields.miles\",        \"value\": \"100\"      }    ],    \"conditions\": {      \"all\": [],      \"any\": [        {          \"field\": \"custom_object.order.custom_fields.heat\",          \"operator\": \"not_present\"        }      ]    },    \"title\": \"active test order trigger with any conditions\"  }}""");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("POST", body)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var data = JSON.stringify({  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }});
var config = {  method: 'POST',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  data : data,};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsimport jsonfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers"
payload = json.loads("""{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }}""")headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"POST",	url,	auth=auth,	headers=headers,	json=payload)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers")request = Net::HTTP::Post.new(uri, "Content-Type": "application/json")request.body = %q({  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }})email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

201 Created
// Status 201 Created
{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "active": true,    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "created_at": "2024-07-08T22:34:49Z",    "description": "",    "id": 27,    "position": 3,    "raw_title": "active test order trigger with any conditions",    "title": "active test order trigger with any conditions",    "updated_at": "2024-07-08T22:34:49Z",    "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/27.json"  }}

Update Object Trigger

  • PUT /api/v2/custom_objects/{custom_object_key}/triggers/{trigger_id}

Updates a specified object trigger.

Note: Updating a condition or action updates both the conditions and actions arrays, clearing all existing values of both arrays. Include all your conditions and actions when updating any condition or action.

Allowed For

  • Administrators
  • Agents in custom roles with the manage_triggers permission (Enterprise only)

Parameters

NameTypeInRequiredDescription
custom_object_keystringPathtrueThe key of a custom object
trigger_idintegerPathtrueThe ID of the trigger

Example body

{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }}

Code Samples

curl
curl -v -u {email_address}/token:{api_token} https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/{trigger_id}.json \  -H "Content-Type: application/json" -X PUT -d '{"trigger": {"active": true}}'
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/198"	method := "PUT"	payload := strings.NewReader(`{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }}`)	req, err := http.NewRequest(method, url, payload)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/198")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""{  \"trigger\": {    \"actions\": [      {        \"field\": \"custom_object.order.custom_fields.miles\",        \"value\": \"100\"      }    ],    \"conditions\": {      \"all\": [],      \"any\": [        {          \"field\": \"custom_object.order.custom_fields.heat\",          \"operator\": \"not_present\"        }      ]    },    \"title\": \"active test order trigger with any conditions\"  }}""");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("PUT", body)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var data = JSON.stringify({  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }});
var config = {  method: 'PUT',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/198',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  data : data,};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsimport jsonfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/198"
payload = json.loads("""{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }}""")headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"PUT",	url,	auth=auth,	headers=headers,	json=payload)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/198")request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")request.body = %q({  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "title": "active test order trigger with any conditions"  }})email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "trigger": {    "actions": [      {        "field": "custom_object.order.custom_fields.miles",        "value": "100"      }    ],    "active": true,    "conditions": {      "all": [],      "any": [        {          "field": "custom_object.order.custom_fields.heat",          "operator": "not_present"        }      ]    },    "created_at": "2024-07-08T22:34:49Z",    "description": "",    "id": 27,    "position": 3,    "raw_title": "active test order trigger with any conditions",    "title": "active test order trigger with any conditions",    "updated_at": "2024-07-08T22:34:49Z",    "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/27.json"  }}

Update Many Object Triggers

  • PUT /api/v2/custom_objects/{custom_object_key}/triggers/update_many

Updates the position or the active status of multiple object triggers. Any additional properties are ignored.

Note: You can only bulk-update triggers associated with one object at a time, specified by the custom_object_key in the request.

Allowed For

  • Administrators
  • Agents in custom roles with the manage_triggers permission (Enterprise only)

Request Parameters

The PUT request expects a triggers object that lists the object triggers to update. All of the specified object trigger ids must be associated with a single object.

You can specify the following properties for each object trigger you're updating:

NameMandatoryDescription
idyesThe ID of the object trigger to update
positionnoThe new position of the object trigger
activenoThe active status of the object trigger (true or false)

Example Request

{  "triggers": [    {"id": 25, "position": 3},    {"id": 23, "active": true},    {"id": 27, "position": 9, "active": false},    {"id": 22, "position": 7}  ]}

Parameters

NameTypeInRequiredDescription
custom_object_keystringPathtrueThe key of a custom object

Example body

{  "triggers": [    {      "id": 25,      "position": 1    },    {      "active": false,      "id": 26    }  ]}

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/update_many.json \  -v -u {email_address}/token:{api_token} -H "Content-Type: application/json" \
Go
import (	"fmt"	"io"	"net/http"	"strings")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/update_many"	method := "PUT"	payload := strings.NewReader(`{  "triggers": [    {      "id": 25,      "position": 1    },    {      "active": false,      "id": 26    }  ]}`)	req, err := http.NewRequest(method, url, payload)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/update_many")		.newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),		"""{  \"triggers\": [    {      \"id\": 25,      \"position\": 1    },    {      \"active\": false,      \"id\": 26    }  ]}""");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("PUT", body)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var data = JSON.stringify({  "triggers": [    {      "id": 25,      "position": 1    },    {      "active": false,      "id": 26    }  ]});
var config = {  method: 'PUT',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/update_many',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  data : data,};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsimport jsonfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/update_many"
payload = json.loads("""{  "triggers": [    {      "id": 25,      "position": 1    },    {      "active": false,      "id": 26    }  ]}""")headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"PUT",	url,	auth=auth,	headers=headers,	json=payload)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/update_many")request = Net::HTTP::Put.new(uri, "Content-Type": "application/json")request.body = %q({  "triggers": [    {      "id": 25,      "position": 1    },    {      "active": false,      "id": 26    }  ]})email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

200 OK
// Status 200 OK
{  "count": 2,  "next_page": null,  "previous_page": null,  "triggers": [    {      "actions": [],      "active": true,      "conditions": {},      "created_at": "2024-06-27T16:51:54Z",      "description": "A trigger for custom object of type = order",      "id": 25,      "position": 1,      "raw_title": "Order object trigger",      "title": "Order object trigger",      "updated_at": "2024-06-27T16:51:54Z",      "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/25.json"    },    {      "actions": [],      "active": false,      "conditions": {        "all": [          {            "field": "custom_object.order.custom_fields.heat",            "operator": "not_present"          }        ],        "any": []      },      "created_at": "2024-07-08T20:44:32Z",      "description": "Check order's heat and set field as needed",      "id": 26,      "position": 2,      "raw_title": "Set order miles when heat not present",      "title": "Set order miles when heat not present",      "updated_at": "2024-07-08T20:44:32Z",      "url": "http://{subdomain}.zendesk.com/api/v2/custom_objects/order/triggers/26.json"    }  ]}

Delete Object Trigger

  • DELETE /api/v2/custom_objects/{custom_object_key}/triggers/{trigger_id}

Deletes a specified object trigger.

Allowed For

  • Administrators
  • Agents in custom roles with the manage_triggers permission (Enterprise only)

Parameters

NameTypeInRequiredDescription
custom_object_keystringPathtrueThe key of a custom object
trigger_idintegerPathtrueThe ID of the trigger

Code Samples

curl
curl -v -u {email_address}/token:{api_token} https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/{trigger_id}.json \  -H "Content-Type: application/json" -X DELETE
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/198"	method := "DELETE"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/198")		.newBuilder();String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("DELETE", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'DELETE',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/198',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/198"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"DELETE",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/198")request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

204 No Content
// Status 204 No Content
null

Delete Many Object Triggers

  • DELETE /api/v2/custom_objects/{custom_object_key}/triggers/destroy_many?ids={ids}

Deletes the object triggers corresponding to the provided comma-separated list of ids.

Note: You can only bulk-delete triggers associated with one object at a time, specified by the custom_object_key in the request.

Allowed For

  • Administrators
  • Agents in custom roles with the manage_triggers permission (Enterprise only)

Request Parameters

The DELETE request takes an ids object that lists the object triggers to delete. All of the specified object trigger ids must be associated with a single object.

NameDescription
idsThe ids of the triggers to delete

Example request

{  "ids": "25,23,27,22"}

Parameters

NameTypeInRequiredDescription
idsstringQuerytrueA comma separated list of trigger IDs
custom_object_keystringPathtrueThe key of a custom object

Code Samples

curl
curl https://{subdomain}.zendesk.com/api/v2/custom_objects/{custom_object_key}/triggers/destroy_many.json?ids=1,2,3 \  -v -u {email_address}/token:{api_token} -X DELETE
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/custom_objects/car/triggers/destroy_many?ids=131%2C178%2C938"	method := "DELETE"	req, err := http.NewRequest(method, url, nil)
	if err != nil {		fmt.Println(err)		return	}	req.Header.Add("Content-Type", "application/json")	req.Header.Add("Authorization", "Basic <auth-value>") // Base64 encoded "{email_address}/token:{api_token}"
	client := &http.Client {}	res, err := client.Do(req)	if err != nil {		fmt.Println(err)		return	}	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)	if err != nil {		fmt.Println(err)		return	}	fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/custom_objects/car/triggers/destroy_many")		.newBuilder()		.addQueryParameter("ids", "131,178,938");String userCredentials = "your_email_address" + "/token:" + "your_api_token";String basicAuth = "Basic " + java.util.Base64.getEncoder().encodeToString(userCredentials.getBytes());
Request request = new Request.Builder()		.url(urlBuilder.build())		.method("DELETE", null)		.addHeader("Content-Type", "application/json")		.addHeader("Authorization", basicAuth)		.build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');
var config = {  method: 'DELETE',  url: 'https://example.zendesk.com/api/v2/custom_objects/car/triggers/destroy_many',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'ids': '131%2C178%2C938',  },};
axios(config).then(function (response) {  console.log(JSON.stringify(response.data));}).catch(function (error) {  console.log(error);});
Python
import requestsfrom requests.auth import HTTPBasicAuth
url = "https://example.zendesk.com/api/v2/custom_objects/car/triggers/destroy_many?ids=131%2C178%2C938"headers = {	"Content-Type": "application/json",}email_address = 'your_email_address'api_token = 'your_api_token'# Use basic authenticationauth = HTTPBasicAuth(f'{email_address}/token', api_token)
response = requests.request(	"DELETE",	url,	auth=auth,	headers=headers)
print(response.text)
Ruby
require "net/http"require "base64"uri = URI("https://example.zendesk.com/api/v2/custom_objects/car/triggers/destroy_many")uri.query = URI.encode_www_form("ids": "131,178,938")request = Net::HTTP::Delete.new(uri, "Content-Type": "application/json")email = "your_email_address"api_token = "your_api_token"credentials = "#{email}/token:#{api_token}"encoded_credentials = Base64.strict_encode64(credentials)request["Authorization"] = "Basic #{encoded_credentials}"response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|	http.request(request)end

Example response(s)

204 No Content
// Status 204 No Content
null