I’m working on a project where I need to fetch NFT images programmatically. I’ve been searching for a way to get the actual artwork of a specific NFT using just the contract address and token ID through a simple HTTP call.
So far I’ve tested several approaches but haven’t found a reliable solution. Most APIs I’ve looked at don’t seem to provide direct access to the metadata URI, which makes it really hard to locate the actual image files stored on IPFS or other storage platforms.
Does anyone know of a web service or API endpoint that can help with this? I just need something that takes a contract address and token number as input and returns either the image URL or the metadata URI so I can grab the image myself.
Oh cool! I’ve been messing around with NFT stuff lately and hit similar roadblocks. Which blockchain are you using? That’ll probably determine which endpoints work best.
Moralis API has been solid for Ethereum NFTs - their getNFTMetadata endpoint hasn’t let me down yet. What approaches did you actually test though? Did you try hitting the contract’s tokenURI method directly first?
Also, are you working with ERC-721 or ERC-1155? The metadata structure varies between them and that can mess with how you grab images. Some collections use weird schemas that threw me off completely.
What about Alchemy’s NFT API? Haven’t used it myself but people seem to like it. Anyone here compared it to OpenSea’s API that creativePainter mentioned?
hey, you should check out the opensea api - it works pretty well! just use their endpoint along with the contract address and token id, and it’ll give you the metadata and the image url. it’s free for basic stuff, just grab an api key.
Had the same issue building an NFT portfolio app. Most APIs cache metadata inconsistently, especially for new mints. Ankr’s multichain API works really well - their getNFTMetadata endpoint handles both ERC-721 and ERC-1155 tokens across different chains without the rate limiting problems you’ll hit with other APIs. It gives you direct image URLs and handles IPFS routing automatically. Just watch out for collections that encode images as base64 in the metadata instead of URLs - you’ll need to handle both. Also double-check that the contract actually supports the metadata extension properly since some older collections have broken tokenURI implementations.