# Different base URIs for different token IDs

**URL:** <https://forum.openzeppelin.com/t/different-base-uris-for-different-token-ids/17439>\
**Category:** Smart Contracts\
**Tags:** erc721\
**Created:** [October 23, 2021, 8:15am UTC](https://forum.openzeppelin.com/t/different-base-uris-for-different-token-ids/17439 "2021-10-23T08:15:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeorgePBurdell](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@GeorgePBurdell](https://forum.openzeppelin.com/u/GeorgePBurdell)\
**Post date:** [October 23, 2021, 8:15am UTC](https://forum.openzeppelin.com/t/different-base-uris-for-different-token-ids/17439/1 "2021-10-23T08:15:45Z")

</div>

Hello,

in a smart contract based on ERC721, is there a way to have different base URIs for different tokens? It seems to me that this is not possible and not intended, but I would like to be sure.

Best Regards,  
Marc

---

<div class="post-metadata">

**Author:** ![0xLostArchitect](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/0xlostarchitect/32/9554_2.png) [@0xLostArchitect](https://forum.openzeppelin.com/u/0xLostArchitect)\
**Post date:** [October 23, 2021, 11:14pm UTC](https://forum.openzeppelin.com/t/different-base-uris-for-different-token-ids/17439/2 "2021-10-23T23:14:22Z")

</div>

Hey George! You can define your own `tokenURI` function, so you can theoretically make each each `tokenId` have a different `baseURI` if you wanted. You could even make them dynamic, but that would be a peculiar use case (for example, returning something depending on `block.timestamp`).

I think it fell out of fashion, but OZ's `ERC721` use to ship with something like this:

```auto
    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

```

Looks like there is more discussion [here](https://forum.openzeppelin.com/t/function-settokenuri-in-erc721-is-gone-with-pragma-0-8-0/5978/2).

---

<div class="post-metadata">

**Author:** ![GeorgePBurdell](https://avatars.discourse-cdn.com/v4/letter/g/df788c/32.png) [@GeorgePBurdell](https://forum.openzeppelin.com/u/GeorgePBurdell)\
**Post date:** [October 24, 2021, 7:18am UTC](https://forum.openzeppelin.com/t/different-base-uris-for-different-token-ids/17439/3 "2021-10-24T07:18:25Z")

</div>

Hello LostArchitect,  
thanks for your answer. The link to the other discussion was very helpful!  
Cheers,  
Marc
