Getting Started
Update an NFT
Update your NFT's name and metadata as the update authority.
Update an NFT
In the following section you can find a full code example and the parameters that you might need to change. You can learn more about updating NFTs in the Core documentation.
1import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'
2import { update } from '@metaplex-foundation/mpl-core'
3import { mplCore } from '@metaplex-foundation/mpl-core'
4import { publicKey } from '@metaplex-foundation/umi'
5
6const umi = createUmi('https://api.devnet.solana.com').use(mplCore())
7const assetAddress = publicKey('AssetAddressHere...')
8
9// Update an existing NFT asset's metadata
10const result = await update(umi, {
11 asset: assetAddress,
12 name: 'Updated NFT Name',
13 uri: 'https://updated-example.com/metadata.json',
14}).sendAndConfirm(umi)
15
16console.log('Asset updated successfully')
1
Parameters
Customize these parameters for your update:
| Parameter | Description |
|---|---|
assetAddress | The public key of the NFT to update |
name | New name for the NFT (optional) |
uri | New metadata URI (optional) |
How It Works
The update process involves three steps:
- Fetch the NFT - Get the current NFT data using
fetchAsset - Prepare update - Specify the new name or URI you want to change
- Send update - Execute the update transaction
Only the update authority of the NFT can modify it. If the NFT is part of a collection and uses collection authority, you need to be the collection's update authority.
