The returned response can be sorted by a field of the Contact Object in descending or ascending order. The two keys sort-fields and sort are appended to the URI for the Contacts API and can be used in conjunction with filtering and bucketing.


The URI with sorting has the following syntax:


The sort-fields key determines which field of the Contact Object will be used to sort the returned response. The sort key determines if the Contact Objects returned in the response will be in ascending or descending order.

The sort-fields key can consist of any of Field Types except the structured fields Name and Address. Use displayName, first or last to sort by name.

The sort key may consist of the following:

  • asc - sort in ascending order (default)
  • desc - sort in descending order

Sorting Examples

Sorting by Name

The example below returns contacts whose phone numbers begin with 415. The returned Contact Objects contain only the name, phone, and email fields and are sorted by the displayName field in ascending order.{guid}/contacts;phone.startswith=415;out=name,phone,email;sort-fields=displayName;sort=asc?format=json;

Sorting By Company

This example returns contacts sorted by the company name in descending order. The returned response has Contact Objects that contain only the name, phone, email, and company fields:{guid}/contacts;out=name,phone,email,company;sort-fields=company;sort=desc

Table of Contents