--- title: Assets | Scenario Docs description: API reference for enhanced asset methods. --- The `assets` resource is enhanced so that `retrieve()` and `update()` return responses where `response.asset` has a `.download()` method. All other asset methods (`create`, `list`, `delete`) are inherited unchanged. --- ## `client.assets.retrieve(assetID)` Get an asset by ID. Returns an enhanced response where `response.asset` has `.download()`. **Signature** ``` client.assets.retrieve( assetID: string, query?: AssetRetrieveParams | null, options?: RequestOptions, ): APIPromise> ``` **Parameters** | Name | Type | Description | | --------- | ----------------------------- | -------------------------- | | `assetID` | `string` | The asset ID to retrieve. | | `query?` | `AssetRetrieveParams \| null` | Optional query parameters. | **Returns** `APIPromise>` — the standard retrieve response with `asset` enhanced: | Property | Type | Description | | -------- | -------------------------------------------- | --------------------------------------------- | | `asset` | `AssetRetrieveResponse.Asset & AssetMethods` | All original asset fields plus `.download()`. | **Example** ``` import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: '...' }); const { asset } = await client.assets.retrieve('asset_...'); console.log(asset.id); // original field console.log(asset.url); // original field ``` --- ## `client.assets.update(assetID, params)` Update an asset. Returns an enhanced response where `response.asset` has `.download()`. **Signature** ``` client.assets.update( assetID: string, params: AssetUpdateParams, options?: RequestOptions, ): APIPromise> ``` **Parameters** | Name | Type | Description | | --------- | ------------------- | ------------------------------------- | | `assetID` | `string` | The asset ID to update. | | `params` | `AssetUpdateParams` | Fields to update (see API Reference). | **Returns** `APIPromise>` — the update response with `asset` enhanced. --- ## `asset.download()` Available on `response.asset` after calling `client.assets.retrieve()` or `client.assets.update()`. Fetches the asset’s content as bytes using the signed `url` field on the asset. Works in Node ≥ 18 and in browsers with no extra setup. **Signature** ``` asset.download(): Promise ``` **Parameters** None. **Returns** `Promise` — the raw bytes of the asset. **Errors** Throws `Error` if the HTTP response is not OK (e.g. `Failed to download asset asset_...: 403 Forbidden`). **Example** ``` import Scenario from '@scenario-labs/sdk'; import fs from 'node:fs/promises'; const client = new Scenario({ apiKey: '...' }); const { asset } = await client.assets.retrieve('asset_...'); const bytes = await asset.download(); await fs.writeFile('out.png', bytes); ``` Note `asset.download()` is a thin wrapper around `fetch(asset.url)`. Use `asset.url` directly if you need streaming or a `Response` object.