> For the complete documentation index, see [llms.txt](https://docs.altura.com/altura-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.altura.com/altura-documentation/js-sdk-reference/smart-nft-endpoints/add-a-new-image.md).

# Add a New Image

This method allows you to append a new image to an existing item at a specified index and optionally set the newly appended image as the primary image.

### Usage in your script

{% tabs %}
{% tab title="First Tab" %}

```javascript
const updateItem = await alturaItem.appendImage(IMAGE_URL, IMAGE_INDEX, SET_AS_PRIMARY)
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
const updateItem: IAlturaItem = await alturaItem.appendImage(IMAGE_URL, IMAGE_INDEX, SET_AS_PRIMARY)
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
SET\_AS\_PRIMARY is an optional Boolean value. If set true, the newly appended image is set as the item's primary image.
{% endhint %}

### **Parameters**

<table><thead><tr><th width="141.33333333333331">Parameter</th><th width="88">Type</th><th width="109">Required</th><th>Description</th></tr></thead><tbody><tr><td>imageUrl</td><td>String</td><td><strong>Yes</strong></td><td>The url of the image/video to add</td></tr><tr><td>imageIndex</td><td>Int</td><td><strong>Yes</strong></td><td>The index that the image should be inserted into</td></tr><tr><td>setAsPrimary</td><td>Boolean</td><td><strong>Optional</strong></td><td>Boolean to set the newly appened image as the items primary image</td></tr></tbody></table>
