Different URI for each tokenID

My question is, is it possible to assign a different URI to each token id? Preferably also automatically with an api.

In my project NFTs are created over different data of an API. So every NFT looks different and needs a different URI/ metadata. Is this possible? If yes how? Maybe dynamic NFTs?

Thank you!

Hello @earl_grey

As described in EIP-721, the token URI function takes a a uint256 parameter

    /// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
    /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
    ///  3986. The URI may point to a JSON file that conforms to the "ERC721
    ///  Metadata JSON Schema".
    function tokenURI(uint256 _tokenId) external view returns (string);

You can implement that however you want ... and there are MANY possible ways. Using ERC721URIStorage is one of them, but in the end it really depends on the specificities of your usecase.

Thanks for your help. I will have a closer look again :slight_smile: