Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Record Count

Lists information about object record counts in your organization.

This resource is available in REST API version 40.0 and later for API users with the “View Setup and Configuration” permission. The returned record count is a cached snapshot in time that may not accurately represent the number of records in the object at the time of the request.

The record count value is updated automatically at variable time intervals, and there are no fixed schedules for these updates. It doesn’t include the following types of records:

  • Deleted records in the recycle bin
  • Archived records
  • Associated objects such as ChangeEvent, Feed, History, OwnerSharingRule, and Share objects

To get an accurate count, use the SOQL query SELECT count() FROM sObject. Results are limited to records visible to the user executing the query.

Syntax

URI: /services/data/vXX.X/limits/recordCount?sObjects=objectList

Formats: JSON, XML

HTTP Method: GET

Authentication: Authorization: Bearer token

Parameters

Parameter Description
sObjects A comma-delimited list of object names. If a listed object isn’t found in the org, it’s ignored and not returned in the response. This parameter is optional. If this parameter isn’t provided, the resource returns record counts for all objects in the org.

Response body: Record Count Response Body

Example

Example Request

1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/limits/recordCount?sObjects=Account,Contact -H "Authorization: Bearer token"

Example Response Body

1{
2   "sObjects" : [ {
3     "count" : 3,
4     "name" : "Account"
5   }, {
6     "count" : 10,
7     "name" : "Contact"
8   } ]
9}