> For the complete documentation index, see [llms.txt](https://docs.underdogprotocol.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.underdogprotocol.com/resources/v1/nfts/update-an-nft.md).

# Update an NFT

There are two API methods to update an NFT.

* PATCH allows for partial updates so you can just pass in the image or the attribute you want to update
* PUT requires the full NFT metadata to be passed in and updates the full metadata&#x20;

If you just want to make a change to a single attribute or just update the image, the PATCH endpoint should be sufficient.&#x20;

If you are trying to remove attributes, you'll need to use the PUT endpoint to pass in the new attribute body.&#x20;

## Partial Update an NFT

{% openapi src="/files/Pk3kQO4TRFPtHxdRaylw" path="/v1/nfts/:mintAddress" method="put" expanded="false" %}
[swagger.json](https://1812349639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMfCqNbNtOQjchD3WfXFA%2Fuploads%2FgiPrImYB9aPmeW2JefRr%2Fswagger.json?alt=media\&token=ba7a249c-f47f-488d-8358-e430bd040504)
{% endopenapi %}

### Example

{% tabs %}
{% tab title="cURL" %}
{% code title="" %}

```bash
curl -X PATCH \
      --url https://api.underdogprotocol.com/v1/nfts/7eYfyPfnGzxp8A9TrQJEpKwVCC8nP9viHRRGJ89WzFJB \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer {token}" \
      -d '
{
  "attributes": {
    "best player": "Tyrese Haliburton"
  }
}'

```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code title="" %}

```javascript
import axios from 'axios';

const mintAddress = '7eYfyPfnGzxp8A9TrQJEpKwVCC8nP9viHRRGJ89WzFJB';

const partialUpdateNft = async () => {
  try {
    const response = await axios.patch(`https://api.underdogprotocol.com/v1/nfts/${mintAddress}`, {
      attributes: {
        'best player': 'Tyrese Haliburton'
      }
    }, {
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${token}`
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Update an NFT

{% openapi src="/files/Pk3kQO4TRFPtHxdRaylw" path="/v1/nfts/:mintAddress" method="patch" expanded="false" %}
[swagger.json](https://1812349639-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMfCqNbNtOQjchD3WfXFA%2Fuploads%2FgiPrImYB9aPmeW2JefRr%2Fswagger.json?alt=media\&token=ba7a249c-f47f-488d-8358-e430bd040504)
{% endopenapi %}

### Example

{% tabs %}
{% tab title="cURL" %}
{% code title="" %}

```bash
curl -X PUT \
      --url https://api.underdogprotocol.com/v1/nfts/7eYfyPfnGzxp8A9TrQJEpKwVCC8nP9viHRRGJ89WzFJB \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer {token}" \
      -d '
{
  "name": "Sacramento Kings",
  "description": "",
  "image": "https://arweave.net/U0PFVZ_LszARt7OgfSiLl--OrRmczn0cNAjw4tYerVQ",
  "attributes": {
    "best player": "Tyrese Haliburton"
  }
}'

```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code title="" %}

```javascript
import axios from 'axios';

const mintAddress = '7eYfyPfnGzxp8A9TrQJEpKwVCC8nP9viHRRGJ89WzFJB';

const updateNft = async () => {
  try {
    const response = await axios.put(`https://api.underdogprotocol.com/v1/nfts/${mintAddress}`, {
      name: 'Sacramento Kings',
      description: '',
      image: 'https://arweave.net/U0PFVZ_LszARt7OgfSiLl--OrRmczn0cNAjw4tYerVQ',
      attributes: {
        'best player': 'Tyrese Haliburton'
      }
    }, {
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${token}`
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error(error);
  }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.underdogprotocol.com/resources/v1/nfts/update-an-nft.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
