Zendesk Support has three types of users: end users (your customers), agents, and administrators.

End users

End users request support through tickets. End users have access to Help Center where they can view knowledge base articles and community content, access their ticket history, and submit new tickets.

Agents

Agents work in Zendesk Support to solve tickets. Agents can be divided into multiple groups and can also belong to multiple groups. Agents don't have access to administrative configuration in Zendesk Support such as business rules or automations, but can configure their own macros and views.

Administrators

Administrators have all the abilities of agents, plus administrative abilities. Accounts on the Enterprise plan and above can configure custom roles to give agents varying degrees of administrative access.

Listing Requested Tickets and CC'ed Tickets

Use the Tickets API to list:

Listing Help Center Content by a User

Use the Help Center API to list:

JSON format

Users are represented as JSON objects with the following properties:

NameTypeRead-onlyMandatoryDescription
activebooleantruefalsefalse if the user has been deleted
aliasstringfalsefalseAn alias displayed to end users
chat_onlybooleantruefalseWhether or not the user is a chat-only agent
created_atstringtruefalseThe time the user was created
custom_role_idintegerfalsefalseA custom role if the user is an agent on the Enterprise plan or above
default_group_idintegerfalsefalseThe id of the user's default group
detailsstringfalsefalseAny details you want to store about the user, such as an address
emailstringfalsefalseThe user's primary email address. *Writeable on create only. On update, a secondary email is added. See Email Address
external_idstringfalsefalseA unique identifier from another system. The API treats the id as case insensitive. Example: "ian1" and "IAN1" are the same value.
iana_time_zonestringtruefalseThe time zone for the user
idintegertruefalseAutomatically assigned when the user is created
last_login_atstringtruefalseLast time the user signed in to Zendesk Support or made an API request using an API token or basic authentication
localestringfalsefalseThe user's locale. A BCP-47 compliant tag for the locale. If both "locale" and "locale_id" are present on create or update, "locale_id" is ignored and only "locale" is used.
locale_idintegerfalsefalseThe user's language identifier
moderatorbooleanfalsefalseDesignates whether the user has forum moderation capabilities
namestringfalsetrueThe user's name
notesstringfalsefalseAny notes you want to store about the user
only_private_commentsbooleanfalsefalsetrue if the user can only create private comments
organization_idintegerfalsefalseThe id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization. If updating, see Organization ID
phonestringfalsefalseThe user's primary phone number. See Phone Number below
photoobjectfalsefalseThe user's profile picture represented as an Attachment object
remote_photo_urlstringfalsefalseA URL pointing to the user's profile picture.
report_csvbooleantruefalseThis parameter is inert and has no effect. It may be deprecated in the future. Previously, this parameter determined whether a user could access a CSV report in a legacy Guide dashboard. This dashboard has been removed. See Announcing Guide legacy reporting upgrade to Explore
restricted_agentbooleanfalsefalseIf the agent has any restrictions; false for admins and unrestricted agents, true for other agents
rolestringfalsefalseThe user's role. Possible values are "end-user", "agent", or "admin"
role_typeintegertruefalseThe user's role id. 0 for a custom agent, 1 for a light agent, 2 for a chat agent, 3 for a chat agent added to the Support account as a contributor (Chat Phase 4), 4 for an admin, and 5 for a billing admin
sharedbooleantruefalseIf the user is shared from a different Zendesk Support instance. Ticket sharing accounts only
shared_agentbooleantruefalseIf the user is a shared agent from a different Zendesk Support instance. Ticket sharing accounts only
shared_phone_numberbooleanfalsefalseWhether the phone number is shared or not. See Phone Number below
signaturestringfalsefalseThe user's signature. Only agents and admins can have signatures
suspendedbooleanfalsefalseIf the agent is suspended. Tickets from suspended users are also suspended, and these users cannot sign in to the end user portal
tagsarrayfalsefalseThe user's tags. Only present if your account has user tagging enabled
ticket_restrictionstringfalsefalseSpecifies which tickets the user has access to. Possible values are: "organization", "groups", "assigned", "requested", null. "groups" and "assigned" are valid only for agents. If you pass an invalid value to an end user (for example, "groups"), they will be assigned to "requested", regardless of their previous access
time_zonestringfalsefalseThe user's time zone. See Time Zone
two_factor_auth_enabledbooleantruefalseIf two factor authentication is enabled
updated_atstringtruefalseThe time the user was last updated
urlstringtruefalseThe user's API url
user_fieldsobjectfalsefalseValues of custom fields in the user's profile. See User Fields
verifiedbooleanfalsefalseAny of the user's identities is verified. See User Identities

