> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update NFTs

> Make your NFTs change over time

Dynamic NFTs are tokens whose content changes over time. There are two ways to achieve this with Crossmint:

1. Using Crossmint's [Edit NFT API](https://docs.crossmint.com/api-reference/minting/nfts/edit-nft.md)
2. Storing the metadata offchain and updating it on your database. To use this option, set the property `reuploadLinkedFiles` to `false` when minting an NFT.

## Using the Edit NFT API

The [Edit NFT API](https://docs.crossmint.com/api-reference/minting/nfts/edit-nft.md) allows you to update the metadata of an existing NFT, including its name, description, image, and attributes. This is useful for creating NFTs that evolve over time or need to be updated based on external events.

### Prerequisites

* Ensure your API key is a server-side key with the `nfts.update` scope
* You need the collection ID and NFT ID from the minting process

### Implementation

```bash cURL theme={null}
curl --request PATCH \
  --url https://staging.crossmint.com/api/2022-06-09/collections/{collectionId}/nfts/{nftId} \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '{
  "metadata": {
    "description": "My updated NFT description!",
    "image": "https://www.crossmint.com/assets/crossmint/updated-image.png",
    "name": "Evolved NFT",
    "attributes": [
      {
        "trait_type": "level",
        "value": "2"
      }
    ]
  },
  "reuploadLinkedFiles": true
}'
```

## Using Off-chain Metadata

You can also store the metadata off-chain and update it directly:

1. When minting the NFT, set `reuploadLinkedFiles` to `false`
2. Use your own server to host the metadata
3. Update the metadata on your server as needed

```javascript theme={null}
// Example: Minting with off-chain metadata
const apiKey = "YOUR_API_KEY";
const chain = "polygon-amoy"; // or "ethereum-sepolia", "base-sepolia", etc.
const env = "staging"; // or "www" for production
const recipientEmail = "TEST_EMAIL_ADDRESS";
const recipientAddress = `email:${recipientEmail}:${chain}`;

// The URL to your metadata server
const metadataImgUrl = "https://your-server.com/metadata/token123.png";

const url = `https://${env}.crossmint.com/api/2022-06-09/collections/default/nfts`;
const options = {
    method: "POST",
    headers: {
        accept: "application/json",
        "content-type": "application/json",
        "x-api-key": apiKey,
    },
    body: JSON.stringify({
        recipient: recipientAddress,
        metadata: {
            name: "Dynamic NFT",
            description: "This NFT will update over time",
            image: metadataImgUrl,
        },
        reuploadLinkedFiles: false,
    }),
};

fetch(url, options)
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
```

## Use Cases for Dynamic NFTs

Dynamic NFTs enable a wide range of applications:

* **Game Assets**: NFTs that evolve as players progress
* **Membership Passes**: NFTs that update based on membership status
* **Event Tickets**: NFTs that change before, during, and after events
* **Digital Collectibles**: NFTs that evolve based on real-world events
* **Loyalty Programs**: NFTs that update based on customer activity

## Best Practices

When implementing dynamic NFTs:

1. **Plan for Updates**: Design your NFT with future updates in mind
2. **Versioning**: Consider including version information in your metadata
3. **Event Triggers**: Define clear conditions for when updates should occur
4. **User Communication**: Inform users about how and when their NFTs might change
5. **Testing**: Thoroughly test update mechanisms before implementation

## FAQs

> [accordion] How often can I update an NFT?
>
> With Crossmint's Edit API, you can update NFTs as needed, but consider blockchain transaction costs and network
> congestion. For very frequent updates, consider using off-chain metadata.

> [accordion] Will updates to an NFT affect its provenance or value?
>
> Updates don't change the token ID or ownership history, but the perceived value may change based on the nature
> of the updates. It's important to communicate your update policy to collectors.

> [accordion] Can I schedule updates to happen automatically?
>
> Crossmint doesn't provide native scheduling, but you can implement scheduled updates using your own backend
> services that call the Edit API at specified times.

> [accordion] Do all marketplaces support dynamic NFTs?
>
> Most marketplaces will display the current state of your NFT's metadata, but the frequency of metadata refreshes
> may vary by marketplace.
