Skip to main content

If I wanted to see the number of unique users who completed Any Event I could go to the Amplitude app and see this chart as an event segmentation:

Alternatively I could use the Dashboard REST API to gather this same data. I could submit a request to https://amplitude.com/api/2/events/segmentation?e={"event_type":"_all"}&start=20210721&end=20210820 

When I hit this endpoint and look at the seriesCollapsed part  of the data I would expect that number to be 6098. Instead the number I am getting is 212.

I have tested this with different events, both custom and Amplitude events. The data never matches. I am making sure that my date ranges are consistent.

 

Am I making a mistake? Is the Amplitude API buggy? I wouldn’t really mind if there was a small gap between the two pieces of reported data but the difference is always significant.

 

Thanks for any help.

 

Hey @clayton 
Is the event segmentation chart that you are seeing in Amplitude UI for uniques or for totals for “Any Event”?

The event segmentation endpoint by default outputs the uniques for that event. If the chart you created in the UI is using totals and the api call is without the “m” parameter , then this might explain the discrepancy as you will be comparing totals vs uniques.

Can you try adding in the parameter “m” and toggling the api call between m=uniques vs m=totals, with everything else remaining the same?


Thanks for the response @Saish Redkar

In Amplitude UI I can toggle between Uniques and Totals which return 6,110 and 361,158. When I hit the endpoint and toggle between Uniques and Totals it returns 212 and 4076


Since you are getting a valid response from the endpoint, this rules out the possibility of a malformed request from what I know.

Keeping everything else consistent, the only other thing I would check again is if your querying event is the same ( Any Active Event vs Any Event )  and/or if you are querying against the same project’s API Key/Secret. 

 


I feel like an idiot. Good catch. I had messed up which projects I was querying against.


Reply