> For the complete documentation index, see [llms.txt](https://ourzora.gitbook.io/zoraos/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ourzora.gitbook.io/zoraos/dev/zdk/metadata.md).

# Metadata

As with the majority of ERC-721 compliant tokens, the Zora protocol assumes that metadata is stored off-chain on a hosted provider. Since the structure of the metadata is completely unenforceable on-chain, this protocol makes no assumption about its structure. Developers are free to use a metadata schema they feel suits their needs best.&#x20;

{% hint style="info" %}
In the original ERC-721 specification, it was suggested that tokens should link to a metadata URI that contains a link to the specific content of the token within that JSON. However, in the event that the URI for the content and metadata ever had to be changed, there would be no way for the public to ensure the integrity of both the metadata and content. \
\
To remedy this, the Zora protocol explicitly separates content URIs and metadata URIs, providing `sha256` checksums for each. This allows anyone the ability to quickly verify the integrity of hosted media at any time.
{% endhint %}

\
In order to allow the Zora community to integrate with your metadata schema, we provide a [media metadata schema repository](https://github.com/ourzora/media-metadata-schemas), that can serve as the source of truth for community supported metadata schemas. These schemas are defined as JSON schemas, and generate Types, Parsers, Generators, and Validators that are automatically served through the ZDK.&#x20;

### Generate Metadata

Given a schema version and some unformatted JSON, this method generates a valid, minified, and alphabetized JSON object.

```typescript
import { generateMetadata } from '@zoralabs/zdk'

const metadata = {
  version: 'zora-20200101', // The version of metadata you are generating
  name: someName,
  description: someDescription,
  mimeType: someMimeType,
}

const minified = generateMetadata(metadata.version, metadata)
```

### Validate Metadata

```typescript
import { validateMetadata } from '@zoralabs/zdk'

const metadata = {
  version: 'zora-20210101',
  name: randomName,
  description: randomDescription,
  mimeType: mimeType,
}

const isValid = validateMetadata(metadata.version, metadata)
```

### Parse Metadata

```typescript
import { parseMetadata } from '@zoralabs/zdk'

const metadata = `
  {
    version: 'zora-20210101',
    name: randomName,
    description: randomDescription,
    mimeType: mimeType,
  }
`
const parsed = parseMetadata('zora-20210101', metadata)
```

### Define a new Schema

To define a new schema, visit the [metadata schema repository](https://github.com/ourzora/media-metadata-schemas) and follow the instructions in the README.

### Further Reading

* [JSON-schema spec](https://tools.ietf.org/html/draft-zyp-json-schema-04)
* [JSON-schema wiki](https://github.com/json-schema/json-schema/wiki)
