API to manage assignees

JSON format

Assignees API are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
assigneesarrayfalsefalseList of assignees
linksobjectfalsefalseLinks to other pages
metaobjectfalsefalseMetadata about the response

Get Assignees

  • GET /api/v2/capacity/rules/assignees

Returns assignees for each of the account's capacity rules.

With no query parameters, the first page of assignees is returned.

To navigate to the next or previous page of results, use the pagination links provided in the response. The page[before] and page[after] parameters can't be used together in a single request.

When the filter[agent_ids] parameter is used, the query returns assignees that match the specified assignee ids.

Allowed For

  • Admins

Parameters

NameTypeInRequiredDescription
filter[agent_ids]stringQueryfalseA comma-separated list of assignee ids
page[after]integerQueryfalseThe cursor returned in the next link in the preceding response
page[before]integerQueryfalseThe cursor returned in the prev link in the preceding response
page[size]integerQueryfalseThe maximum number of assignees returned per page. If not specified, defaults to 20

Code Samples

Curl
curl --request GET https://support.zendesk.com/api/v2/capacity/rules/assignees?filter[agent_ids]=10011%2C+10012%2C+10013&page[after]=1234&page[before]=1234&page[size]=88 \--header "Content-Type: application/json" \-u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/capacity/rules/assignees?filter[agent_ids]=10011%2C+10012%2C+10013&page[after]=1234&page[before]=1234&page[size]=88"	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://support.zendesk.com/api/v2/capacity/rules/assignees")		.newBuilder()		.addQueryParameter("filter[agent_ids]", "10011, 10012, 10013")		.addQueryParameter("page[after]", "1234")		.addQueryParameter("page[before]", "1234")		.addQueryParameter("page[size]", "88");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://support.zendesk.com/api/v2/capacity/rules/assignees',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'filter[agent_ids]': '10011%2C+10012%2C+10013',    'page[after]': '1234',    'page[before]': '1234',    'page[size]': '88',  },};
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://support.zendesk.com/api/v2/capacity/rules/assignees?filter[agent_ids]=10011%2C+10012%2C+10013&page[after]=1234&page[before]=1234&page[size]=88"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://support.zendesk.com/api/v2/capacity/rules/assignees")uri.query = URI.encode_www_form("filter[agent_ids]": "10011, 10012, 10013", "page[after]": "1234", "page[before]": "1234", "page[size]": "88")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
{  "assignees": [    {      "capacities": {        "email": 1,        "messaging": 0,        "voice": 0      },      "id": 123,      "name": "Johnny Appleseed",      "rule_id": "01JERHNQQS1E5BK9CTEMTTQN3R",      "rule_name": "Example capacity rule"    },    {      "capacities": {        "email": 1,        "messaging": 0,        "voice": 0      },      "id": 456,      "name": "Rosa Lopez",      "rule_id": "01JF1WXNDYGKR4YCV9YNY7PE81",      "rule_name": "Another example capacity rule"    }  ],  "links": {    "next": "https://support.zendesk.com/api/v2/capacity/rules/assignees?page[after]=456",    "prev": "https://support.zendesk.com/api/v2/capacity/rules/assignees?page[before]=123"  },  "meta": {    "has_more": true  }}
400 Bad Request
// Status 400 Bad Request
{  "error": "Invalid pagination parameter: page[size]:(invalid)"}
403 Forbidden
// Status 403 Forbidden
{  "error": "This functionality is just allowed to admins"}
404 Not Found
// Status 404 Not Found
{  "error": "Rule not found"}

Get Assignees by Capacity Rule Id

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

Returns all assignees for a specific capacity rule.

With no query parameters, the first page of assignees is returned.

To navigate to the next or previous page of results, use the pagination links provided in the response. The page[before] and page[after] parameters can't be used together in a single request.

When the filter[agent_ids] parameter is used, the query returns assignees that match the specified assignee ids.

Allowed For

  • Admins

Parameters

NameTypeInRequiredDescription
filter[agent_ids]stringQueryfalseA comma-separated list of assignee ids
page[after]integerQueryfalseThe cursor returned in the next link in the preceding response
page[before]integerQueryfalseThe cursor returned in the prev link in the preceding response
page[size]integerQueryfalseThe maximum number of assignees returned per page. If not specified, defaults to 20
capacity_rule_idstringPathtrueCapacity rule id

Code Samples

Curl
curl --request GET https://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456/assignees?filter[agent_ids]=10011%2C+10012%2C+10013&page[after]=1234&page[before]=1234&page[size]=88 \--header "Content-Type: application/json" \-u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456/assignees?filter[agent_ids]=10011%2C+10012%2C+10013&page[after]=1234&page[before]=1234&page[size]=88"	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://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456/assignees")		.newBuilder()		.addQueryParameter("filter[agent_ids]", "10011, 10012, 10013")		.addQueryParameter("page[after]", "1234")		.addQueryParameter("page[before]", "1234")		.addQueryParameter("page[size]", "88");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://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456/assignees',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'filter[agent_ids]': '10011%2C+10012%2C+10013',    'page[after]': '1234',    'page[before]': '1234',    'page[size]': '88',  },};
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://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456/assignees?filter[agent_ids]=10011%2C+10012%2C+10013&page[after]=1234&page[before]=1234&page[size]=88"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://support.zendesk.com/api/v2/capacity/rules/12345678901234567890123456/assignees")uri.query = URI.encode_www_form("filter[agent_ids]": "10011, 10012, 10013", "page[after]": "1234", "page[before]": "1234", "page[size]": "88")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
{  "assignees": [    {      "capacities": {        "email": 1,        "messaging": 0,        "voice": 0      },      "id": 123,      "name": "Johnny Appleseed",      "rule_id": "01JERHNQQS1E5BK9CTEMTTQN3R",      "rule_name": "Example capacity rule"    },    {      "capacities": {        "email": 1,        "messaging": 0,        "voice": 0      },      "id": 456,      "name": "Rosa Lopez",      "rule_id": "01JERHNQQS1E5BK9CTEMTTQN3R",      "rule_name": "Example capacity rule"    }  ],  "links": {    "next": "https://support.zendesk.com/api/v2/capacity/rules/01JERHNQQS1E5BK9CTEMTTQN3R/assignees?page[after]=456",    "prev": "https://support.zendesk.com/api/v2/capacity/rules/01JERHNQQS1E5BK9CTEMTTQN3R/assignees?page[before]=123"  },  "meta": {    "has_more": true  }}
400 Bad Request
// Status 400 Bad Request
{  "error": "Invalid pagination parameter: page[size]:(invalid)"}
403 Forbidden
// Status 403 Forbidden
{  "error": "This functionality is just allowed to admins"}
404 Not Found
// Status 404 Not Found
{  "error": "Rule not found"}