Trigger Categories

JSON Format

Trigger Categories are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
created_at string true false
id string true false
name string false false
position integer false false
updated_at string true false

List Trigger Categories

  • GET /api/v2/trigger_categories

Returns all the trigger categories in the account.

Parameters
Name Type In Required Description
include string Query false Allowed sideloads. Allowed value of "rule_counts".
page object Query false Pagination parameters
sort string Query false Sort parameters. Allowed values are "position", "-position", "name", "-name", "created_at", "-created_at", "updated_at", or "-updated_at".
Using cURL

This example provides an example query with pagination parameters with cURL.

curl -u {email}:{password} -X GET \
  --url https://{subdomain}.zendesk.com/api/v2/trigger_categories
Using JavaScript

This example provides an example query with pagination parameters in JavaScript.

fetch("https://{subdomain}.zendesk.com/api/v2/trigger_categories?include=rule_counts&page[size]=10&page[after]=eyJvIjoiLXNjb3JlLGlkIiwidiI6ImFRSUFBQUFBQUFBQWFRMHBJUUVBQUFBQSJ9", {
  "method": "GET",
  "headers": {}
})
.then(response => {
  // do stuff with successful response
})
.catch(err => {
  // do stuff with failed response
});
Example Response
Status 200 OK

{
  "links": {
    "next": "https://{subdomain}.zendesk.com/api/v2/trigger_categories.json?include=rule_counts\u0026page[after]=eyJvIjoiLXNjb3JlLGlkIiwidiI6ImFRSUFBQUFBQUFBQWFRMHBJUUVBQUFBQSJ9\u0026page[size]=2\u0026sort=position",
    "prev": "https://{subdomain}.zendesk.com/api/v2/trigger_categories.json?include=rule_counts\u0026page[before]=eyJvIjoiLXNjb3JlLGlkIiwidiI6ImFRSUFBQUFBQUFBQWFRMHBJUUVBQUFBQSJ9\u0026page[size]=2\u0026sort=position"
  },
  "meta": {
    "after_cursor": "eyJvIjoiLXNjb3JlLGlkIiwidiI6ImFRSUFBQUFBQUFBQWFRMHBJUUVBQUFBQSJ9",
    "before_cursor": "eyJvIjoiLXNjb3JlLGlkIiwidiI6ImFRSUFBQUFBQUFBQWFRMHBJUUVBQUFBQSJ9",
    "has_more": true
  },
  "trigger_categories": [
    {
      "created_at": "2020-07-17T01:30:07Z",
      "id": "10001",
      "name": "Email Triggers",
      "position": 0,
      "updated_at": "2020-07-17T01:30:07Z"
    },
    {
      "created_at": "2020-07-17T01:30:07Z",
      "id": "10002",
      "name": "SMS Triggers",
      "position": 1,
      "updated_at": "2020-07-17T01:30:07Z"
    }
  ]
}

Create Trigger Category

  • POST /api/v2/trigger_categories

Creates a trigger category.

Example Body
{
  "trigger_category": {
    "name": "All Notification Triggers",
    "position": 0
  }
}
Using cURL

This example provides an example trigger category POST request with cURL.

curl -u {email}:{password} -X POST \
  --url https://{subdomain}.zendesk.com/api/v2/trigger_categories \
  -H 'content-type: application/json' \
  -d '{
  "trigger_category": {
    "name": "Example Category",
    "position": 10
  }
}'
Using JavaScript

This example provides an example trigger category POST request in JavaScript.

fetch("https://{subdomain}.zendesk.com/api/v2/trigger_categories", {
  "method": "POST",
  "headers": {
    "content-type": "application/json"
  },
  "body": {
    "trigger_category": {
      "name": "Example Category",
      "position": 10
    }
  }
})
.then(response => {
  // do stuff with successful response
})
.catch(err => {
  // do stuff with failed response
});
Example Response
Status 200 OK

{
  "trigger_category": {
    "created_at": "2020-07-17T01:30:07Z",
    "id": "10001",
    "name": "All Notification Triggers",
    "position": 0,
    "updated_at": "2020-07-17T01:30:07Z"
  }
}

Create Batch Job for Trigger Categories

  • POST /api/v2/trigger_categories/jobs

Creates a job that performs a batch operation for the given trigger categories.

Example Body
{
  "job": {
    "action": "patch",
    "items": {
      "trigger_categories": [
        {
          "id": "10001",
          "position": 0
        },
        {
          "id": "10002",
          "position": 1
        }
      ],
      "triggers": [
        {
          "active": false,
          "category_id": "10001",
          "id": "10011",
          "position": 10
        },
        {
          "active": true,
          "category_id": "10002",
          "id": "10012",
          "position": 1
        }
      ]
    }
  }
}
Using cURL

This example provides an example request for batch operating on existing trigger categories with cURL.

curl -u {email}:{password} -X POST \
  --url https://{subdomain}.zendesk.com/api/v2/trigger_categories/jobs \
  -H 'content-type: application/json' \
  -d '{
  "job": {
    "action": "patch",
    "items": {
      "trigger_categories": [
        {
          "id": "10001",
          "position": 20
        },
        {
          "id": "10002",
          "position": 21
        }
      ],
      "triggers": [
        {
          "id": "10011",
          "position": 10,
          "active": false,
          "category_id": "10001"
        },
        {
          "id": "10012",
          "position": 1,
          "active": true,
          "category_id": "10002"
        }
      ]
    }
  }
}'
Using JavaScript

