--- title: Asset description: Manage the files that make up a store's theme to change the look of the online store. api_version: 2025-10 api_name: admin-rest api_type: rest source_url: html: https://shopify.dev/docs/api/admin-rest/latest/resources/asset md: https://shopify.dev/docs/api/admin-rest/latest/resources/asset.md ---  The REST Admin API is a legacy API as of October 1, 2024. Starting April 1, 2025, all new public apps must be built exclusively with the [GraphQL Admin API](https://shopify.dev/docs/api/admin-graphql). For details and migration steps, visit our [migration guide](https://shopify.dev/docs/apps/build/graphql/migrate). # Asset Requires `themes` access scope. Note Starting with Admin API 2023-04, if an app distributed through the Shopify App Store uses the Asset resource to create, edit or delete a theme's asset, you need to request the required protected access scope. In most cases, you shouldn't use the Asset resource. To learn more about when you can use the Asset resource, and how to migrate, refer to the [Asset resource](https://shopify.dev/docs/apps/online-store/other-integration-methods/asset). Theme assets are the individual files that make up a shop's theme.  A theme's assets include its templates, images, stylesheets, and extra snippets of code. They are arranged among the theme's directories, such as **layout**, **templates**, and **assets**. You can use the Asset resource to add, change, or remove asset files from a shop's theme. For a complete list of theme directories, refer to [*Theme architecture*](https://shopify.dev/themes/architecture). To learn how to create your own theme, see [*Building themes*](https://shopify.dev/concepts/themes). \# ## Endpoints * [get](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#get-themes-theme-id-assets) [/admin/api/latest/themes/{theme\_id}/assets.json](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#get-themes-theme-id-assets) Retrieves a list of assets for a theme [](https://shopify.dev/docs/api/admin-graphql/latest/queries/theme?example=retrieves-a-list-of-assets-for-a-theme) [theme](https://shopify.dev/docs/api/admin-graphql/latest/queries/theme?example=retrieves-a-list-of-assets-for-a-theme) * [get](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#get-themes-theme-id-assets?asset\[key]=templates-index.liquid) [/admin/api/latest/themes/{theme\_id}/assets.json?asset\[key\]=templates/index.liquid](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#get-themes-theme-id-assets?asset\[key]=templates-index.liquid) Retrieves a single asset for a theme [](https://shopify.dev/docs/api/admin-graphql/latest/queries/theme?example=retrieves-a-single-asset-for-a-theme) [theme](https://shopify.dev/docs/api/admin-graphql/latest/queries/theme?example=retrieves-a-single-asset-for-a-theme) * [put](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#put-themes-theme-id-assets) [/admin/api/latest/themes/{theme\_id}/assets.json](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#put-themes-theme-id-assets) Creates or updates an asset for a theme [](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesUpsert) [themeFilesUpsert](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesUpsert) [](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesCopy?example=creates-or-updates-an-asset-for-a-theme) [themeFilesCopy](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesCopy?example=creates-or-updates-an-asset-for-a-theme) * [del](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#delete-themes-theme-id-assets?asset\[key]=assets-bg-body.gif) [/admin/api/latest/themes/{theme\_id}/assets.json?asset\[key\]=assets/bg-body.gif](https://shopify.dev/docs/api/admin-rest/latest/resources/asset#delete-themes-theme-id-assets?asset\[key]=assets-bg-body.gif) Deletes an asset from a theme [](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesDelete?example=deletes-an-asset-from-a-theme) [themeFilesDelete](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesDelete?example=deletes-an-asset-from-a-theme) *** ## The Asset resource ### Properties *** attachment -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFileBodyBase64#field-OnlineStoreThemeFileBodyBase64.fields.contentBase64) [contentBase64](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFileBodyBase64#field-OnlineStoreThemeFileBodyBase64.fields.contentBase64) A base64-encoded image. *** checksum read-only -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.checksumMd5) [checksumMd5](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.checksumMd5) The [MD5](https://en.wikipedia.org/wiki/MD5) representation of the content, consisting of a string of 32 hexadecimal digits. May be null if an asset has not been updated recently. *** content\_type read-only -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.contentType) [contentType](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.contentType) The [MIME](https://en.wikipedia.org/wiki/Media_type) representation of the content, consisting of the type and subtype of the asset. *** created\_at read-only -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.createdAt) [createdAt](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.createdAt) The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when the asset was created. *** key -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.filename) [filename](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.filename) The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset `assets/bg-body-green.gif` is in the **assets** directory, so its key is `assets/bg-body-green.gif`. *** public\_url read-only -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFileBodyUrl#field-OnlineStoreThemeFileBodyUrl.fields.url) [url](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFileBodyUrl#field-OnlineStoreThemeFileBodyUrl.fields.url) The public-facing URL of the asset. *** size read-only -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.size) [size](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.size) The asset size in bytes. *** theme\_id read-only deprecated The ID for the theme that an asset belongs to. *** updated\_at read-only -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.updatedAt) [updatedAt](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFile#field-OnlineStoreThemeFile.fields.updatedAt) The date and time ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format) when an asset was last updated. *** value -> [](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFileBodyText#field-OnlineStoreThemeFileBodyText.fields.content) [content](https://shopify.dev/docs/api/admin-graphql/latest/objects/OnlineStoreThemeFileBodyText#field-OnlineStoreThemeFileBodyText.fields.content) The text content of the asset, such as the HTML and Liquid markup of a template file. *** {} ## The Asset resource ```json { "attachment": "R0lGODlhAQABAPABAP///wAAACH5Ow==\n", "checksum": "f69db2c563b5be32648ac7367557c09c", "content_type": "image/gif", "created_at": "2010-07-12T15:31:50-04:00", "key": "assets/bg-body-green.gif", "public_url": "http://static.shopify.com/assets/bg.gif?1", "size": 1542, "theme_id": 828155753, "updated_at": "2010-07-12T15:31:50-04:00", "value": "
We couldn't find the page you were looking for.
\nfrontpage
and it will show up here.\n frontpage
and it will show up here.\n We are busy updating the store for you and will be back within the hour.\
" -> [](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFileBodyInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFileBodyInput#fields-value) The text content of the asset, such as the HTML and Liquid markup of a template file. Create an image asset by providing a base64-encoded attachment Path parameters theme\_id=828155753 string required Request body asset Asset resource Show asset properties asset.key:"assets/empty.gif" -> [](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFilesUpsertFileInput#fields-filename) [filename](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFilesUpsertFileInput#fields-filename) The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset `assets/bg-body-green.gif` is in the **assets** directory, so its key is `assets/bg-body-green.gif`. asset.attachment:"R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n" -> [](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFileBodyInput#fields-value) [value](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFileBodyInput#fields-value) A base64-encoded image. Create an image asset by providing a source URL from which to upload the image Path parameters theme\_id=828155753 string required Request body asset Asset resource Show asset properties asset.key:"assets/bg-body.gif" -> [](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFilesUpsertFileInput#fields-filename) [filename](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFilesUpsertFileInput#fields-filename) The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset `assets/bg-body-green.gif` is in the **assets** directory, so its key is `assets/bg-body-green.gif`. Duplicate an existing asset by providing a source key Path parameters theme\_id=828155753 string required Request body asset Asset resource Show asset properties asset.key:"layout/alternate.liquid" -> [](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFilesUpsertFileInput#fields-filename) [filename](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/OnlineStoreThemeFilesUpsertFileInput#fields-filename) The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset `assets/bg-body-green.gif` is in the **assets** directory, so its key is `assets/bg-body-green.gif`. put ## /admin/api/2025-10/themes/828155753/assets.json ```bash curl -d '{"asset":{"key":"templates/index.liquid","value":"We are busy updating the store for you and will be back within the hour.
"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "asset": { "key": "templates/index.liquid", "public_url": null, "created_at": "2010-07-12T15:31:50-04:00", "updated_at": "2025-10-01T15:06:14-04:00", "content_type": "application/x-liquid", "size": 110, "checksum": "cd71db2e14df976c8aa44b44c8dae77b", "theme_id": 828155753 } } ``` ### examples * #### Change an existing Liquid template's value ##### ```curl curl -d '{"asset":{"key":"templates/index.liquid","value":"We are busy updating the store for you and will be back within the hour.
"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const asset = new admin.rest.resources.Asset({session: session}); asset.theme_id = 828155753; asset.key = "templates/index.liquid"; asset.value = "We are busy updating the store for you and will be back within the hour.
"; await asset.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session asset = ShopifyAPI::Asset.new(session: test_session) asset.theme_id = 828155753 asset.key = "templates/index.liquid" asset.value = "We are busy updating the store for you and will be back within the hour.
" asset.save! ``` ##### ```node // Session is built by the OAuth process const asset = new shopify.rest.Asset({session: session}); asset.theme_id = 828155753; asset.key = "templates/index.liquid"; asset.value = "We are busy updating the store for you and will be back within the hour.
"; await asset.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"asset":{"key":"templates/index.liquid","public_url":null,"created_at":"2010-07-12T15:31:50-04:00","updated_at":"2025-10-01T15:06:14-04:00","content_type":"application/x-liquid","size":110,"checksum":"cd71db2e14df976c8aa44b44c8dae77b","theme_id":828155753}} ``` * #### Create an image asset by providing a base64-encoded attachment ##### ```curl curl -d '{"asset":{"key":"assets/empty.gif","attachment":"R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const asset = new admin.rest.resources.Asset({session: session}); asset.theme_id = 828155753; asset.key = "assets/empty.gif"; asset.attachment = "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"; await asset.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session asset = ShopifyAPI::Asset.new(session: test_session) asset.theme_id = 828155753 asset.key = "assets/empty.gif" asset.attachment = "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n" asset.save! ``` ##### ```node // Session is built by the OAuth process const asset = new shopify.rest.Asset({session: session}); asset.theme_id = 828155753; asset.key = "assets/empty.gif"; asset.attachment = "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"; await asset.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"asset":{"key":"assets/empty.gif","public_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/t/1/assets/empty.gif?v=1759345575","created_at":"2025-10-01T15:06:15-04:00","updated_at":"2025-10-01T15:06:15-04:00","content_type":"image/gif","size":43,"checksum":"45cf913e5d9d3c9b2058033056d3dd23","theme_id":828155753}} ``` * #### Create an image asset by providing a source URL from which to upload the image ##### ```curl curl -d '{"asset":{"key":"assets/bg-body.gif","src":"http://example.com/new_bg.gif"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const asset = new admin.rest.resources.Asset({session: session}); asset.theme_id = 828155753; asset.key = "assets/bg-body.gif"; asset.src = "http://example.com/new_bg.gif"; await asset.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session asset = ShopifyAPI::Asset.new(session: test_session) asset.theme_id = 828155753 asset.key = "assets/bg-body.gif" asset.src = "http://example.com/new_bg.gif" asset.save! ``` ##### ```node // Session is built by the OAuth process const asset = new shopify.rest.Asset({session: session}); asset.theme_id = 828155753; asset.key = "assets/bg-body.gif"; asset.src = "http://example.com/new_bg.gif"; await asset.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"asset":{"key":"assets/bg-body.gif","public_url":"https://cdn.shopify.com/s/files/1/0005/4838/0009/t/1/assets/bg-body.gif?v=1759345579","created_at":"2010-07-12T15:31:50-04:00","updated_at":"2025-10-01T15:06:19-04:00","content_type":"image/gif","size":43,"checksum":"45cf913e5d9d3c9b2058033056d3dd23","theme_id":828155753}} ``` * #### Duplicate an existing asset by providing a source key ##### ```curl curl -d '{"asset":{"key":"layout/alternate.liquid","source_key":"layout/theme.liquid"}}' \ -X PUT "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json" \ -H "X-Shopify-Access-Token: {access_token}" \ -H "Content-Type: application/json" ``` ##### ```remix const { admin, session } = await authenticate.admin(request); const asset = new admin.rest.resources.Asset({session: session}); asset.theme_id = 828155753; asset.key = "layout/alternate.liquid"; asset.source_key = "layout/theme.liquid"; await asset.save({ update: true, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session asset = ShopifyAPI::Asset.new(session: test_session) asset.theme_id = 828155753 asset.key = "layout/alternate.liquid" asset.source_key = "layout/theme.liquid" asset.save! ``` ##### ```node // Session is built by the OAuth process const asset = new shopify.rest.Asset({session: session}); asset.theme_id = 828155753; asset.key = "layout/alternate.liquid"; asset.source_key = "layout/theme.liquid"; await asset.save({ update: true, }); ``` #### response ```json HTTP/1.1 200 OK{"asset":{"key":"layout/alternate.liquid","public_url":null,"created_at":"2025-10-01T15:06:18-04:00","updated_at":"2025-10-01T15:06:18-04:00","content_type":"application/x-liquid","size":3049,"checksum":"1879a06996941b2ff1ff485a1fe60a97","theme_id":828155753}} ``` *** ## delDeletes an asset from a theme [](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesDelete?example=deletes-an-asset-from-a-theme) [themeFilesDelete](https://shopify.dev/docs/api/admin-graphql/latest/mutations/themeFilesDelete?example=deletes-an-asset-from-a-theme) Deletes an asset from a theme. ### Parameters *** api\_version string required *** asset\[key] required ≤ 100 Deletes a single asset from a theme by specifying the asset's key. *** theme\_id string required *** ### Examples Delete an image from a theme Query parameters asset\[key]=assets/bg-body.gif required ≤ 100 Deletes a single asset from a theme by specifying the asset's key. Deleting an asset required by the theme fails with an error Query parameters asset\[key]=layout/theme.liquid required ≤ 100 Deletes a single asset from a theme by specifying the asset's key. del ## /admin/api/2025-10/themes/828155753/assets.json?asset\[key]=assets/bg-body.gif ```bash curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json?asset%5Bkey%5D=assets%2Fbg-body.gif" \ -H "X-Shopify-Access-Token: {access_token}" ``` {} ## Response JSON ```json HTTP/1.1 200 OK { "message": "assets/bg-body.gif was successfully deleted" } ``` ### examples * #### Delete an image from a theme ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json?asset%5Bkey%5D=assets%2Fbg-body.gif" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Asset.delete({ session: session, theme_id: 828155753, asset: {"key": "assets/bg-body.gif"}, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Asset.delete( session: test_session, theme_id: 828155753, asset: {"key" => "assets/bg-body.gif"}, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Asset.delete({ session: session, theme_id: 828155753, asset: {"key": "assets/bg-body.gif"}, }); ``` #### response ```json HTTP/1.1 200 OK{"message":"assets/bg-body.gif was successfully deleted"} ``` * #### Deleting an asset required by the theme fails with an error ##### ```curl curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-10/themes/828155753/assets.json?asset%5Bkey%5D=layout%2Ftheme.liquid" \ -H "X-Shopify-Access-Token: {access_token}" ``` ##### ```remix await admin.rest.resources.Asset.delete({ session: session, theme_id: 828155753, asset: {"key": "layout/theme.liquid"}, }); ``` ##### ```ruby # Session is activated via Authentication test_session = ShopifyAPI::Context.active_session ShopifyAPI::Asset.delete( session: test_session, theme_id: 828155753, asset: {"key" => "layout/theme.liquid"}, ) ``` ##### ```node // Session is built by the OAuth process await shopify.rest.Asset.delete({ session: session, theme_id: 828155753, asset: {"key": "layout/theme.liquid"}, }); ``` #### response ```json HTTP/1.1 403 Forbidden{"message":"layout/theme.liquid could not be deleted"} ```