getTokenIDOwners problem

Hi moralis team,

I have one issue using moralis apis for ERC1155.
I have several ERC-1155 nfts now.
So, I tried to get all owners from the ERC-1155 NFTs using getTokenIdOwners functions.
But, it returns 400 error(limit error) because this function has too many requests(maybe 20 requests)

This Moralis Server is rate-limited because of the plan restrictions. See the details about the current rate and throttle limits: {β€œx-rate-limit-limit”:β€œ25”,β€œx-rate-limit-remaining-ttl”:β€œ5”,β€œx-rate-limit-used”:β€œ40”,β€œx-rate-limit-remaining-ip-ttl”:β€œ5”,β€œx-rate-limit-ip-used”:β€œ40”}

for (let nft of NFTs) {
let metadata = null;
//get metadata
const options = {
address: nft.token_address,
token_id: nft.token_id,
chain: process.env.REACT_APP_CHAIN_ID
const result = await Moralis.Web3API.token.getTokenIdOwners(options);
… …

How can I fix this issue?

Hope your quick help.


1 Like

you can fix it easily by adding a delay of 1 second between requests.

Thanks for your reply.

Surely, I thought about it.
But if I have 1000 nfts, it will take 1000s.
I think it is not the correct solution.

Is there more sufficient and efficient solution?


there is another solution where you can upgrade your account to PRO plan, in that case you can do 60 requests/compute units per second vs 25 with a free plan

you can try with a delay of 0.5 seconds too, there will be 500 results per page

Are you sure upgrading free plan will solve this issue fully?
Sorry, I need your correct answer.
So, I can notice it to my client.
Thank you.

with pro plan you can do 2.4 more requests in a second compared to a free plan, I don’t know if it will solve the problem completely.

Okay, got it.
Thank you very much.

Thanks for the answer. Please could you give some guidance on how to add delays between requests? I am using react.

Thanks a lot.

You can use setTimeout as a basic way. There is an example here.

1 Like