Zendesk - Love your helpdesk.

we are hiring!
  1. Home
  2. Tour
  3. Extras
  4. Buzz

REST API: Users

Users in your help desk are assigned one of the following roles:

Role value
End user 0
Administrator 2
Agent 4

Administrators always have Agent priviliges, in addition to Administrator priviliges.

Additionally, you can define ticket access restrictions for end-users and agents:

Restricted to: Value Applicable for end-users Applicable for agents
All tickets 0 x
Tickets in member groups 1 x
Tickets in member organization 2 x x
Assigned tickets 3 x
Tickets requested by user 4 x

Show

GET /users/#{id}.xml
Returns a single user.

Response

Status: 200
<user> <created-at>2007-05-15T18:07:57Z</created-at> <email>aljohson@yourcompany.dk</email> <id>88</id> <is-active>true</is-active> <is-verified>true</is-verified> <name>Al Johnson</name> <roles>4</roles> <restriction-id>1</restriction-id> <time-format>0</time-format> <time-zone>(GMT +01:00) Brussels, Copenhagen, Madrid, Paris</time-zone> <updated-at>2007-07-06T12:46:12Z</updated-at> <organization_id>2143</organization_id> <groups> <group> <id>13</id> <is-active>true</is-active> <name>Support</name> </group> <group> <id>3</id> <is-active>true</is-active> <name>Sales</name> </group> </groups> </user>

This user is an agent, and is a member of 2 groups with access to tickets in member groups only.

List All

GET /users.xml
Returns all users in your help desk. The list is paginated using offsets. If 15 elements are returned (the page limit), use ?page=2 to check for the next 15 and so on.

Status: 200
<users> <user> ... </user> <user> ... </user> </users>

List by search term

Get /users.xml?query=John&role=2
Returns a collection of users that has a name matching the query passed in through the URL. The list is paginated using offsets. If 15 elements are returned (the page limit), use ?page=2 to check for the next 15 and so on.

Response

Status: 200
<users> <user> ... <name>John Smith</name> <role>2</role> </user> <user> ... <name>Alexander Johnson</name> <role>4</role> </user> </users>

Create

POST /users.xml
Creates a new user. The XML for the new user is returned on a successful request with the timestamps recorded and user id. If the account doesn’t allow for more users to be created, a “507 Insufficient Storage” response will be returned.

Request

<user>
  <email>aljohson@yourcompany.dk</email>
  <name>Al Johnson</name>
  <roles>4</roles>
  <restriction-id>1</restriction-id>
  <groups type='array'>
    <group>2<group/><group>3<group/>
  </groups>
</user>

Response

Status: 201
Location: http://account.zendesk.com/users/#{new-user-id}.xml

Update

PUT /users/#{id}.xml
Updates an existing user with new details from the submitted XML.

Request

<user>
  <name>Albert Johnson</name>
  <groups type='array'>
    <group>2</group>
  </groups>
</user>

Note that if you do not submit a groups array, the user does not get unassigned from his groups. If you submit an empty group array, the user gets unassigned from all groups:

<user>
  <name>The man with no groups</name>
  <groups type='array'></groups>
</user>

Response

Status: 200

Updates the user and sets the user to be a member of group 2 only. Omit the part, if you do not wish to change the users’ group status.

Destroy

DELETE /users/#{id}.xml
Destroys the user at the referenced URL.

The user is not actually deleted from the system, but is set inactive and can no longer be assigned or submit tickets and entries.

Response

Status: 200