Update Account Metadata
This guide will help you update Account details like profile picture, name, and bio.
To update Account Metadata, you need to:
Create a new Account Metadata object.
Upload the Account Metadata object onto a public URI.
Set the URI of the Account Metadata on your Lens Account.
The first two steps are similar to the ones in the Create an Account guide so we'll keep them brief.
See the Lens Metadata Standards guide for more information on creating and hosting Metadata objects.
First, create a new Account Metadata object with the updated details.
It's developer responsability to copy over any existing data that should be retained.
Then, upload the Account Metadata object to a public URI.
Upload
import { account } from "@lens-protocol/metadata";import { uploadJson } from "./my-upload-lib";
const metadata = account({ name: "Jane Doe",});
const metadataURI = await uploadJson(metadata); // e.g., lens://4f91ca…
- GraphQL
- React
- TypeScript
Then, you can use the setAccountMetadata mutation to update the Account Metadata URI.
You MUST be authenticated as Account Owner or Account Manager to make this request.
Finally, handle the result as explained in the Transaction Lifecycle guide.