Auth0 Home Blog Docs

How to paginate user logs in v3

In the /api/v2/logs call, the “total” property currently returns the total number of logs matching the query parameters.

We rely on this value for pagination.

There is an upcoming breaking change in which “total” will no longer provide this information. The breaking changes guidance says, “please update your [pagination] logic to handle this change appropriately.”

Do you have any high level suggestions as to how to manage pagination without this value? Without it, there doesn’t seem to be any way to determine how many pages of logs might be available to view.

For instance, there doesn’t seem to be a “next” token or “more results” flag that would at least indicate that there are more results to get. That would at least enable us to render a “next page” link.

What are other folks doing here?

Without the total you will not indeed be able to estimate the exact number of pages so you will need to consider an approach where if you want to show 20 items per page then your request asks for 21, you render only 20 in the user interface and if there’s one more in the current result set then it means there’s a next page you can request.

Thank you for the suggestion. That will at least enable us to show a “next” link.

It’s a shame to go backwards on this functionality. For companies like us with a standard approach to pagination, we’re now going to have to make an exception for Auth0 user logs.

Thanks a lot for that feedback @jgaines! I’ll make sure to relay it to appropriate team!