Solved

Return average session length by user through the API?

  • 23 March 2022
  • 1 reply
  • 128 views

Hey, I am trying to find the average session length by user. I know this is possible on a chart but using the endpoint: 

GET https://amplitude.com/api/3/chart/CHART_ID_HERE/query

Only returns 1000 user ids. Another way would be to use the user activity endpoint but this would be a long process. 

I essentially want the following endpoint:

GET https://amplitude.com/api/2/sessions/peruser

But with the ability to group by cohort, property or those who have performed a particular event.

icon

Best answer by MikkoKarvonen 24 March 2022, 07:36

View original

1 reply

Userlevel 5
Badge +3

Are you looking for this data for each individual users or the average for a group of users?

If latter, you can achieve this by building and saving the chart in the Amplitude web UI and then using the first API you listed.

If you are looking for individual users, you’ll probably run into the limitations. But you could get around them by building your chart to only include max 1000 users.

Reply