SLA Policies

A Service Level Agreement is a documented agreement between a support provider and their customers that specifies performance measures for support. SLAs are often expressed as follows:

For urgent incidents, we will respond to tickets in 10 minutes and resolve the ticket within 2 hours. For high priority incidents, we will respond to tickets in 30 minutes and resolved the ticket within 8 hours.

Because there may be different SLAs per customer (or group of customers) that the provider supports, the provider will define an SLA policy to support each unique SLA's requirements.

A SLA policy is the unique (not enforced) combination of criteria along with assigned metric targets for each value of the priority field. There can be multiple SLA policies per Zendesk Support account.

JSON Format

SLA Policies are represented as simple flat JSON objects which have the following keys:

Name Type Comment
id integer Automatically assigned when created
title string The title of the SLA policy
description string The description of the SLA policy
position integer Position of the SLA policy, determines the order they will be matched. If not specified, SLA Policy is added as the last position
filter Filter An object that describes the conditions that a ticket must match in order for an SLA policy to be applied to that ticket
policy_metrics array Array of Policy Metric objects.
created_at date The time the SLA policy was created
updated_at date The time of the last update of the SLA policy
Example
{
  "url": "https://company.zendesk.com/api/v2/slas/policies/25.json",
  "id": 25,
  "title": "Silver Plan",
  "description": "Organizations: Silver Plan",
  "position": 3,
  "filter": { ... },
  "policy_metrics": [ ... ],
  "updated_at": "2015-03-17T22:50:26Z",
  "created_at": "2015-03-17T22:50:26Z"
}

Policy Metric

An object that describes the metric targets for each value of the priority field.

Policy Metrics are represented as simple flat JSON objects which have the following keys:

Name Type Comment
priority string Priority that a ticket must match
metric Metric The definition of the time that is being measured
target integer The time within which the end-state for a metric should be met
business_hours boolean Whether the metric targets are being measured in business hours or calendar hours
Example
{
  "priority": "low",
  "metric": "first_reply_time",
  "target": 60,
  "business_hours": false
}
Metrics
Metric Value
Agent Work Time agent_work_time
First Reply Time first_reply_time
Next Reply Time next_reply_time
Pausable Update Time pausable_update_time
Periodic Update Time periodic_update_time
Requester Wait Time requester_wait_time

Filter

A filter checks the value of ticket fields and selects the ticket if the conditions are met. Filter is represented as a JSON object with two arrays of one or more conditions.

Example

{
   "filter": {
     "all": [
       { "field": "type", "operator": "is", "value": "incident" },
       { "field": "via_id", "operator": "is", "value": 4 }
     ],
     "any": [
     ]
   }
}

The first array lists all the conditions that must be met. The second array lists any condition that must be met.

Name Type Description
all array Logical AND. Tickets must fulfill all of the conditions to be considered matching
any array Logical OR. Tickets may satisfy any of the conditions to be considered matching

Each condition in an array has the following properties:

Name Type Description
field string The name of a ticket field
operator string A comparison operator
value string The value of a ticket field

Example

{ "field": "type", "operator": "is", "value": "incident" }

See Conditions reference for the list of fields, allowed operators, and values of the conditions.

List SLA Policies

GET /api/v2/slas/policies

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies \
  -H "Content-Type: application/json" \
  -v -u {email_address}:{password}
Example Response
Status: 200 OK

{
  "sla_policies": [
    {
      "url": "https://{subdomain}.zendesk.com/api/v2/slas/policies/36.json",
      "id": 36,
      "title": "Incidents",
      "description": "For urgent incidents, we will respond to tickets in 10 minutes",
      "position": 3,
      "filter": { ... },
      "policy_metrics": [ ... ]
    }
  ],
  "next_page": null,
  "previous_page": null,
  "count": 1
}

Get SLA Policy

GET /api/v2/slas/policies/{id}

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies/{id} \
   -H "Content-Type: application/json" \
   -v -u {email_address}:{password}
Example Response
Status: 200 OK

{
  "sla_policy": {
    "url": "https://{subdomain}.zendesk.com/api/v2/slas/policies/36.json",
    "id": 36,
    "title": "Incidents",
    "description": "For urgent incidents, we will respond to tickets in 10 minutes",
    "position": 3,
    "filter": { ... },
    "policy_metrics": [ ... ]
  }
}

Create SLA Policy

