Profile metadata

Lens Protocol Profile Metadata v2

The Profile Metadata Standard describes the metadata associated to a given Lens Profile.

The TypeScript definition for such object is available here.

Build compliant metadata objects

You can build compliant Profile Metadata object via the @lens-protocol/metadata package like so:

import { profile } from '@lens-protocol/metadata';

const metadata = profile({ name: 'John Doe' });

See reference documentation here.

Parse and validate

You can parse a profile metadata object via the bespoke Zod ProfileMetadataSchema:

import { ProfileMetadataSchema } from '@lens-protocol/metadata';

ProfileMetadataSchema.parse(valid); // => ProfileMetadata
ProfileMetadataSchema.parse(invalid); // => throws ZodError

// OR

// => { success: true, data: ProfileMetadata }
// => { success: false, error: ZodError }

Once parsed you can use the type-safe ProfileMetadata object.

JSON Schema

You can find the Profile JSON Schema like so:

import profile from '@lens-protocol/metadata/jsonschemas/profile/2.0.0.json' assert { type: 'json' };

or under its Schema ID URI: Profile v2

For reference only under: