I would like to know the row limit for SOQL using standard REST API. I want to use the GET method and retrieve all the records (most probably with out any filter). So the 50k record limit applies or do we get extended limits? I will be using the below URL

/services/data/v58.0/query?q=select id,name from Account

1 Answer 1


According to the documentation here

It states the following:

When a SOQL query is executed, up to 2,000 records can be returned at a time in a synchronous request.

In summary: You can query up to 2000 records or less in a single request.

Edit: According to the documentation here
You can read the documentation to understand further, but to summarise. In your response body, you will also receive these two properties:
"nextRecordsUrl" and "done"

Image credit here. enter image description here

So you can keep querying until the "done" property is equals to true.

Which means, there is no more records to retrieve. If the "done" property is false, that means there are more records to retrieve.

This is the snippet from the documentation:

If there are still more records to be returned, the response contains a new query locator and done is false. You can continue retrieving results from the initial query until done is true, which indicates that all results are returned.

  • Thanks for the answer @prem22 but I noticed that but I was able to retrieve 13k+ records of a custom object in my org using workbench. The answers in below question suggests we can get 500k records. I wanted to get that confirmed in some document salesforce.stackexchange.com/questions/376634/…
    – Raham
    Jul 19, 2023 at 8:15
  • 2
    I believe you are not retrieving 13k+ records at a time, it is just showing that you have 13k+ records, each time when you click "More...", it is querying the next 200 records and showing it to you.
    – prem22
    Jul 19, 2023 at 8:45
  • Yeah...I belive you are right but how does the third party consume/retrieve the other 2k if they hit salesforce API? I am worried on how they will be able to get the remaining records? they need to construct the URL again with the nextRecordsUrl ?
    – Raham
    Jul 19, 2023 at 9:38
  • 1
    Yes you are right, because in the response body, you get nextRecordsUrl property, and also another property called "done". The "done" property will always return false, if there are more records to be retrieved and will be "true" when there's no more records to return. I have edited my answer added some more explanations extracted from another documentation by Salesforce, in order for you to ensure that all the records are retrieved.
    – prem22
    Jul 19, 2023 at 11:08
  • There is a hard limit of 50,000,000 rows, though, as I understand it, but that should be sufficient for most use cases.
    – sfdcfox
    Jul 19, 2023 at 18:17

You must log in to answer this question.

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