Issue with - Moralis.Web3API.token.getAllTokenIds

Hi, this function works well
Moralis.Web3API.token.getAllTokenIds.

Here is my script.
const options = {address: “0x0540E4EE0C5CdBA347C2f0E011ACF8651bB70Eb9” , chain: “avalanche”};
let NFTs = await Moralis.Web3API.token.getAllTokenIds(options);

But it only takes 500 tokens’ information from 10000 tokens.
How can I set the function to receive full information?

  1. page: 0
  2. page_size: 500
  3. result: Array(500)
  4. [0 … 99]
  5. [100 … 199]
  6. [200 … 299]
  7. [300 … 399]
  8. [400 … 499]
  9. length: 500
  10. total: 10000

Thank you

1 Like

you will have to use pagination, here is how you can get last 500 of those 10000:

options = {address: “0x0540E4EE0C5CdBA347C2f0E011ACF8651bB70Eb9” , chain: “avalanche”, offset: 9500}

You will have to make 20 requests in order to get all those 10000, and increasing offset with 500 every time

I see. It’s limited to retrive 500 tokens at maximum ?

yes, there is a max limit on 500, you can set it lower if you want

1 Like

@cryptokid I would love to know how to set page size limit lower, I have not been able to find that.

Use the limit parameter, that sets the page size.

I don’t know how to do that. I have been able to follow along with the tutorial, but have like caveman level understanding of the code.

Sure, like above,

SDK:

options = {address: “0x0540E4EE0C5CdBA347C2f0E011ACF8651bB70Eb9” , chain: “avalanche”, offset: 9500, limit: 50}

Or if you’re using the REST API, add at the end of your URL

&limit=50
1 Like

Got it to work! Thank you!

1 Like