Email Address

You can specify a user's primary email address when you create the user. See Specifying email and verified attributes.

To update a user's primary email address, use the Make Identity Primary endpoint.

Time Zone

A time_zone name consists of a string such as "Eastern Time (US & Canada)". For a list of valid names, click https://support.zendesk.com/api/v2/time_zones. For details, see Time Zones.

Request body in User API:

{ "user": {   "id":   35436,   "name": "Johnny Agent",   "time_zone": "Berlin",   ... }}

User Fields

You can use the user_fields object to set the value of one or more custom fields in the user's profile. Specify field keys as the properties to set. Example:

"user_fields": {   "membership_level": "silver",   "membership_expires": "2019-07-23T00:00:00Z" }

For more information, see User Fields and Adding custom fields to users.

Phone Number

The phone number should comply with the E.164 international telephone numbering plan. Example +15551234567. E164 numbers are international numbers with a country dial prefix, usually an area code and a subscriber number. A valid E.164 phone number must include a country calling code.

A phone number can be one of the following types:

  • A direct line linked to a single user, which is indicated by a shared_phone_number attribute of false. A direct line can be used as a user identity
  • A shared number linked to multiple users, indicated by a shared_phone_number attribute of true. A shared number can not be used as a user identity

See Understanding how phone numbers are linked to end-user profiles in the Support Help Center.

Organization ID

The organization_id property returns the id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization is returned.

The field is writable. However, if you make a request to update the organization_id property, the organization_id of the request updates the default organization for that user and removes all other organizations currently associated with that user. Zendesk recommends using the Organization Memberships API to add or delete organizations for a user.

JSON Format for End Users

When an end user makes the request, the user is returned with the following attributes:

NameTypeRead-onlyMandatoryComment
idintegeryesnoAutomatically assigned when creating users
emailstringnonoThe primary email address of this user. If the primary email address is not verified, the secondary email address is used
namestringnoyesThe name of the user
created_atdateyesnoThe time the user was created
localestringyesnoThe locale for this user
locale_idintegernonoThe language identifier for this user
organization_idintegernonoThe id of the user's organization. If the user has more than one organization memberships, the id of the user's default organization. If updating, see Organization ID
phonestringnonoThe primary phone number of this user. See Phone Number in the Users API
shared_phone_numberbooleanyesnoWhether the phone number is shared or not. See Phone Number in the Users API
photoAttachmentnonoThe user's profile picture represented as an Attachment object
rolestringnonoThe role of the user. Possible values: "end-user", "agent", "admin"
time_zonestringnonoThe time-zone of this user
updated_atdateyesnoThe time of the last update of the user
urlstringyesnoThe API url of this user
verifiedbooleannonoAny of the user's identities is verified. See User Identities

Responses will vary depending on the role of the client making the request. The following example is a response for an end-user role.

Example

{  "id":                    35436,  "url":                   "https://company.zendesk.com/api/v2/end_users/35436.json",  "name":                  "Johnny End User",  "created_at":            "2009-07-20T22:55:29Z",  "updated_at":            "2011-05-05T10:38:52Z",  "time_zone":             "Copenhagen",  "email":                 "[email protected]",  "phone":                 "+15551234567",  "locale":                "en-US",  "locale_id":             1,  "organization_id":       57542,  "role":                  "end-user",  "verified":              true,  "photo": {    "id":           928374,    "name":         "my_funny_profile_pic.png",    "content_url":  "https://company.zendesk.com/photos/my_funny_profile_pic.png",    "content_type": "image/png",    "size":         166144,    "thumbnails": [      {      "id":           928375,      "name":         "my_funny_profile_pic_thumb.png",      "content_url":  "https://company.zendesk.com/photos/my_funny_profile_pic_thumb.png",      "content_type": "image/png",      "size":         58298      }    ]  }}

This example is a response for an admin or agent request.

Example

