How Can I Update the NFTs Metadata Using Alchemy’s NFT API?
If you need to update the metadata for all the NFTs in your contract or for a specific NFT, Alchemy offers methods that allow you to refresh this data easily. Please note that the reingestContract
method is being replaced by the new invalidateContract
method. Below are the steps you can follow to update your NFT metadata.
How Do I Update Metadata for All NFTs in a Collection?
To update the metadata for every NFT in your contract, you can use the invalidateContract
method. This method will re-fetch and update the metadata for all tokens under the specified contract.
Example invalidateContract
Call:
curl --request GET \
--url 'https://eth-mainnet.g.alchemy.com/nft/v3/docs-demo/invalidateContract?contractAddress=0xe785E82358879F061BC3dcAC6f0444462D4b5330' \
--header 'accept: application/json'
Simply replace the contractAddress
parameter with the address of your own contract. For more detailed information, please refer to the API documentation for the invalidateContract method.
How Do I Update Metadata for a Specific NFT?
If you want to refresh the metadata for just one specific NFT, you can use the getNFTMetadata
method with the refreshCache
parameter set to true. This will force the metadata to be refreshed for that individual token.
Example getNFTMetadata
Call:
curl --request GET \
--url 'https://eth-mainnet.g.alchemy.com/nft/v3/docs-demo/getNFTMetadata?contractAddress=0xe785E82358879F061BC3dcAC6f0444462D4b5330&tokenId=44&refreshCache=false' \
--header 'accept: application/json'
Replace contract_address
with your contract’s address and token_id
with the token ID of the specific NFT you want to refresh.
Why is my reingestContract request stuck on “In Progress”?
The reingestContract
method is being replaced by the invalidateContract
method, which offers a more reliable way to update NFT metadata. If you are experiencing issues with reingestContract
, we recommend switching to invalidateContract
for better results.
For any further questions or issues regarding NFT metadata updates, feel free to reach out to our support team by opening a ticket, and stay tuned for updates as we continue to enhance our API features!