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

# Asset

## Asset

In Contentstack, any files (images, videos, PDFs, audio files, and so on) that you upload get stored in your repository for future use. This repository of uploaded files is called Assets.

## fetch

The fetch method retrieves a particular asset using its asset UID.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(applicationContext, "apiKey", "deliveryToken", "environment");
Asset asset = stack.asset("assetUid");
asset.fetch(new FetchResultCallback() {
@Override 
public void onCompletion(ResponseType responseType, Error error){

}}
```

callback of the asset response

## includeBranch

The includeBranch method includes the branch information in the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context, "apiKey", "deliveryToken", "environment");
Asset asset = stack.asset("assetUid");
asset.includeBranch();
```

## includeFallback

The includeFallback method includes the fallback language content in the asset response when the specified locale content is unavailable.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.includeFallback();
```

## includeMetadata

The includeMetadata method includes the asset metadata along with the response body.

```
Stack stack = Contentstack.stack(context, "apiKey", "deliveryToken", "environment");
final Asset asset = stack.asset("assetUid");
asset.includeMetadata();
```

## addParam

The addParam method adds a query parameter to the asset request to filter the response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.addParam();
```

Key of the header you want to add

Add value to the header against the header key

## includeDimension

The includeDimension method includes the dimension information such as height and width in the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.includeDimension();
```

## setTags

The setTags method includes the specified tags in the asset response to categorize the asset.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.setTags()
```

## getTags

The getTags method retrieves the array of tags associated with the asset in the response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.getTags()
```

## getDeletedBy

The getDeletedBy method retrieves the deleted by object from the asset response, indicating which user deleted the asset.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.getDeletedBy()
```

## getDeleteAt

The getDeleteAt method retrieves the deleted at object from the asset response, indicating the timestamp when the asset was deleted.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken","environment");
Asset asset = stack.asset("assetUid");
asset.getDeleteAt()
```

## getUpdatedBy

The getUpdatedBy method retrieves the updated by object from the asset response, indicating which user last updated the asset.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(context,"apiKey","deliveryToken", "environment");
Asset asset = stack.asset("assetUid");
asset.getUpdatedBy();
```

## getUpdateAt

The getUpdateAt method retrieves the updated at object from the asset response, indicating the timestamp when the asset was last updated.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.getUpdateAt();
}
});
```

## getCreatedBy

The getCreatedBy method retrieves the created by object from the asset response, indicating which user created the asset.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.getCreatedBy();
}
});
```

## getCreateAt

The getCreateAt method retrieves the created at object from the asset response, indicating the timestamp when the asset was created.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.getCreateAt();
}
});
```

## toJSON

The toJSON method retrieves the JSON object representation of the asset from the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.toJSON();
}
});
```

## getUrl

The getUrl method retrieves the URL of the asset from the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.<span>getUrl()</span>;
}
});
```

## getFileName

The getFileName method retrieves the file name of the asset from the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.<span>getFileName()</span>;
}
});
```

## getFileSize

The getFileSize method retrieves the file size of the asset from the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.getFileSize();
}
});
```

## getFileType

The getFileType method retrieves the file type of the asset from the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.getFileType();
}
});
```

## getAssetUid

The getAssetUid method retrieves the asset UID from the asset response.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.fetch(new FetchResultCallback() {
@Override
public void onCompletion(ResponseType responseType, Error error) {
 asset.getAssetUid();
}
});
```

## removeHeader

The removeHeader method removes a header from the request by using the specified key.

```
import com.contentstack.sdk.*;

Stack stack = Contentstack.stack(<span>context, </span>apiKey, deliveryToken, environment);
Asset asset = stack.asset(assetUid);
asset.removeHeader(headerKey);
```

Key of the header you want to remove

## setLocale

The setLocale sets the locale for a single asset request. Call it before Asset.fetch() so the SDK includes the locale in the GET request.

**Note:** The response contains the asset data for the specified locale. Field-level values depend on your stack’s localization settings and how the [Content Delivery API](/docs/developers/apis/content-delivery-api) serves localized assets.

```
Additional Resource: Refer to the List of Supported Languages document to follow the standard code format or refer to Add a Custom Language document to create and add a custom language.
Example: Creates a stack, fetches an asset with a locale, and reads its fields via getters or toJSON().
import android.content.Context;
import com.contentstack.sdk.*;
import org.json.JSONObject;

Context context = getApplicationContext(); // e.g. call from Activity; or pass Context in from your layer

try {
    Stack stack = Contentstack.stack("<API_KEY>", "<DELIVERY_TOKEN>", "<ENVIRONMENT>");
    Asset asset = stack.asset("<ASSET_UID>");
    asset.setLocale("en-us").fetch(new FetchResultCallback() {
        @Override
        public void onCompletion(ResponseType responseType, Error error) {
            if (error == null) {
                String fileName = asset.getFileName(); // use in UI or downloads
                JSONObject json = asset.toJSON();
                if (json != null) {
                    String title = json.optString("title"); // empty string if key missing; API may localize per locale
                }
            } else {
                String message = error.getErrorMessage(); // e.g. log or show to the user
            }
        }
    });
} catch (Exception e) {
    // Handle stack initialization failure (e.g. log or surface to the user)
}
```

Locale code for the asset (e.g., "en-us"). Sent as the locale query parameter.

## Asset | Android Delivery SDK | Contentstack

Asset represents a single media file from your Contentstack repository in the Android Delivery SDK, giving access to its details and methods.