Get a list of agents
POST https://secure.usedesk.com/uapi/users
Warning. If you use the server version of Usedesk, you will have a different URL of methods. Check the URL for the API with our team — support@usedesk.com.
The method returns the list of company agents with groups that satisfy the specified filter conditions.
* — required fields
| Parameter | Value |
| api_token* | Channel API token |
| user_type |
User type or role Possible values:
By default: employee |
| group_id | ID of the agents group |
| query | The string that is used for the search |
| user_id |
User ID If this field is passed, information about one agent will be returned |
How to apply filters
{
'group_id':'123',
'query': 'Ivan',
'user_type': 'admin',
}
PHP request example
$data = array(
'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
'group_id'=> 123,
'query' =>'Ivan',
'user_type'=>'admin',
);
$mch_api = curl_init(); // initialize cURL connection
curl_setopt($mch_api, CURLOPT_URL, 'https://secure.usedesk.com/uapi/users');
curl_setopt($mch_api, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($mch_api, CURLOPT_RETURNTRANSFER, true);
curl_setopt($mch_api, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($mch_api, CURLOPT_TIMEOUT, 10);
curl_setopt($mch_api, CURLOPT_POST, true);
curl_setopt($mch_api, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($mch_api, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($mch_api);
return $result;
Sample response from server
[
{
"id": "558",
"name": "Agent Name",
"email": "agent@gmail.com",
"position": "",
"role": "admin",
"phone": null,
"chat_online_status": "1",
"online_status": "0",
"groups": [
{
"id": "123",
"name": "Group",
"company_id": "153561",
"deleted": "0",
"deleted_at": "0000-00-00 00:00:00",
"pivot": {
"user_id": "558",
"user_group_id": "413"
}
},
{
"id": "354",
"name": "Group 2",
"company_id": "153561",
"deleted": "0",
"deleted_at": "0000-00-00 00:00:00",
"pivot": {
"user_id": "558",
"user_group_id": "354"
}
},
{
"id": "127",
"name": "Group 4",
"company_id": "153561",
"deleted": "0",
"deleted_at": "0000-00-00 00:00:00",
"pivot": {
"user_id": "558",
"user_group_id": "127"
}
},
{
"id": "415",
"name": "Test group 3",
"company_id": "153561",
"deleted": "0",
"deleted_at": "0000-00-00 00:00:00",
"pivot": {
"user_id": "558",
"user_group_id": "415"
}
}
]
}
]
Server response parameters
| Parameter | Description | ||||||||||||||||||||||
| id | Agent ID | ||||||||||||||||||||||
| name | Agent's name | ||||||||||||||||||||||
| Agent's Email | |||||||||||||||||||||||
| position | Agent position | ||||||||||||||||||||||
| role | Role of the agent | ||||||||||||||||||||||
| phone | Agent's phone number | ||||||||||||||||||||||
| online_status | Online status of the agent in tickets | ||||||||||||||||||||||
| avatar | Agent avatar URL | ||||||||||||||||||||||
| chat_online_status | Online status of the agent in chats | ||||||||||||||||||||||
| groups | An array of groups the agent is a member of
|