Retrieving an exact NFT by address and token ID

So, very impressed with how Moralis is able to retrieve all that data for tons and tons of NFTs for a given address, but I was wondering what the correct way is for retrieving a single NFT by its address and token id.

I was able to find this web3 Api which look EXACTLY like what I’m looking for, and I’ve watched Ivan’s video explaining what it is, but I haven’t been able to find anything explaining how to actually call it from the frontend JavaScript.

Please help!

I think that what you found there is getTokenIdMetadata function from Moralis sdk:

const options = { address: "0xd...07", token_id: "1", chain: "bsc" };
const tokenIdMetadata = await Moralis.Web3API.token.getTokenIdMetadata(options);


Thank you. This method seems to work well for some address and token_id pairs, but not so well for others.

For example, the address and id from this NFT: works perfectly well.

But the address and id from this NFT:

Returns error logs

POST 400


{code: 141, error: '[object Object]'}

This doesn’t work because this NFT is not on blockchain, it is only in an internal database on opensea and it will be on blockchain when someone buys it (it is called lazy minting).

1 Like

how can we retrieve the image of this specific tokenId?
do you have a code where I can be based on ?

what is the token id? how can you see the image of that token id now?

token_id .
I Can see it using useNFTBalances()
but this function fetch all the nfts and not specific ones

this is the function specific to a token id: getTokenIdMetadata

thank for your answer, I can’t see this function already provided with hooks on ethereum boilerplate?
do you know the name of it, or it is not existing?

I think that you can use this: