Retrieve deal by batch

I have used the endpoint https://api.hubapi.com/crm-associations/v1/associations/company_vid/HUBSPOT_DEFINED/6?hapikey=demo to retrieve all the deals associated with the company.

I got an array of about 12 deals. How is it possible to retrieve all deals as a batch? I don’t want to make 12 calls to retrieve each deal.

Cheers,
Chris

Hello @itechspec
You have been in right direction for fetching all the deals associated with a company. The endpoint returns maximum 100 results in a call and a flag of hasMore set to TRUE if there are more results to get and a offset to make next calls. You can use hasMore flag as a indicator to know if more results are there and offset to make next call.
Thanks

Hi Himanshu Rauthan,

Thanks for getting back.

I obtained the results below by calling this endpoint https://api.hubapi.com/crm-associations/v1/associations/62***469/HUBSPOT_DEFINED/6?hapikey=apikey which returned a list of deals associated with a company.

{“results”:[1709463,196447,199309,212960,244427,255213,254573,254065,258093,26338,4309555,500264],“hasMore”:false,“offset”:50864}

Now I need to get these deals details which can be done by using https://api.hubapi.com/deals/v1/deal/108***265?hapikey=apikey.

But the issue is, I need to make 12 calls to retrieve all the deals as the URL above retrieve a single deal.

My question is, how can I fetch all the deals in 1 call? (sort of batch retrieve)

see an example below for "[u]

Get a batch of contacts by vid

[/u]"

https://developers.hubspot.com/docs/methods/contacts/get_batch_by_vid

Many Thanks,

Chris

Hello Chris
For detailed info on each associated deal, yes you need to make individual GET call
Thanks

Thanks again Himanshu Rauthan.

Is there a reason why Hubspot has not exposed a url to retrieve deals by batch?

There are for some other calls though.

Regards,

Chris

Not at all. We do have batch API endpoint for getting the deals and they are like Get all deals, get recently created/modified deals. In your case you can try out get all deals call and get out the details for matching deal IDs. But if you have more deals in the portal then it can take up more GET calls to check over all deals for matching IDs.
Thanks

Thanks Himanshu Rauthan for your help.