Determine Pages on rest api request

I’m using the rest api.

Let’s say for example I’m quering Assets, and there are over 7000.

I know there is a parameter called ‘Page’ that can be supplied to the query. How does one know how many pages even exist? The reason I ask is because i want to add pagination to the bottom of my website but how do I know how many pages will exist? Does the initial query return information telling me how many pages are available?

Assuming I write my query in a way where I only collect the first 500. Does the data return to me some information letting me know there are 14 pages in total. As some users may want to jump to a specific page.


Hey John,

I’m looking into this. I’m hoping there’s a way to get what you’re asking for other than “query pages until there isn’t a next page”; I’ll let you know what I find out. Sorry for the radio silence!


I’m sad to say that there isn’t a way to get the paging info you’re after. Best I can offer you is to pull a reasonable number of records client-side and paginate on the data you’ve retrieved, instead of trying to keep a 1:1 between your site and the API. I’d also strongly suggest filtering as closely as possible in your query so that you’re not actually having to deal with 7k assets in a UI :wink:

1 Like

For sure :slight_smile: I appreciate you looking into this for me. Thank you. Sorry to hear there is no solution. But I agree with what you are saying.

1 Like

Hey @tony,
I had to bring this up again. It’s become a bit of an issue for us. We’ve used shotgun to house our asset library which consists of several thousands assets. We then use an external application to more easily browse the assets within the shotgun database using the REST API. However it falls short because we are capped at browsing 2k by the rest api. Is there any way for us to integrate a proper pagination? There is no way of knowing how many pages there are or how many assets there are to paginate through. How does the shotgun website itself do this as shown in the screenshot?

I essentially want to replicate this same feature in my application using the REST API?

Here is how you do it. Use the summarize method and count the number of entries by Id. This is a very fast operation and it’s how I have done it in the past with web apps that need to paginate.