I am getting this error if i specify limit=300 "The remote server returned an error: (400) Bad Request."


I have the following api call to get all the companies details, where currently we have 8700++ companies created inside HubSpo :-


now i wanted to get all the companies we have, but the above API will return 100 records only. so i try to define a limit of 300 (just for testing) as follow:-


but i got this error:-

Message = "The remote server returned an error: (400) Bad Request."

so can i know how we can get all the companies records we have (the 8700++ companies)? and can this be done using one API call ?


Hey, @johnjohn123.

Per the endpoint documentation, the maximum value of the limit property is 250.

It's not possible to retrieve all 8,700+ company records in one API call. As the documentation notes, you'll have to make multiple requests and page through the results. If you use limit=250, this will take at least 35 calls.


ok fine. but in my case how i can modify the url for the API calls to be able to retrieve all the 8700++ records by getting 250 on each request ? can i define a "skip" & "take" parameters inside the api url ?


Hey, @johnjohn123.

Again, the documentation states:

In addition to the list of companies, each request will also return two values, offset and has-more . If has-more is true, you'll need to make another request, using the offset to get the next page of company records.

So, your first request will return up to 250 company records and:

"has-more": true,
"offset": some_value

Your next request will include offset=some_value and so forth.

How "offset" and "has-more" parameters exeactly work?