The SOAP API supports a "retrieve()" method that returns all records whose ID's are in some given list of ID's. Is there an equivalent in the REST API?

The closest I could find was https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_retrieve.htm but that only allows me to specify a single ID.

1 Answer 1


You can use the Query resource to execute a SOQL query via REST API that returns all the results in a single response. You can append all the ids in a comma separated list as below. But Salesforce has a limitation of 4,000 characters for Maximum length of SOQL WHERE clause.

  • Thanks Saroj for the response. If the character limit is an issue, do you think I can use the Composite API: developer.salesforce.com/docs/atlas.en-us.api_rest.meta/… to make a series of such Query requests? That way, if the number of ID's I want to retrieve exceeds the character limit, I can partition the list into sublists and make the Query request for each sublist within a Composite API call. Jun 23, 2017 at 22:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .