> 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/switch-an-items-primary-image.md).

# Switch an Item's Primary Image

Use this method to update an item's primary image.&#x20;

### Usage in your script

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

```javascript
const updatedItem = await alturaItem.updatePrimaryImage(IMAGE_INDEX);
```

{% endtab %}

{% tab title="TypeScript" %}

```typescript
const updatedItem IAlturaItem = await alturaItem.updatePrimaryImage(IMAGE_INDEX);
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
`Remember, imageIndex` starts at 0 and **not** 1. Therefore the highest `imageIndex` is `imageCount - 1`
{% 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>imageIndex</td><td>Integer</td><td><strong>Yes</strong></td><td>The index of the image you wish to change to</td></tr></tbody></table>
