# Metadata Functions

## Metadata Functions

These functions involve getting and setting metadata. For more information about metadata, see [what is a metadata file?](/contract-wizard/create/the-metadata-maker/using-the-metadata-maker/metadata.md)

## Read Functions

### *baseURI*

The baseURI function gives you the beginning part of a metadata link.  The baseURI is used to save gas/space. The longer the baseURI is relative to the songURI, the more gas is saved. You want the paths to be short and the baseURI to contain the manifest tx\_id to save the most gas writing on chain.

baseURI + Contract Path = Contract Metadata

baseURI + Song Path = Token Metadata

### contractURI&#x20;

From [IERC721J](/contract-wizard/create/smart-contracts/interface-contracts/ierc721j.sol.md#read-functions). The contractURI function returns the contract metadata link.  This URL is made with the baseURI and the contract metadata path which creates the finished link.

### songURI

From [IERC721J](/contract-wizard/create/smart-contracts/interface-contracts/ierc721j.sol.md#read-functions). The songURI function takes a songId and generation as input and returns the song metadata link.

### tokenURI

From [IERC721Metadata](https://contract-wizard.gitbook.io/contract-wizard/create/smart-contracts/the-code/721j-code/pages/w3oYNs6KcAnNIlIlA3aj#ierc721metadata.sol). The tokenURI function takes a tokenID as an input and returns the token metadata link.  This link is made with the Base URI combined with the songURI. The songURI is the path for the metadata with the songID and rarityID of that tokenID.

## Write Functions

* ***setBaseURI*** - Sets the baseURI. Triggers the ***BaseURIChange*** event.
* ***setContractURI*** - Sets the contractURI. Triggers the ***ContractURIChange*** event.
* ***setSongURI*** - Sets the songURI for one song. Triggers the ***NewSongURI*** event.
* ***setSongURIs*** - Sets the songURIs for many rarities of one song.  The songID stays the same but it accepts an array of rarities. Triggers the ***NewSongURI*** event.
* ***setManySongURIs*** - Sets the songURIS for many rarities of many songs.  This takes an array of songIDs and an array of rarities. Triggers the ***NewSongURI*** event.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://contract-wizard.gitbook.io/contract-wizard/create/smart-contracts/the-code/721j-code/metadata-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