{  "active": true,  "alias": "Mr. Johnny",  "created_at": "2009-07-20T22:55:29Z",  "custom_role_id": 9373643,  "details": "",  "email": "[email protected]",  "external_id": "sai989sur98w9",  "iana_time_zone": "Pacific/Pago_Pago",  "id": 35436,  "last_login_at": "2011-05-05T10:38:52Z",  "locale": "en-US",  "locale_id": 1,  "moderator": true,  "name": "Johnny Agent",  "notes": "Johnny is a nice guy!",  "only_private_comments": false,  "organization_id": 57542,  "phone": "+15551234567",  "photo": {    "content_type": "image/png",    "content_url": "https://company.zendesk.com/photos/my_funny_profile_pic.png",    "id": 928374,    "name": "my_funny_profile_pic.png",    "size": 166144,    "thumbnails": [      {        "content_type": "image/png",        "content_url": "https://company.zendesk.com/photos/my_funny_profile_pic_thumb.png",        "id": 928375,        "name": "my_funny_profile_pic_thumb.png",        "size": 58298      }    ]  },  "restricted_agent": true,  "role": "agent",  "role_type": 0,  "shared": false,  "shared_agent": false,  "signature": "Have a nice day, Johnny",  "suspended": true,  "tags": [    "enterprise",    "other_tag"  ],  "ticket_restriction": "assigned",  "time_zone": "Copenhagen",  "updated_at": "2011-05-05T10:38:52Z",  "url": "https://company.zendesk.com/api/v2/users/35436.json",  "user_fields": {    "user_date": "2012-07-23T00:00:00Z",    "user_decimal": 5.1,    "user_dropdown": "option_1"  },  "verified": true}

List Users

  • GET /api/v2/users
  • GET /api/v2/groups/{group_id}/users
  • GET /api/v2/organizations/{organization_id}/users

Pagination

  • Cursor pagination (recommended)
  • Offset pagination

See Pagination.

Returns a maximum of 100 records per page.

Allowed For

  • Admins, Agents and Light Agents

Parameters

NameTypeInRequiredDescription
external_idstringQueryfalseList users by external id. External id has to be unique for each user under the same account.
permission_setintegerQueryfalseFor custom roles which is available on the Enterprise plan and above. You can only filter by one role ID per request
rolestringQueryfalseFilters the results by role. Possible values are "end-user", "agent", or "admin". Allowed values are "end-user", "agent", or "admin".
role[]stringQueryfalseFilters the results by more than one role using the format role[]={role}&role[]={role}

Code Samples

cURL
# List Userscurl https://{subdomain}.zendesk.com/api/v2/users.json \   -v -u {email_address}/token:{api_token}# with role filtering# **Note**: If filtering by multiple roles in curl, make sure to include# the `-g` flag to prevent curl from interpreting the square brackets# as globbing characters. Also enclose the URL in quotes. Example:curl -g 'https://{subdomain}.zendesk.com/api/v2/users.json?role[]=admin&role[]=end-user' \ -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/users?external_id=abc&permission_set=123&role=agent&role[]=agent"	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/users")		.newBuilder()		.addQueryParameter("external_id", "abc")		.addQueryParameter("permission_set", "123")		.addQueryParameter("role", "agent")		.addQueryParameter("role[]", "agent");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/users',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'external_id': 'abc',    'permission_set': '123',    'role': 'agent',    'role[]': 'agent',  },};
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/users?external_id=abc&permission_set=123&role=agent&role[]=agent"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/users")uri.query = URI.encode_www_form("external_id": "abc", "permission_set": "123", "role": "agent", "role[]": "agent")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
{  "users": [    {      "id": 223443,      "name": "Johnny Agent"    },    {      "id": 8678530,      "name": "James A. Rosen"    }  ]}

Search Users

  • GET /api/v2/users/search

Returns an array of users who meet the search criteria.

Returns up to 100 records per page to a maximum of 10,000 records per query. See Using offset pagination.

Pagination

  • Offset pagination only

See Using Offset Pagination.

Allowed For

  • Agents

Parameters

NameTypeInRequiredDescription
external_idstringQueryfalseThe external_id parameter does not support the search syntax. It only accepts ids.
querystringQueryfalseThe query parameter supports the Zendesk search syntax for more advanced user searches. It can specify a partial or full value of any user property, including name, email address, notes, or phone. Example: query="jdoe". See the Search API.

Code Samples

