Work with List Views

Use the List View resources to get record data and metadata about list views displayed in the Salesforce UI.
Get Record Data for a List View Using GET
You can get record data for a list view using a GET request and URL parameters to modify the results.

As an example, let’s say we have a list view named All Accounts with a list view ID of 00BR0000000Wc0rMAC. To get information about all the records on this list view, make this request.

GET /services/data/v64.0/ui-api/list-records/00BR0000000Wc0rMAC

You can also use the object API name and list view API name of the list view to make the same request.

GET /services/data/v64.0/ui-api/list-records/Account/AllAccounts

To get record data for the most recently used (MRU) list view for accounts, use the special __Recent list view API name.

GET /services/data/v64.0/ui-api/list-records/Account/__Recent
Modify the GET List View Results with URL Parameters.
Modify the list view results using these URL parameters.
  • fields—Additional fields queried for the records returned, for display purposes. If a field is specified and the user doesn’t have access to it, an error occurs.
  • optionalFields—Additional fields queried for the records returned, for display purposes. If a field is specified and the user doesn’t have access to it, no error occurs.
  • pageSize—The number of list records viewed at one time.
  • pageToken—A token that represents the page offset.
  • searchTerm—A search term to filter the results.
  • sortBy—The API names of the fields the list view is sorted by.
  • where—A where string, using GraphQL syntax, to filter the results.

For example, to sort records by the date they were created, set the sortBy parameter to CreatedDate.

GET /services/data/v64.0/ui-api/list-records/00BR0000000Wc0rMAC?sortBy=CreatedDate

Depending on the list view object, some extra fields that were not requested in the fields or optionalFields parameters can be returned. For example, if person accounts are enabled for the org, a request to get list view records can return the isPersonAccount field, among others.

Note

Get Record Data for a List View Using POST
You can also get record data for a list view using a POST request and a request body to modify the results.
This example uses a request body to query a list view named All Accounts.
POST /services/data/v64.0/ui-api/list-records/Account/AllAccounts
{
  "fields": ["Name", "Type", "AnnualRevenue", "CreatedDate"],
  "pageSize" : 10,
  "sortBy": ["CreatedDate"],
  "searchTerm" : "United",
  "where": "{AnnualRevenue: { gt: 1000000}}"
}
This example uses the special __Recent list view API name to get the record data for the most recently used (MRU) list view for accounts.
POST /services/data/v64.0/ui-api/list-records/Account/__Recent
Get Metadata for a List View
You can get metadata for a list view using a GET request.

As an example, let’s say we have a list view named All Accounts with a list view ID of 00BR0000000Wc0rMAC. To get information about the metadata for this list view, make this request:

GET /services/data/v64.0/ui-api/list-info/00BR0000000Wc0rMAC

You can also use the object API name and list view API name of the list view to make the same request:

GET /services/data/v64.0/ui-api/list-info/Account/AllAccounts

To get the most recently used (MRU) list view metadata for accounts, use the special __Recent list view API name.

GET /services/data/v64.0/ui-api/list-info/Account/__Recent

To get the search layout list view metadata for accounts, use the special __SearchResult list view API name.

GET /services/data/v64.0/ui-api/list-info/Account/__SearchResult