---
title: "Asset"
description: "Asset"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/javascript/reference/asset"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-21"
---

# Asset

## Asset

[Assets](/docs/headless-cms/about-assets/) refer to all the media files (images, videos, PDFs, audio files, and so on) uploaded in your Contentstack repository for future use. These files can be attached and used in multiple entries.

## update

The Update Asset call lets you update the name and description of an existing Asset.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).asset('uid')
.fetch()
.then((asset) => {
 asset.title = 'My New asset'
 asset.description = 'Asset description'
 return asset.update()
})
.then((asset) => console.log(asset))
```

## delete

The Delete asset call will delete an existing asset from the stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).asset('uid')
.delete()
.then((response) => console.log(response.notice))
```

## fetch

The fetch an asset call returns comprehensive information about a specific version of an asset of a stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).asset('uid')
.fetch()
.then((asset) => console.log(asset))
```

Enter the version number of the asset that you want to retrieve. However, to retrieve a specific version of an entry, you need to keep the environment parameter blank.

Enter 'true' to include the publish details of the entry.

When true, includes the \_asset\_scan\_status field in the asset response (pending, clean, quarantined, or not\_scanned). Opt-in; omitted from the request by default.

## replace

The Replace asset call will replace an existing asset with another file on the stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

const asset = {
 upload: 'path/to/file.png',
 title: 'Title',
 description: 'Desc'
}

client.stack({ api_key: 'api_key'}).asset('uid').replace(asset)
.then((asset) => console.log(asset))
```

Asset details to replace.

## publish

The publish call is used to publish a specific version of an asset on the desired environment either immediately or at a later date/time.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

const asset = {
 "locales": [
             "en-us"
             ],
  "environments": [
               "development"
              ]
}
client.stack({ api_key: 'api_key'}).asset('uid')
.publish({ publishDetails: asset, locale: "en-us", version: 1, scheduledAt: "2019-02-08T18:30:00.000Z"})
.then((response) => console.log(response.notice))
```

Details of asset to be publish.

Enter the code of the locale that the entry belongs to.

Asset version to be publish

Schedule date for publishing Asset.

## unpublish

The unpublish call is used to unpublish a specific version of an asset on the desired environment either immediately or at a later date/time.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

const asset = {
 "locales": [
             "en-us"
             ],
  "environments": [
               "development"
              ]
}
client.stack({ api_key: 'api_key'}).asset('uid')
.unpublish({ publishDetails: asset, locale: "en-us", version: 1, scheduledAt: "2019-02-08T18:30:00.000Z"})
.then((response) => console.log(response.notice))
```

Details of asset to be unpublished.

Enter the code of the locale that the entry belongs to.

Asset version to be publish

Schedule date for publishing Asset.

## folder

The Folder allows to fetch and create folders in assets.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).asset().folder() 
OR
client.stack({ api_key: 'api_key'}).asset().folder('folder_uid')
```

Folder uid to perform operation

## create

The Create an asset call creates a new asset.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

const asset = {
 upload: 'path/to/file.png',
 title: 'Title',
 description: 'Desc'
}

client.stack({ api_key: 'api_key'}).asset().create(asset)
.then((asset) => console.log(asset))
```

Asset details to create.

## query

The Query on Asset will allow to fetch details of all or specific Asset.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).asset()
.query({ query: { filename: 'Asset Name' } })
.find()
.then((asset) => console.log(asset))
```

Enter 'true' to include the publish details of the entry.

Queries that you can use to fetch filtered results.

When true, includes the \_asset\_scan\_status field in the asset response (pending, clean, quarantined, or not\_scanned). Opt-in; omitted from the request by default.

## download

The Download function will get downloadable file in specified format.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).asset('uid')
.fetch()
.then((asset) => asset.download({responseType: 'blob'}))
.then((response) => // Write response data to destination file. )

import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).asset()
.download({url: 'asset_url_to_download', responseType: 'blob'})
.then((response) => // Write response data to destination file. )
```

The url for the asset to download

Optional parameter to specify the response type.

## Asset | JavaScript Management SDK | Contentstack

Asset manages media files like images, videos, PDFs, and audio uploaded to your repository for reuse across entries in the JavaScript Management SDK.