Get assets using Algorand's Indexer REST API 2.0

I am trying to get multi assets using

const sources = data.map((id) => `https://algoindexer.testnet.algoexplorerapi.io/v2/assets?asset-id=${id}`);
  const tasks = sources.map(axios.get);
  const responses = await Promise.allSettled(tasks);

half of those requests fail


so what exactly I am doing wrong?

Welcome to Algorand!

Can you check in the network view of the console what is happening?
My guess is that you hit some limit in the number of queries made per second.
Free API service have limits in the number of queries you can make per second. You need to run your own node or pay for an API service to get higher limits.

For a list of API services: Ecosystem Tools & Projects | Algorand Developer Portal

1 Like

You need to set the request header “x-indexer-api-token” to an empty string.
If you have used any algorand SDK, it will set it internally. So it is preferred to use SDK unless there is a need of functionality that is not supported by SDK.

1 Like

thanks for the help, I was using algoexplorer, I changed it to algonode.io. now it works fine for 70 req. I tried for a bigger number, but it fails because of the limit as you explained @fabrice
@humblefool