Help & Support

Metadata Standards

This guide explain how Metadata objects are created and managed in Lens.

Lens Metadata Standards, introduced in LIP-2, are a set of self-describing object specifications. These standards ensure that the data includes all the necessary information for validation within itself.

Create Metadata Object

You can construct Metadata objects in two ways:

  • By utilizing the @lens-protocol/metadata package

  • Manually, with the help of a dedicated JSON Schema

Install the @lens-protocol/metadata package with its required peer dependencies:

npm install zod @lens-protocol/metadata@next

Each guide will detail the Metadata object required for the specific use case. In this guide, we will use a few examples to provide practical methods for creating Metadata objects.

import { textOnly } from "@lens-protocol/metadata";
const metadata = textOnly({  content: `GM! GM!`,});

Host Metadata Objects

We recommend using Lens Storage Nodes to host your Metadata objects as a cheap and secure solution. However, developers are free to store Metadata anywhere, such as IPFS, Arweave, or AWS S3, as long as the data is publicly accessible via a URI and served with the Content-Type: application/json header.

In this documentation, examples will often use an instance of the Lens StorageClient to upload Metadata objects.

storage-client.ts
import { StorageClient, testnet } from "@lens-protocol/storage-node-client";
export const storageClient = StorageClient.create(testnet);

You can also upload media files to the same hosting solution, then reference their URIs in the Metadata prior to uploading it.