Can I pull a historical audit trail from each deal?


#1

I want to be able to extract the audit trail data about a deal - info such as "date created", "owner" etc but then also the full list of changes that have been applied to the deal, by whom, and on which date (and ideally from what value to what value too).

From my initial reading of the API documents the API is more for CRUD actions inside the Hubspot application, not for pulling a history of the CRUD actions that have been applied to a deal throughout its lifetime.

Can anyone point me in the right direction to pull this information, or let me know if it isn't possible to extract please?


#2

Hi @Cognopia, you can get all deals with history by including propertiesWithHistory=property_name_here.

For example, I made a GET request to api.hubapi.com/deals/v1/deal/paged?hapikey=XXXXXXX&propertiesWithHistory=dealname&propertiesWithHistory=dealstage&limit=2 and was returned the following:


#4

Thanks Conor. If I was pulling all the historical data changes across every deal/contact/account then this might be quite resource intensive - is there a better way to pull such a rich history, or does it have to hit the URL on a per property basis?

I see you've limited the number of deal changes pulled here to 2 - is there an upper bound on the API if we wanted to pull the entire history?


#5

Hi @Cognopia, you can include propertiesWithHistory multiple times, just like you can with properties. It'd look like: &propertiesWithHistory=property1&propertiesWithHistory=property2& etc. etc. You'd only need to make one API call, but you'd have to include all properties you're interested in. Limit can be up to 250 but defaults to 100 if you don't include it. Please review these docs for more info: https://developers.hubspot.com/docs/methods/deals/get-all-deals


#6

Awesome - thanks for the advice.