cURL
curl https://{subdomain}.zendesk.com/api/v2/users/search.json?query=gil \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/users/search?external_id=abc124&query=jdoe"	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/users/search")		.newBuilder()		.addQueryParameter("external_id", "abc124")		.addQueryParameter("query", "jdoe");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/users/search',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'external_id': 'abc124',    'query': 'jdoe',  },};
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/users/search?external_id=abc124&query=jdoe"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/users/search")uri.query = URI.encode_www_form("external_id": "abc124", "query": "jdoe")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
{  "users": [    {      "id": 35436,      "name": "Robert Jones",      "notes": "sigil issue"    },    {      "id": 9873843,      "name": "Terry Gilliam"    }  ]}

Autocomplete Users

  • GET /api/v2/users/autocomplete?name={name}

Returns an array of users whose name starts with the value specified in the name parameter. It only returns users with no foreign identities.

Allowed For

  • Agents

Parameters

NameTypeInRequiredDescription
field_idstringQueryfalseThe id of a lookup relationship field. The type of field is determined by the source param
namestringQuerytrueThe name to search for the user.
sourcestringQueryfalseIf a field_id is provided, this specifies the type of the field. For example, if the field is on a "zen:user", it references a field on a user

Code Samples

cURL
curl https://{subdomain}.zendesk.com/api/v2/users/autocomplete.json?name=gil \  -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/users/autocomplete?field_id=&name=gil&source="	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/users/autocomplete")		.newBuilder()		.addQueryParameter("field_id", "")		.addQueryParameter("name", "gil")		.addQueryParameter("source", "");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/users/autocomplete',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'field_id': '',    'name': 'gil',    'source': '',  },};
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/users/autocomplete?field_id=&name=gil&source="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/users/autocomplete")uri.query = URI.encode_www_form("field_id": "", "name": "gil", "source": "")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
{  "users": [    {      "id": 35436,      "name": "Robert Jones",      "notes": "sigil issue"    },    {      "id": 9873843,      "name": "Terry Gilliam"    }  ]}

Count Users

  • GET /api/v2/users/count
  • GET /api/v2/groups/{group_id}/users/count
  • GET /api/v2/organizations/{organization_id}/users/count

Returns an approximate count of users. If the count exceeds 100,000, it is updated every 24 hours.

The response includes a refreshed_at property in a count object that contains a timestamp indicating when the count was last updated.

Note: When the count exceeds 100,000, the refreshed_at property may occasionally be null. This indicates that the count is being updated in the background. The count object's value property is limited to 100,000 until the update is complete.

Allowed For

  • Admins, Agents and Light Agents

Parameters

NameTypeInRequiredDescription
permission_setintegerQueryfalseFor custom roles which is available on the Enterprise plan and above. You can only filter by one role ID per request
rolestringQueryfalseFilters the results by role. Possible values are "end-user", "agent", or "admin". Allowed values are "end-user", "agent", or "admin".
role[]stringQueryfalseFilters the results by more than one role using the format role[]={role}&role[]={role}

Code Samples

cURL
curl https://{subdomain}.zendesk.com/api/v2/users/count.json \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/users/count?permission_set=123&role=agent&role[]=agent"	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/users/count")		.newBuilder()		.addQueryParameter("permission_set", "123")		.addQueryParameter("role", "agent")		.addQueryParameter("role[]", "agent");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/users/count',  headers: {	'Content-Type': 'application/json',	'Authorization': 'Basic <auth-value>', // Base64 encoded "{email_address}/token:{api_token}"  },  params: {    'permission_set': '123',    'role': 'agent',    'role[]': 'agent',  },};
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/users/count?permission_set=123&role=agent&role[]=agent"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/users/count")uri.query = URI.encode_www_form("permission_set": "123", "role": "agent", "role[]": "agent")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": {    "refreshed_at": "2020-04-06T02:18:17Z",    "value": 102  }}

Show User

  • GET /api/v2/users/{user_id}

Allowed For

  • Agents

Parameters

NameTypeInRequiredDescription
user_idintegerPathtrueThe id of the user

Code Samples

cURL
curl https://{subdomain}.zendesk.com/api/v2/users/{user_id}.json \  -v -u {email_address}/token:{api_token}
Go
import (	"fmt"	"io"	"net/http")
func main() {	url := "https://example.zendesk.com/api/v2/users/35436"	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/users/35436")		.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/users/35436',  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