> For the complete documentation index, see [llms.txt](https://yuga.gitbook.io/zkyuga-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yuga.gitbook.io/zkyuga-whitepaper/developer-guide/erc721/tokenuri.md).

# tokenURI

## tokenURI

The `tokenURI` method is exclusive to the ERC-721 token standard and serves the purpose of fetching a Uniform Resource Identifier (URI) associated with a given token ID. This URI typically directs to metadata concerning the token, often stored in a JSON format containing details such as the token's name, description, image, and other attributes. Embedded within the `ERC721Instance` object, this method can be accessed through appropriate functions provided by client libraries such as `ZkyugaClient`.

### Method Signature

```javascript
tokenURI(tokenId: string): string
```

#### Parameters

| Parameter | Type   | Description                                                                                                                                                                                                |
| --------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tokenId   | string | A unique identifier specific to an ERC-721 token within a contract. Each non-fungible token (NFT) has a distinct `tokenId`, distinguishing it from others. This ID is used to retrieve the associated URI. |

#### Returns

* A string representing the URI linked with the provided token ID.

### Usage Example

Begin by instantiating the desired ERC-721 token contract:

```javascript
const erc721 = zkyugaClient.getERC721Instance("your ERC-721 contract address here");
```

Then, call the tokenURI method with a specific token ID:

```javascript
const tokenId = "12345"; // Example token ID
const uri = erc721.tokenURI(tokenId);
console.log(`Token ID ${tokenId} has the following URI: ${uri}`);
```

### Notes

* The URI returned may be a complete URL, pointing to resources such as IPFS hashes or web servers, or it may be a base URI concatenated with the token ID, depending on the token's implementation.
* The actual metadata content at the URI typically resides off-chain, reducing storage costs and enhancing flexibility.
* Always validate the provided token ID to avoid potential errors or undefined return values.

***
