Help with inventory api?

I’m using the api "https://apis.roblox.com/game-passes/v1/users/{UserId}/game-passes?count=100; however, I haven’t been able to find a way of obtaining more than just the first page of the user’s inventory.

I’ve looked on the forum; however, most posts refer to the older api and use parameters which no longer work with the newer api. Such as: pageNumber

If anyone has any idea please let me know.

Thanks for reading!
Have a good day :slight_smile:

1 Like

Wasn’t apis.roblox.com deprecated?

1 Like

My exact thought. I’m pretty sure there should be another endpoint around.

Edit: No, it hasn’t been deprecated. User Inventories

Pasted from Roblox Documentation

Paginate results

If a response includes a value for nextPageToken, use that value in the pageToken parameter of the subsequent request to retrieve the next page. For more information, see Pagination.

If the number of results is divisible by maxPageSize (for example, you have 50 results and a maxPageSize of 25), you can encounter a situation in which your response includes a value for nextPageToken, but a request using that token returns no results:


GET /cloud/v2/users/{userId}/inventory-items?maxPageSize=25&pageToken=cccDDD
{
    "inventoryItems": [],
    "nextPageToken": ""
}

When implementing pagination in your app, best practice is to check not just for a non-empty nextPageToken, but also for a non-empty inventoryItems array.

1 Like

No, api.roblox.com is the deprecated api endpoint. All api endpoints are slowly migrating to the new apis.roblox.com endpoint which open cloud itself uses.

1 Like

This endpoint has an exclusiveStartId query which is used instead of the regular pagination methods. (“nextPageToken”). Your endpoint should look like this:

https://apis.roblox.com/game-passes/v1/users/{USERID}/game-passes?count=100&exclusiveStartId={GAMEPASSID}

ExclusiveStartId returns a list of gamepasses after a specific gamepass, use the last gamepass id returned from the array as the exclusiveStartId.

@venviqr’s method is also an alternative and can be used, I suggest marking them as the solution if their method works better for you as the cloud api also uses apis.roblox.com

1 Like

Thank you! The solution you provided seems to be exactly what I needed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.