APIs & Integrations


Pagination not working property with the deals SEARCH endpoint

I'm trying to search for contacts that do not have an owner.

I'm using python and here's how my request looks like


headers = {"content-type":"application/json"}
filters = {"filterGroups": [{"filters": [{"propertyName": "hubspot_owner_id","operator": "NOT_HAS_PROPERTY"}],}],"limit":100}
paramso = {'hapikey': HUB_SPOT_API_KEY}
response = requests.post(cls.search_end_point,params=paramso,json=filters,headers=headers)


search_end_point = 'https://api.hubapi.com/crm/v3/objects/deals/search'

The problem is, in the Response's JSON: I'm getting a total of 250 which brings the need to paginate.
And when I do response.json().get("paging"), here's what I get:
{'next': {'after': '100'}}

Isn't that weird ?

1 Reply 1
Recognized Expert | Partner
Recognized Expert | Partner

Pagination not working property with the deals SEARCH endpoint

Hey @shtlrs 


When you say not working properly what do you mean?

Disclaimer: I'm not familiar with PHP, I'm using postman and am relatively new to the API.


I believe you'd have to make additional calls after your limit. I could be off base here but I believe the "next…after" is just letting you know that you next call should define "after" as 100 or above.


Your next call might look like:




filters = {"filterGroups": [{"filters": [{"propertyName": "hubspot_owner_id","operator": "NOT_HAS_PROPERTY"}],}],"limit":100,"after":100}





I like to sort the response jut so i know im getting the objects in an order I define.


Another thing, which you probably know: You can probably build you limits by dividing the total by the limit, thus giving you your number of pages.