POST /api/v2/slas/policies

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies \
  -H "Content-Type: application/json" \
  -d '{
        "sla_policy": {
          "title": "Incidents",
          "description": "For urgent incidents, we will respond to tickets in 10 minutes",
          "position": 3,
          "filter": {
            "all": [
              { "field": "type", "operator": "is", "value": "incident" }
            ],
            "any": []
          },
          "policy_metrics": [
            { "priority": "normal", "metric": "first_reply_time", "target": 30, "business_hours": false },
            { "priority": "urgent", "metric": "first_reply_time", "target": 10, "business_hours": false },
            { "priority": "low", "metric": "requester_wait_time", "target": 180, "business_hours": false },
            { "priority": "normal", "metric": "requester_wait_time", "target": 160, "business_hours": false },
            { "priority": "high", "metric": "requester_wait_time", "target": 140, "business_hours": false },
            { "priority": "urgent", "metric": "requester_wait_time", "target": 120, "business_hours": false }
          ]
        }
      }' \
  -v -u {email_address}:{password} -X POST
Example Response
Status: 201 Created

{
  "sla_policy": {
    "url": "https://{subdomain}.zendesk.com/api/v2/slas/policies/36.json",
    "id": 36,
    "title": "Incidents",
    "description": "For urgent incidents, we will respond to tickets in 10 minutes",
    "position": 3,
    "filter": { ... },
    "policy_metrics": [ ... ]
  }
}

Update SLA Policy

PUT /api/v2/slas/policies/{id}

Updates the specified policy.

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies/{id} \
  -H "Content-Type: application/json" \
  -d '{
        "sla_policy": {
          "title": "Urgent Incidents",
          "description": "For urgent incidents, we will resolve the ticket within 2 hours",
          "position": 3,
          "filter": {
            "all": [
              { "field": "type", "operator": "is", "value": "incident" }
            ],
            "any": []
          },
          "policy_metrics": [
            { "priority": "normal", "metric": "first_reply_time", "target": 30, "business_hours": false },
            { "priority": "urgent", "metric": "first_reply_time", "target": 10, "business_hours": false },
            { "priority": "low", "metric": "requester_wait_time", "target": 180, "business_hours": false },
            { "priority": "normal", "metric": "requester_wait_time", "target": 160, "business_hours": false },
            { "priority": "high", "metric": "requester_wait_time", "target": 140, "business_hours": false },
            { "priority": "urgent", "metric": "requester_wait_time", "target": 120, "business_hours": false }
          ]
        }
      }' \
   -v -u {email_address}:{password} -X PUT
Example Response
Status: 200 OK

{
  "sla_policy": {
    "url": "https://{subdomain}.zendesk.com/api/v2/slas/policies/36.json",
    "id": 36,
    "title": "Urgent Incidents",
    "description": "For urgent incidents, we will resolve the ticket within 2 hours",
    "position": 3,
    "filter": { ... },
    "policy_metrics": [ ... ]
  }
}

Delete SLA Policy

DELETE /api/v2/slas/policies/{id}

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies/{id} \
   -H "Content-Type: application/json" \
   -v -u {email_address}:{password} -X DELETE
Example Response
Status: 204 No Content

Reorder SLA Policies

PUT /api/v2/slas/policies/reorder.json

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies/reorder.json \
  -H "Content-Type: application/json" -X PUT \
  -d '{"sla_policy_ids": [12, 55]}' \
  -v -u {email}:{password}
Example Response
Status: 200 OK

Retrieve supported filter definition items

GET /api/v2/slas/policies/definitions.json

Availability
  • Accounts on the Professional and Enterprise plans
Allowed For
  • Administrators
Using curl
curl https://{subdomain}.zendesk.com/api/v2/slas/policies/definitions.json \
   -H "Content-Type: application/json" \
   -v -u {email_address}:{password} -X GET
Example Response
Status: 200 OK

{
  "definitions": {
    "all": [
       {
         "target": null,
         "title": "Brand",
         "values": {
           "type": "list",
           "list": [
             {
               "value": 10001,
               "title": "Support"
             }
           ]
         },
         "value": "brand_id",
         "operators": [
           {
             "value": "is",
             "title": "Is"
           },
           {
             "value": "is_not",
             "title": "Is not"
           }
         ],
         "group": "ticket"
       },
       ...
    ],
    "any": [
       {
         "target": null,
         "title": "Brand",
         "values": {
           "type": "list",
           "list": [
             {
               "value": 10001,
               "title": "Support"
             }
           ]
         },
         "value": "brand_id",
         "operators": [
           {
             "value": "is",
             "title": "Is"
           },
           {
             "value": "is_not",
             "title": "Is not"
           }
         ],
         "group": "ticket"
       },
       ...
    ]
  }
}