Retrieving stage_change_time from the API

Hi - hoping someone may be able to help me.

We have a deal stage in our main sales pipeline called ‘Demo Scheduled’ and would like extract this information as time series data. So, we’d like to know the number of demos scheduled on a daily basis, so that we can use this in a 3rd party reporting system.

From what I understand, the only way to do this would be to get all deal IDs, then loop through every single deal ID using getDealUpdates (Pipedrive API Reference) and find any ‘deal’ updates for the relevant stage_id and extract the stage_change_time.

Is there a better way?

Creating a goal e.g. CleanShot 2024-05-15 at 21.45.43 · CleanShot Cloud almost works BUT a) you can only display per week or month, not by day and b) the data isn’t accessible via the API in timeseries format.

One alternative I’ve just seen would be to create a new ‘dateDemoScheduled’ custom field in deals, and then update that every time a deal moves to that stage via pipedrive automations, or And then pull data for that custom field via the API, which looks a little easier.

Any advice or thoughts?

Thank you,