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

# Asset

## Asset

The Asset class represents a single asset and fetches its metadata from the delivery API.

**Note:** For files **over 4 GB**, fileSize may overflow due to 32-bit type limits and may not represent the actual file size.

## setLocale

The setLocale method sets the locale code used when fetching the asset so the response is in the requested language.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset *asset = [stack assetWithUID:@"ASSET_UID"];
[asset setLocale:@"en-us"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
let asset = stack.assetWithUID("ASSET_UID")
asset.setLocale("en-us")
```

User-defined locale code for the request (e.g., en-us). Specifies the language of the content returned during the fetch operation.

## configureWithDictionary

The configureWithDictionary method configures the assets’ in-memory metadata (for example, after a fetch or for local use).

*   **Request behavior:** This method does not modify request parameters for fetch.
*   **For request parameters:** Use setLocale:, includeMetadata, or addParamKey:andValue:.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset configureWithDictionary:@{ @"key_name" : @"MyValue" }];Swift
let stack:Stack = Contentstack.stackWithAPIKey( "API_KEY" ,accessToken: "DELIVERY_TOKEN" , environmentName: "ENVIRONMENT" )
var asset:Asset = stack.assetWithUID( "ASSET_UID" )
asset.configureWithDictionary([ "key_name" : "MyValue" ])
```

**Key–value pairs** used to set the asset’s stored metadata (for example, uid, fileName, url). Replaces existing values for the provided keys.

## addParamKey:andValue

The addParamKey:andValue method adds a query parameter key–value pair to the Asset. The SDK sends the parameter with the next fetch request (for example, include\_dimension, locale, or other supported API keys).

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset addParamKey:@"include_dimension" andValue:@"true"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.addParamKey("include_dimension", andValue: "true")
```

User-defined key for the query parameter. Specifies the key sent during the fetch operation.

User-defined value for the query parameter. Specifies the value sent during the fetch operation.

## setHeader:forKey:

The setHeader:forKey sets a header for the Asset.

```
No return value. The header is applied to the next fetch requests (e.g., fetch:).
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset *asset = [stack assetWithUID:@"ASSET_UID"];
[asset setHeader:@"MyValue" forKey:@"My-Custom-Header"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.setHeader("MyValue", forKey: "My-Custom-Header")
```

The header value

The header key

## addHeadersWithDictionary:

The addHeadersWithDictionary method sets a single header on the Asset.

*   **Multiple headers:** Use addHeadersWithDictionary:.
*   **Override behavior:** Headers set on the Asset override the same header from the Stack for that request only.

```
No return value. Headers are applied to subsequent requests (e.g., fetch:).
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset addHeadersWithDictionary:@{ @"My-Custom-Header" :  @"MyValue" }];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.addHeadersWithDictionary(["My-Custom-Header": "MyValue"])
```

The headers as dictionary which needs to be added to the application.

## removeHeaderForKey:

The removeHeaderForKey removes a header from this Asset.

```
No return value. The header is no longer sent with subsequent requests.
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset:Asset = stack.assetWithUID( "ASSET_UID" )
asset.removeHeaderForKey( "key")
```

The header key that needs to be removed.

## includeMetadata

The includeMetadata method Includes metadata in the response body.

```
Obj-C
Stack *stack = [Contentstack stackWithAPIKey:@"API_KEY" accessToken:@"DELIVERY_TOKEN" environmentName:@"ENVIRONMENT"];
Asset* asset = [stack assetWithUID:@"ASSET_UID"];
[asset includeMetadata]; 
Swift
let stack:Stack = Contentstack.stackWithAPIKey("API_KEY",accessToken:"DELIVERY_TOKEN", environmentName:@"ENVIRONMENT")
var asset:Asset = stack.assetWithUID("ASSET_UID")
asset.includeMetadata()
```

## includeBranch

The includeBranch retrieves the branch for the published content.

```
No return value. Fallback behavior is applied to the next fetch.
Obj-C
Stack *stack = [Contentstack stackWithAPIKey: @"API_KEY"  accessToken: @"DELIVERY_TOKEN"  environmentName: @"ENVIRONMENT" ];
Asset* asset = [stack assetWithUID: @"ASSET_UID" ];
[asset includeBranch]; 
Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
var asset: Asset = stack.assetWithUID("ASSET_UID")
asset.includeBranch()
```

## fetch:

The fetch fetches an asset asynchronously (by UID or with a query built on the instance).

```
No return value. Completion block is called with ResponseType (CACHE or NETWORK) and NSError; on success, the Asset instance is populated with properties (fileName, url, etc.).
Obj-C
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
let asset = stack.assetWithUID("ASSET_UID")
asset.fetch { (responseType, error) -> Void in
    if let error = error {
        // Handle error
    }
}Swift
let stack = Contentstack.stackWithAPIKey("API_KEY", accessToken: "DELIVERY_TOKEN", environmentName: "ENVIRONMENT")
let asset = stack.assetWithUID("ASSET_UID")
asset.fetch { (responseType, error) -> Void in
    if let error = error {
        // Handle error
    }
}
```

Block to be called once operation is done.

Returns the filename of the asset

Returns the size of the asset file

Returns the file type of the asset

Returns the unique identifier (UID) of the asset

Returns the URL of the asset

Retrieves the list of tags associated with the asset

Returns the date and time when the asset was created

Returns the user who created the asset

Returns the date and time when the asset was last updated

Returns the user who last updated the asset

Returns the date and time when the asset was deleted

Returns the user who deleted the asset

Returns the full asset object from the API response (all keys and values). The properties above are typed accessors for the main fields in this dictionary.

## Asset | iOS Delivery SDK | Contentstack

Asset represents a single media file in the iOS Delivery SDK and fetches its metadata from the Contentstack delivery API.