Skip to main content

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. For details and migration steps, visit our migration guide.

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.

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.

To learn how to create your own theme, see Building themes.

Was this section helpful?

Anchor to

The Asset resource

Anchor to

Properties


attachment

A base64-encoded image.


checksum
read-only

The 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

The MIME representation of the content, consisting of the type and subtype of the asset.


created_at
read-only

The date and time (ISO 8601 format) when the asset was created.


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
->
url

The public-facing URL of the asset.


size
read-only

The asset size in bytes.


theme_id
read-only
deprecated

The ID for the theme that an asset belongs to.


updated_at
read-only

The date and time (ISO 8601 format) when an asset was last updated.


value

The text content of the asset, such as the HTML and Liquid markup of a template file.


Was this section helpful?
{}

The Asset resource

{
"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": "<div id=\"page\">\n<h1>404 Page not found</h1>\n<p>We couldn't find the page you were looking for.</p>\n</div>"
}

Anchor to GET request, Retrieves a list of assets for a theme
get
Retrieves a list of assets for a theme

Retrieves a list of assets for a theme.

Note: Retrieving a list of assets returns only metadata about each asset. To retrieve an asset's content, you need to retrieve the asset individually.


api_version
string
required

theme_id
string
required

fields

Specify which fields to show using a comma-separated list of field names.


Was this section helpful?

Retrieve a list of all assets for a theme

Path parameters
theme_id=828155753
string
required
Was this section helpful?
get

/admin/api/2025-07/themes/828155753/assets.json

curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/themes/828155753/assets.json" \
-H "X-Shopify-Access-Token: {access_token}"

{}

Response

JSON
HTTP/1.1 200 OK
{
"assets": [
{
"key": "layout/theme.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/t/1/assets/sidebar-devider.gif?v=1751395343",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2025-07-01T14:42:23-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": "ed8d4b8c040fcac8b7e3ed0509bb297a",
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/t/1/assets/bg-body-pink.gif?v=1751395343",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2025-07-01T14:42:23-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": "d18b3a9b940cb1a20cf783923b9cacf8",
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0005/4838/0009/t/1/assets/bg-content.gif?v=1751395343",

Retrieves a single asset for a theme by its key.

To retrieve a single asset, include asset[key]=#{asset_key} as a request parameter. For example, to retrieve the asset with a key of templates/index.liquid, the request might be /admin/themes/828155753/assets.json?asset[key]=templates/index.liquid.

For more information on the key property, refer to Asset properties.


api_version
string
required

asset[key]
required
≤ 100

Retrieves a single asset for a theme by specifying the asset's key.


theme_id
string
required

fields

Specify which fields to show using a comma-separated list of field names.


Was this section helpful?

Retrieve a Liquid template

Query parameters
asset[key]=templates/index.liquid
required
≤ 100

Retrieves a single asset for a theme by specifying the asset's key.

Was this section helpful?
get

/admin/api/2025-07/themes/828155753/assets.json?asset[key]=templates/index.liquid

curl -X GET "https://your-development-store.myshopify.com/admin/api/2025-07/themes/828155753/assets.json?asset%5Bkey%5D=templates%2Findex.liquid" \
-H "X-Shopify-Access-Token: {access_token}"

{}

Response

JSON
HTTP/1.1 200 OK
{
"asset": {
"key": "templates/index.liquid",
"public_url": null,
"value": "<!-- LIST 3 PER ROW -->\n<h2>Featured Products</h2>\n<table id=\"products\" cellspacing=\"0\" cellpadding=\"0\">\n {% tablerow product in collections.frontpage.products cols:3 %}\n <a href=\"{{product.url}}\">{{ product.featured_image | product_img_url: 'small' | img_tag }}</a>\n <h3><a href=\"{{product.url}}\">{{product.title}}</a></h3>\n <ul class=\"attributes\">\n <li><span class=\"money\">{{product.price_min | money}}</span></li>\n </ul>\n {% endtablerow %}\n</table>\n<!-- /LIST 3 PER ROW -->\n\n{{ content_for_index }}\n\n<div id=\"articles\">\n {% assign article = pages.frontpage %}\n <div class=\"article\">\n {% if article.content != \"\" %}\n <h3>{{ article.title }}</h3>\n <div class=\"article-body textile\">\n {{ article.content }}\n </div>\n {% else %}\n <div class=\"article-body textile\">\n In <em>Admin > Blogs & Pages</em>, create a page with the handle <strong><code>frontpage</code></strong> and it will show up here.\n <br />\n {{ \"Learn more about handles\" | link_to \"http://wiki.shopify.com/Handle\" }}\n </div>\n {% endif %}\n </div>\n</div>\n",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
}
}

Anchor to PUT request, Creates or updates an asset for a theme
put
Creates or updates an asset for a theme

Creates or updates an asset for a theme.

In the PUT request, you can include the src or source_key property to create the asset from an existing file.


api_version
string
required

theme_id
string
required

source_key

The path within the theme to an existing asset. Include in the body of the PUT request to create a duplicate asset.


src

The source URL of an image. Include in the body of the PUT request to upload the image to Shopify.


Was this section helpful?

Change an existing Liquid template's value

Path parameters
theme_id=828155753
string
required
Request body
asset
Asset resource
Show asset properties
asset.key:"templates/index.liquid"

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.value:"<img src='backsoon-postit.png'><p>We are busy updating the store for you and will be back within the hour.</p>"

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"

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"

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"

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"

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.

Was this section helpful?
put

/admin/api/2025-07/themes/828155753/assets.json

curl -d '{"asset":{"key":"templates/index.liquid","value":"<img src='backsoon-postit.png'><p>We are busy updating the store for you and will be back within the hour.</p>"}}' \
-X PUT "https://your-development-store.myshopify.com/admin/api/2025-07/themes/828155753/assets.json" \
-H "X-Shopify-Access-Token: {access_token}" \
-H "Content-Type: application/json"

{}

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-07-01T14:42:25-04:00",
"content_type": "application/x-liquid",
"size": 110,
"checksum": "cd71db2e14df976c8aa44b44c8dae77b",
"theme_id": 828155753
}
}

Deletes an asset from a theme.


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

Was this section helpful?

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.

Was this section helpful?
del

/admin/api/2025-07/themes/828155753/assets.json?asset[key]=assets/bg-body.gif

curl -X DELETE "https://your-development-store.myshopify.com/admin/api/2025-07/themes/828155753/assets.json?asset%5Bkey%5D=assets%2Fbg-body.gif" \
-H "X-Shopify-Access-Token: {access_token}"

{}

Response

JSON
HTTP/1.1 200 OK
{
"message": "assets/bg-body.gif was successfully deleted"
}