Get a list of clients

POST https://api.usedesk.ru/clients

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 clients that meet the specified filter conditions.
The method implements page breakdown. The response has a maximum of 100 entries, the offset parameter is used.

* — required fields

Parameter Value
api_token* Channel API token
created_after

Filter by date and time of creation

Clients created after (inclusive of) the specified date will be included in the extradition.

Example of usage:

"created_after": "2022-01-01 00:00"

created_before

Filter by date and time of creation

Clients created before (inclusive of) the specified date will be included in the extradition.

Example of usage:

"created_before": "2022-12-31 23:59"

offset

Offset

Does not accept null

Offset by 1 will show the next 100 entries

query

Search by customer name, email and phone number

Accepts only one value

search_type

Search type

Accepts one of two values:

  • partial_match — partition search %like%;
  • full_match — full match search,

If no parameter is specified, partial_match is selected by default


PHP request example
$data = array(
    'api_token'=> 'e1cbe1c1c9d910ef2ae975215644cb53dd555de4',
    'offset'=>0,
    'created_after' =>'2016-11-25 00:00',
    'created_before'=>'2016-11-25 15:08',
);
$mch_api = curl_init();
curl_setopt($mch_api, CURLOPT_URL, 'https://api.usedesk.ru/clients');
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;
        


Example of a response from server
[
    {
        "id": 1,
        "name": "UseDesk",
        "emails": "support@usedesk.com",
        "phone": null,
        "tickets": [
            1,
            3089372,
            3091416
        ]
    },
    {
        "id": 16,
        "name": "Google+",
        "emails": null,
        "phone": null,
        "tickets": []
    },
    {
        "id": 17,
        "name": "Shazam",
        "emails": "shazam@email.shazam.com",
        "phone": null,
        "tickets": []
    },
    {
        "id": 18,
        "name": "Google Play",
        "emails": "news-googleplay@google.com",
        "phone": null,
        "tickets": [
            3088240
        ]
    }
]
        


Server response parameters

ParameterDescription
idCustomer ID
nameClient Name
emailsClient Email
phoneClient phone
ticketsArray with client ticket IDs