Capacity Rules API

API to manage capacity rules

JSON format

Capacity Rules API are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
assigneesobjectfalsefalseSubset of assignees that are part of the capacity rule
capacitiesobjectfalsefalseList of the rule's capacities per channel
created_atstringfalsefalseWhen the capacity rule was created
defaultbooleanfalsefalseTrue for the account's default capacity rule. Otherwise false
descriptionstringfalsefalseDescription of the capacity rule
idstringfalsefalseAutomatically assigned when the capacity rule is created
last_updated_atstringfalsefalseWhen the capacity rule was last updated
namestringfalsefalseName of the capacity rule

List Capacity Rules

  • GET /api/v2/capacity/rules

Returns all capacity rules in the account.

Allowed For

  • Admins

Code Samples

Curl
curl --request GET https://support.zendesk.com/api/v2/capacity/rules \--header "Content-Type: application/json" \-u username:password

Example response(s)

200 OK
// Status 200 OK
[  {    "assignees": {      "agents_sample": [        {          "id": 123,          "name": "[email protected]"        },        {          "id": 456,          "name": "[email protected]"        }      ],      "count": 2    },    "capacities": {      "email": 1,      "messaging": 0,      "voice": 0    },    "created_at": "2022-01-01T00:00:00.000Z",    "default": false,    "description": "Example description",    "id": "12345678901234567890123456",    "last_updated_at": "2023-01-01T00:00:00.000Z",    "name": "Example capacity rule"  }]
400 Bad Request
// Status 400 Bad Request
{  "error": "Example error message"}

Create Capacity Rule

  • POST /api/v2/capacity/rules

Create a new capacity rule.

Allowed For

  • Admins

Example body

{  "agent_ids": [    123,    456  ],  "capacities": {    "email": 2,    "messaging": 1,    "voice": 0  },  "default": false,  "description": "Example description",  "name": "Example capacity rule"}

Code Samples

Curl
curl --request POST https://support.zendesk.com/api/v2/capacity/rules \--header "Content-Type: application/json" \-u username:password \--data-raw '{  "agent_ids": [    123,    456  ],  "capacities": {    "email": 2,    "messaging": 1,    "voice": 0  },  "default": false,  "description": "Example description",  "name": "Example capacity rule"}'

Example response(s)

200 OK
// Status 200 OK
{  "assignees": {    "agents_sample": [      {        "id": 123,        "name": "[email protected]"      },      {        "id": 456,        "name": "[email protected]"      }    ],    "count": 2  },  "capacities": {    "email": 1,    "messaging": 0,    "voice": 0  },  "created_at": "2022-01-01T00:00:00.000Z",  "default": false,  "description": "Example description",  "id": "12345678901234567890123456",  "last_updated_at": "2023-01-01T00:00:00.000Z",  "name": "Example capacity rule"}
400 Bad Request
// Status 400 Bad Request
{  "error": "Example error message"}

Show Capacity Rule

  • GET /api/v2/capacity/rules/{capacity_rule_id}

Returns capacity rule by id.

Allowed For

  • Admins

Parameters

NameTypeInRequiredDescription
capacity_rule_idstringPathtrueCapacity rule id

Code Samples

Curl
curl --request GET https://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456 \--header "Content-Type: application/json" \-u username:password

Example response(s)

200 OK
// Status 200 OK
{  "assignees": {    "agents_sample": [      {        "id": 123,        "name": "[email protected]"      },      {        "id": 456,        "name": "[email protected]"      }    ],    "count": 2  },  "capacities": {    "email": 1,    "messaging": 0,    "voice": 0  },  "created_at": "2022-01-01T00:00:00.000Z",  "default": false,  "description": "Example description",  "id": "12345678901234567890123456",  "last_updated_at": "2023-01-01T00:00:00.000Z",  "name": "Example capacity rule"}
400 Bad Request
// Status 400 Bad Request
{  "error": "Example error message"}
404 Not Found
// Status 404 Not Found
{  "error": "Example error message"}

Update Capacity Rule

  • PUT /api/v2/capacity/rules/{capacity_rule_id}

Update capacity rule by id.

Allowed For

  • Admins

Parameters

NameTypeInRequiredDescription
capacity_rule_idstringPathtrueCapacity rule id

Example body

{  "agent_ids": [    123,    456  ],  "capacities": {    "email": 2,    "messaging": 1,    "voice": 0  },  "default": false,  "description": "Example description",  "name": "Example capacity rule"}

Code Samples

Curl
curl --request PUT https://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456 \--header "Content-Type: application/json" \-u username:password \--data-raw '{  "agent_ids": [    123,    456  ],  "capacities": {    "email": 2,    "messaging": 1,    "voice": 0  },  "default": false,  "description": "Example description",  "name": "Example capacity rule"}'

Example response(s)

200 OK
// Status 200 OK
{  "assignees": {    "agents_sample": [      {        "id": 123,        "name": "[email protected]"      },      {        "id": 456,        "name": "[email protected]"      }    ],    "count": 2  },  "capacities": {    "email": 1,    "messaging": 0,    "voice": 0  },  "created_at": "2022-01-01T00:00:00.000Z",  "default": false,  "description": "Example description",  "id": "12345678901234567890123456",  "last_updated_at": "2023-01-01T00:00:00.000Z",  "name": "Example capacity rule"}
400 Bad Request
// Status 400 Bad Request
{  "error": "Example error message"}
404 Not Found
// Status 404 Not Found
{  "error": "Example error message"}

Delete Capacity Rule

  • DELETE /api/v2/capacity/rules/{capacity_rule_id}

Delete capacity rule by id.

Allowed For

  • Admins

Parameters

NameTypeInRequiredDescription
capacity_rule_idstringPathtrueCapacity rule id

Code Samples

Curl
curl --request DELETE https://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456 \--header "Content-Type: application/json" \-u username:password

Example response(s)

204 No Content
// Status 204 No Content
null
400 Bad Request
// Status 400 Bad Request
{  "error": "Example error message"}
404 Not Found
// Status 404 Not Found
{  "error": "Example error message"}