API - Fetch deal value of pipeline

deals

#1

I’m developing a custom dashboard for my client, outside of the Hubspot application. What I want to do is display all pipelines currently in my Hubspot sales program. Next to that I want to display the total deal value in the pipeline.

It seems to me this is quite straight-forward, but I cannot find the right API for this. Is this even possible? I have been able to get all pipelines and their names, I have also been able to get all deals and their value, but haven’t been able to link the two.

Any help is appreciated. :slightly_smiling_face:


#2

Hi @Patrick_Steenks,

When making the request to get your deals you can include `properties=pipeline’ query parameter to include the deal’s pipeline in the response. The request URL might look something like this:

https://api.hubapi.com/deals/v1/deal/paged?hapikey=demo&properties=pipeline&properties=amount

The response would include all deals, and each deal would include its pipeline and amount. You could then use this to calculate the total value for each pipeline.


#3

Yeah, super that works, thanks!


#4

Another related question. I’m looking to get the close date of a deal. As well as the stage in the deal pipeline, the value of the deal, and the percentage of the deal completion.

Right now I use this url: https://api.hubapi.com/deals/v1/deal/paged?hapikey=demo&properties=pipeline&properties=amount&properties=dealname&properties=dealstage&properties=closedate

However, closedate does not seem to correspond with the close date in hubspot itself. Also I am able to get the dealstage, but not the percentage for the value of the deal.

Am I looking in the right API, or should I use another one?


#5

Hi @Patrick_Steenks,

After some testing, I’m not seeing inconsistencies on my end regarding the closedate property. One thing to keep in mind is that the value of the dealstage is distinct from the time stamp of the property; the time stamp is when the property was set, the value is the actual closedate. Additionally, the closedate property is a date property, which means it’s set to UTC midnight for the date. This means the timestamp might look different from your timezone. (e.g. if I set a deal’s closedate for today, 9/6/2017, the timestamp would be 1504656000000)

Regarding the percentage of the value; querying the amount of a deal will return the full amount, before factoring the forecasted percentage based on a deal’s dealstage. That percentage is not returned when pulling a deal’s dealstage; instead you’ll need to get that information from the deal pipeline itself (see below).


#6

Thanks a lot for that, got it working now.

Would it also be possible to only get the deals that have closed/won status and the value of those deals per month?


#7

Hi @Patrick_Steenks,

It’s not currently possible to filter the deal you get based on deal stage; you’ll need to request all deals and include the dealstage property, filtering out the relevant deals on your end.