Data from Live.GetLastVisitsDetails API and Events UI are different

I created and logged some custom events, but the data from the reporting API Live.getLastVisitsDetails and the Events web page UI are different. I found the API event count is always smaller than the count on the UI.

In the UI Behaviour → Events page. Filter by date, it’s showing 15 events in the UI for 2021-07-28.

However, when I call Live.getLastVisitsDetails API to get the event data, there are 17 events returned, 3 of them belong to 2021-07-27. So there are only 14 events are returned in the API for 2021-07-28.
One event is missing.

I’m sure it’s not timezone problem because 1) the timezone is set to be UTC, and I searched the date before but still couldn’t find the event.

I tried to manually run the archive process, but there’s no difference. The archive process should not archive today’s data.

This is for matomo 4.3.1 and 4.4.0. But the problem exists in all Matomo 4.

Is there a way to investigate this issue? Thanks!

I’m experiencing the same issue as well and am having doubts about the API providing accurate data. Seems like a big problem for anyone who wants to extract their data from Matomo….

As it seems to be a bug, you should maybe create a ticket in the GitHub repo: Issues · matomo-org/matomo (github.com)