This example provides an example request for batch operating on existing trigger categories in JavaScript.

fetch("https://{subdomain}.zendesk.com/api/v2/trigger_categories/jobs", {
  "method": "POST",
  "headers": {
    "content-type": "application/json"
  },
  "body": {
    "job": {
      "action": "patch",
      "items": {
        "trigger_categories": [
          {
            "id": "10001",
            "position": 20
          },
          {
            "id": "10002",
            "position": 21
          }
        ],
        "triggers": [
          {
            "id": "10011",
            "position": 10,
            "active": false,
            "category_id": "10001"
          },
          {
            "id": "10012",
            "position": 1,
            "active": true,
            "category_id": "10002"
          }
        ]
      }
    }
  }
})
.then(response => {
  // do stuff with successful response
})
.catch(err => {
  // do stuff with failed response
});
Example Response
Status 200 OK

{
  "results": {
    "trigger_categories": [
      {
        "created_at": "2020-07-18T01:24:53Z",
        "id": "10001",
        "name": "Notifications",
        "position": 0,
        "updated_at": "2020-07-20T01:30:07Z"
      },
      {
        "created_at": "2020-07-17T06:31:12Z",
        "id": "10002",
        "name": "Apply Tags",
        "position": 1,
        "updated_at": "2020-07-20T01:30:07Z"
      }
    ],
    "triggers": [
      {
        "actions": [
          {}
        ],
        "active": true,
        "conditions": {},
        "created_at": "2012-09-25T22:50:26Z",
        "description": "Notify external target",
        "id": 10012,
        "position": 1,
        "raw_title": "Notify target",
        "title": "Notify Target",
        "updated_at": "2020-07-20T01:30:07Z",
        "url": "http://{subdomain}.zendesk.com/api/v2/triggers/10012.json"
      },
      {
        "actions": [
          {}
        ],
        "active": false,
        "conditions": {},
        "created_at": "2012-09-25T22:50:26Z",
        "description": "Close and save a ticket",
        "id": 10011,
        "position": 10,
        "raw_title": "Close and Save",
        "title": "Close and Save",
        "updated_at": "2020-07-20T01:30:07Z",
        "url": "http://{subdomain}.zendesk.com/api/v2/triggers/10011.json"
      }
    ]
  },
  "status": "complete"
}

Show Trigger Category

  • GET /api/v2/trigger_categories/{trigger_category_id}

Returns the trigger category with the specified ID.

Parameters
Name Type In Required Description
trigger_category_id string Path true The id of the trigger category to retrieve
Using cURL

This example provides an example request for an existing trigger category with cURL.

curl -u {email}:{password} -X GET \
  --url https://{subdomain}.zendesk.com/api/v2/trigger_categories/10001
Using JavaScript

This example provides an example request for an existing trigger category in JavaScript.

fetch("https://{subdomain}.zendesk.com/api/v2/trigger_categories/10001", {
  "method": "GET",
  "headers": {}
})
.then(response => {
  // do stuff with successful response
})
.catch(err => {
  // do stuff with failed response
});
Example Response
Status 200 OK

{
  "trigger_category": {
    "created_at": "2020-07-17T01:30:07Z",
    "id": "10001",
    "name": "All Notification Triggers",
    "position": 0,
    "updated_at": "2020-07-17T01:30:07Z"
  }
}

Update Trigger Category

  • PATCH /api/v2/trigger_categories/{trigger_category_id}

Updates the trigger category with the specified ID.

Parameters
Name Type In Required Description
trigger_category_id string Path true The id of the trigger category to update
Example Body
{
  "trigger_category": {
    "name": "All Notification Triggers Updated",
    "position": 10
  }
}
Using cURL

This example provides an example request for updating an existing trigger category with cURL.

curl -u {email}:{password} -X PATCH \
  --url https://{subdomain}.zendesk.com/api/v2/trigger_categories/10001 \
  -H 'content-type: application/json' \
  -d '{
  "trigger_category": {
    "name": "Example Category Updated"
  }
}'
Using JavaScript

This example provides an example request for updating an existing trigger category in JavaScript.

fetch("https://{subdomain}.zendesk.com/api/v2/trigger_categories/10001", {
  "method": "PATCH",
  "headers": {
    "content-type": "application/json"
  },
  "body": {
    "trigger_category": {
      "name": "Example Category Updated"
    }
  }
})
.then(response => {
  // do stuff with successful response
})
.catch(err => {
  // do stuff with failed response
});
Example Response
Status 200 OK

{
  "trigger_category": {
    "created_at": "2020-07-17T01:30:07Z",
    "id": "10001",
    "name": "All Notification Triggers Updated",
    "position": 10,
    "updated_at": "2020-07-18T05:23:32Z"
  }
}

Delete Trigger Category

  • DELETE /api/v2/trigger_categories/{trigger_category_id}

Deletes the trigger category with the specified ID.

Parameters
Name Type In Required Description
trigger_category_id string Path true The id of the trigger category to delete
Using cURL

This example provides an example request for deleting an existing trigger category with cURL.

curl -u {email}:{password} -X DELETE \
  --url https://{subdomain}.zendesk.com/api/v2/trigger_categories/10001
Using JavaScript

This example provides an example request for deleting an existing trigger category in JavaScript.

fetch("https://{subdomain}.zendesk.com/api/v2/trigger_categories/10001", {
  "method": "DELETE",
  "headers": {}
})
.then(response => {
  // do stuff with successful response
})
.catch(err => {
  // do stuff with failed response
});
Example Response
Status 204 No Content