More than 2500 Deals API

deals

#1

Dear Forum Participants,

i was trying to create an API in order to show some data in Klipfolio. For this I wrote the following API:
https://api.hubapi.com/deals/v1/deal/paged?&properties=closedate&properties=dealstage&properties=pipeline&properties=amount&properties=dealname&properties=num_associated_contacts&properties=hubspot_owner_id&limit=250&offset=
With that API, I get 2500 Deals, but unfortunately I have more than 2500 Deals and the number will continue increasing. Is there any posibility to get ALL the deals of my HubSpot account with an API?
I need the future deals from the "Key Account - Sales" pipeline with their respective Deal Name, Deal Amount, Close Date, Hubspot Owner, Associated with and Deal Stage.
I would be happy to find a solution to this.


#3

Welcome, @j.santiago!

The Get all deals endpoint is able to get all deals in an account, but must be called multiple times.

Can you confirm you're calling the endpoint 10 times (250 deals per call * 10 calls = 2,500 deals)? If so, which offset value returns the final page of deals? (At the end, you should see "hasMore": true.)


#4

@Isaac_Takushi
Thank you very much for your reply :slight_smile:
I am calling the endpoint 10 times but I do not get any "hasMore" (offset values)


#5

Hi @Isaac_Takushi,
Hope you are doing great, do you happen to know what i can do here?
Thanks!


#6

Apologies for the delayed response, @j.santiago. This topic fell through the cracks.

Can you share your Hub ID and the final offset value you get after 10 calls?


#7

@Isaac_Takushi No problem
3348901
I do not get any offset value after 10 calls of 250 deals.


#8

Hi @j.santiago,

I was able to successfully retrieve all 2,688 deals in your account with the 11 calls to the Get all deals endpoint.

Here are all the call offset values returned:

Call 1: No offset returns:

"hasMore": true,
"offset": 195105719

Call 2: offset=195105719 returns:

"hasMore": true,
"offset": 224197680

Call 3: offset=224197680 returns:

"hasMore": true,
"offset": 248434501

Call 4: offset=248434501 returns:

"hasMore": true,
"offset": 258690719

Call 5: offset=258690719 returns:

"hasMore": true,
"offset": 278003430

Call 6: offset=278003430 returns:

"hasMore": true,
"offset": 300938263

Call 7: offset=300938263 returns:

"hasMore": true,
"offset": 313015792

Call 8: offset=313015792 returns:

"hasMore": true,
"offset": 337548602

Call 9: offset=337548602 returns:

"hasMore": true,
"offset": 362022835

Call 10: offset=362022835 returns:

"hasMore": true,
"offset": 397453054

Call 11: offset=397453054 returns:

"hasMore": false,
"offset": 419874281

Call 11 to https://api.hubapi.com/deals/v1/deal/paged?limit=250&offset=397453054 only returns 188 deals. When combined with the ten previous calls, this equals 2,688 deals.

Only

Call 12: offset=419874281 returns an empty object:

{
     "deals": [],
     "hasMore": false,
     "offset": 0
}

But this is expected behavior, because there are no more deals to return.

Please confirm you are seeing the same behavior.

If you are not, please send me the full URL of the call which returns "hasMore": false.