> 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 %}
