Skip to main content

I’m using the Amplitude REST API and it seems like it only lets us query up to 365 days in the past. However, I would like to give “Lifetime” metrics for my customers and some of them are older than a year.

https://developers.amplitude.com/docs/dashboard-rest-api#event-segmentation

 

Is there a way to query longer in the past and if not is that a plan in the dev cycle?

Hey @gsw1 

As far as the chart limits go in an event seg chart, the furthest date you can go till depends on the aggregation granularity. e.g Daily will allow maximum range of 365 days and Monthly allows a maximum range of 36 months. You can read more on the date range query limits here.

So more of less these date range limits apply to the event seg chart endpoint in the Dashboard Rest API as well. You can go past the 1 year range, but by using the monthly aggregation i.e. i = 30 in the API parameter and querying a max 36 month timeline in a single call. Going past the 365 day limit using i=7 won’t be possible for this endpoint. This is applicable if you are looking for uniques/totals by daily/weekly/monthly as a series of datapoints.

If you are just looking at the total unique users over a certain time interval ( the bar chart view ) , then the seriesCollapsed attribute returned as part of the api response will give this value.

Another way would be to segregate your API calls as per the time period and then stitch the timeline, if you want to stick to a daily aggregation and still get more than 1 year worth of data

e.g. start=20210101&end=20211231&i=7 in API call #1

start=20220101&end=20220430&i=7 in API call # 2

 

Hope this helps.

 


Reply