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, see Theme structure.
To learn how to create your own theme, see Building themes.
What you can do with Asset
The Shopify API lets you do the following with the Asset resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-01/themes/{theme_id}/assets.json Retrieves a list of assets for a theme
- GET /admin/api/2020-01/themes/{theme_id}/assets.json?asset[key]=templates/index.liquid Retrieves a single asset for a theme
- PUT /admin/api/2020-01/themes/{theme_id}/assets.json Creates or updates an asset for a theme
- DELETE /admin/api/2020-01/themes/{theme_id}/assets.json?asset[key]=layout/theme.liquid Deletes an asset from a theme
Asset properties
attachment |
A base64-encoded image. |
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. |
key |
The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset |
public_url
read-only |
The public-facing URL of the asset. |
size
read-only |
The asset size in bytes. |
theme_id
read-only |
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. |
Endpoints
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a list of all assets for a theme
GET /admin/api/2020-01/themes/828155753/assets.json
View Response
HTTP/1.1 200 OK
{
"assets": [
{
"key": "templates/page.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 147,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_schema.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-main.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-main.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 297,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-devider.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/content_section.liquid",
"public_url": null,
"created_at": "2016-02-11T14:31:50-05:00",
"updated_at": "2016-02-11T14:31:50-05:00",
"content_type": "text/x-liquid",
"size": 997,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-footer.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-footer.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1434,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css.liquid",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css.liquid?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 14675,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-pink.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.js",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.js?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/javascript",
"size": 348,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/footer_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 999,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-green.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-green.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1542,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-content.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 134,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/product.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2796,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/cart.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2047,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1571,
"checksum": null,
"theme_id": 828155753
},
{
"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": "text/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-menu.jpg",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-menu.jpg?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/jpeg",
"size": 1609,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/article.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2486,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/header_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 998,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/collection.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 946,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-sidebar.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-sidebar.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 124,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-orange.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-orange.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1548,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/product_section.liquid",
"public_url": null,
"created_at": "2016-02-14T16:31:41-05:00",
"updated_at": "2016-02-14T16:31:41-05:00",
"content_type": "text/x-liquid",
"size": 2440,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/css",
"size": 14058,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/blog.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 786,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_data.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
}
]
}
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, see Asset properties.
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a Liquid template
GET /admin/api/2020-01/themes/828155753/assets.json?asset[key]=templates/index.liquid
View Response
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": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
}
}
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.
src
|
The source URL of an image. Include in the body of the PUT request to upload the image to Shopify. |
source_key
|
The path within the theme to an existing asset. Include in the body of the PUT request to create a duplicate asset. |
Change an existing Liquid template's value
PUT /admin/api/2020-01/themes/828155753/assets.json
{
"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>"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:41-05:00",
"content_type": "text/x-liquid",
"size": 110,
"checksum": "cd71db2e14df976c8aa44b44c8dae77b",
"theme_id": 828155753
}
}
Create an image asset by providing a base64-encoded attachment
PUT /admin/api/2020-01/themes/828155753/assets.json
{
"asset": {
"key": "assets/empty.gif",
"attachment": "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/empty.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/empty.gif?v=1609541443",
"created_at": "2021-01-01T17:50:43-05:00",
"updated_at": "2021-01-01T17:50:43-05: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
PUT /admin/api/2020-01/themes/828155753/assets.json
{
"asset": {
"key": "assets/bg-body.gif",
"src": "http://apple.com/new_bg.gif"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1609541444",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:44-05:00",
"content_type": "image/gif",
"size": 43,
"checksum": "45cf913e5d9d3c9b2058033056d3dd23",
"theme_id": 828155753
}
}
Duplicate an existing asset by providing a source key
PUT /admin/api/2020-01/themes/828155753/assets.json
{
"asset": {
"key": "layout/alternate.liquid",
"source_key": "layout/theme.liquid"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "layout/alternate.liquid",
"public_url": null,
"created_at": "2021-01-01T17:50:46-05:00",
"updated_at": "2021-01-01T17:50:46-05:00",
"content_type": "text/x-liquid",
"size": 3049,
"checksum": "1879a06996941b2ff1ff485a1fe60a97",
"theme_id": 828155753
}
}
Deleting an asset required by the theme fails with an error
DELETE /admin/api/2020-01/themes/828155753/assets.json?asset[key]=layout/theme.liquid
View Response
HTTP/1.1 403 Forbidden
{
"message": "layout/theme.liquid could not be deleted"
}
Delete an image from a theme
DELETE /admin/api/2020-01/themes/828155753/assets.json?asset[key]=assets/bg-body.gif
View Response
HTTP/1.1 200 OK
{
"message": "assets/bg-body.gif was successfully deleted"
}
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, see Theme structure.
To learn how to create your own theme, see Building themes.
What you can do with Asset
The Shopify API lets you do the following with the Asset resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-04/themes/{theme_id}/assets.json Retrieves a list of assets for a theme
- GET /admin/api/2020-04/themes/{theme_id}/assets.json?asset[key]=templates/index.liquid Retrieves a single asset for a theme
- PUT /admin/api/2020-04/themes/{theme_id}/assets.json Creates or updates an asset for a theme
- DELETE /admin/api/2020-04/themes/{theme_id}/assets.json?asset[key]=layout/theme.liquid Deletes an asset from a theme
Asset properties
attachment |
A base64-encoded image. |
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. |
key |
The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset |
public_url
read-only |
The public-facing URL of the asset. |
size
read-only |
The asset size in bytes. |
theme_id
read-only |
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. |
Endpoints
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a list of all assets for a theme
GET /admin/api/2020-04/themes/828155753/assets.json
View Response
HTTP/1.1 200 OK
{
"assets": [
{
"key": "templates/page.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 147,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_schema.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-main.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-main.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 297,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-devider.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/content_section.liquid",
"public_url": null,
"created_at": "2016-02-11T14:31:50-05:00",
"updated_at": "2016-02-11T14:31:50-05:00",
"content_type": "text/x-liquid",
"size": 997,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-footer.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-footer.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1434,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css.liquid",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css.liquid?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 14675,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-pink.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.js",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.js?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/javascript",
"size": 348,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/footer_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 999,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-green.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-green.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1542,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-content.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 134,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/product.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2796,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/cart.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2047,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1571,
"checksum": null,
"theme_id": 828155753
},
{
"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": "text/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-menu.jpg",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-menu.jpg?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/jpeg",
"size": 1609,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/article.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2486,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/header_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 998,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/collection.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 946,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-sidebar.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-sidebar.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 124,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-orange.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-orange.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1548,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/product_section.liquid",
"public_url": null,
"created_at": "2016-02-14T16:31:41-05:00",
"updated_at": "2016-02-14T16:31:41-05:00",
"content_type": "text/x-liquid",
"size": 2440,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/css",
"size": 14058,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/blog.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 786,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_data.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
}
]
}
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, see Asset properties.
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a Liquid template
GET /admin/api/2020-04/themes/828155753/assets.json?asset[key]=templates/index.liquid
View Response
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": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
}
}
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.
src
|
The source URL of an image. Include in the body of the PUT request to upload the image to Shopify. |
source_key
|
The path within the theme to an existing asset. Include in the body of the PUT request to create a duplicate asset. |
Change an existing Liquid template's value
PUT /admin/api/2020-04/themes/828155753/assets.json
{
"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>"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:41-05:00",
"content_type": "text/x-liquid",
"size": 110,
"checksum": "cd71db2e14df976c8aa44b44c8dae77b",
"theme_id": 828155753
}
}
Create an image asset by providing a base64-encoded attachment
PUT /admin/api/2020-04/themes/828155753/assets.json
{
"asset": {
"key": "assets/empty.gif",
"attachment": "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/empty.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/empty.gif?v=1609541443",
"created_at": "2021-01-01T17:50:43-05:00",
"updated_at": "2021-01-01T17:50:43-05: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
PUT /admin/api/2020-04/themes/828155753/assets.json
{
"asset": {
"key": "assets/bg-body.gif",
"src": "http://apple.com/new_bg.gif"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1609541444",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:44-05:00",
"content_type": "image/gif",
"size": 43,
"checksum": "45cf913e5d9d3c9b2058033056d3dd23",
"theme_id": 828155753
}
}
Duplicate an existing asset by providing a source key
PUT /admin/api/2020-04/themes/828155753/assets.json
{
"asset": {
"key": "layout/alternate.liquid",
"source_key": "layout/theme.liquid"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "layout/alternate.liquid",
"public_url": null,
"created_at": "2021-01-01T17:50:46-05:00",
"updated_at": "2021-01-01T17:50:46-05:00",
"content_type": "text/x-liquid",
"size": 3049,
"checksum": "1879a06996941b2ff1ff485a1fe60a97",
"theme_id": 828155753
}
}
Deleting an asset required by the theme fails with an error
DELETE /admin/api/2020-04/themes/828155753/assets.json?asset[key]=layout/theme.liquid
View Response
HTTP/1.1 403 Forbidden
{
"message": "layout/theme.liquid could not be deleted"
}
Delete an image from a theme
DELETE /admin/api/2020-04/themes/828155753/assets.json?asset[key]=assets/bg-body.gif
View Response
HTTP/1.1 200 OK
{
"message": "assets/bg-body.gif was successfully deleted"
}
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, see Theme structure.
To learn how to create your own theme, see Building themes.
What you can do with Asset
The Shopify API lets you do the following with the Asset resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-07/themes/{theme_id}/assets.json Retrieves a list of assets for a theme
- GET /admin/api/2020-07/themes/{theme_id}/assets.json?asset[key]=templates/index.liquid Retrieves a single asset for a theme
- PUT /admin/api/2020-07/themes/{theme_id}/assets.json Creates or updates an asset for a theme
- DELETE /admin/api/2020-07/themes/{theme_id}/assets.json?asset[key]=layout/theme.liquid Deletes an asset from a theme
Asset properties
attachment |
A base64-encoded image. |
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. |
key |
The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset |
public_url
read-only |
The public-facing URL of the asset. |
size
read-only |
The asset size in bytes. |
theme_id
read-only |
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. |
Endpoints
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a list of all assets for a theme
GET /admin/api/2020-07/themes/828155753/assets.json
View Response
HTTP/1.1 200 OK
{
"assets": [
{
"key": "templates/page.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 147,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_schema.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-main.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-main.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 297,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-devider.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/content_section.liquid",
"public_url": null,
"created_at": "2016-02-11T14:31:50-05:00",
"updated_at": "2016-02-11T14:31:50-05:00",
"content_type": "text/x-liquid",
"size": 997,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-footer.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-footer.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1434,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css.liquid",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css.liquid?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 14675,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-pink.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.js",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.js?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/javascript",
"size": 348,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/footer_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 999,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-green.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-green.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1542,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-content.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 134,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/product.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2796,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/cart.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2047,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1571,
"checksum": null,
"theme_id": 828155753
},
{
"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": "text/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-menu.jpg",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-menu.jpg?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/jpeg",
"size": 1609,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/article.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2486,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/header_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 998,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/collection.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 946,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-sidebar.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-sidebar.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 124,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-orange.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-orange.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1548,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/product_section.liquid",
"public_url": null,
"created_at": "2016-02-14T16:31:41-05:00",
"updated_at": "2016-02-14T16:31:41-05:00",
"content_type": "text/x-liquid",
"size": 2440,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/css",
"size": 14058,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/blog.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 786,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_data.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
}
]
}
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, see Asset properties.
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a Liquid template
GET /admin/api/2020-07/themes/828155753/assets.json?asset[key]=templates/index.liquid
View Response
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": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
}
}
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.
src
|
The source URL of an image. Include in the body of the PUT request to upload the image to Shopify. |
source_key
|
The path within the theme to an existing asset. Include in the body of the PUT request to create a duplicate asset. |
Change an existing Liquid template's value
PUT /admin/api/2020-07/themes/828155753/assets.json
{
"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>"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:41-05:00",
"content_type": "text/x-liquid",
"size": 110,
"checksum": "cd71db2e14df976c8aa44b44c8dae77b",
"theme_id": 828155753
}
}
Create an image asset by providing a base64-encoded attachment
PUT /admin/api/2020-07/themes/828155753/assets.json
{
"asset": {
"key": "assets/empty.gif",
"attachment": "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/empty.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/empty.gif?v=1609541443",
"created_at": "2021-01-01T17:50:43-05:00",
"updated_at": "2021-01-01T17:50:43-05: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
PUT /admin/api/2020-07/themes/828155753/assets.json
{
"asset": {
"key": "assets/bg-body.gif",
"src": "http://apple.com/new_bg.gif"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1609541444",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:44-05:00",
"content_type": "image/gif",
"size": 43,
"checksum": "45cf913e5d9d3c9b2058033056d3dd23",
"theme_id": 828155753
}
}
Duplicate an existing asset by providing a source key
PUT /admin/api/2020-07/themes/828155753/assets.json
{
"asset": {
"key": "layout/alternate.liquid",
"source_key": "layout/theme.liquid"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "layout/alternate.liquid",
"public_url": null,
"created_at": "2021-01-01T17:50:46-05:00",
"updated_at": "2021-01-01T17:50:46-05:00",
"content_type": "text/x-liquid",
"size": 3049,
"checksum": "1879a06996941b2ff1ff485a1fe60a97",
"theme_id": 828155753
}
}
Deleting an asset required by the theme fails with an error
DELETE /admin/api/2020-07/themes/828155753/assets.json?asset[key]=layout/theme.liquid
View Response
HTTP/1.1 403 Forbidden
{
"message": "layout/theme.liquid could not be deleted"
}
Delete an image from a theme
DELETE /admin/api/2020-07/themes/828155753/assets.json?asset[key]=assets/bg-body.gif
View Response
HTTP/1.1 200 OK
{
"message": "assets/bg-body.gif was successfully deleted"
}
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, see Theme structure.
To learn how to create your own theme, see Building themes.
What you can do with Asset
The Shopify API lets you do the following with the Asset resource. More detailed versions of these general actions may be available:
- GET /admin/api/2020-10/themes/{theme_id}/assets.json Retrieves a list of assets for a theme
- GET /admin/api/2020-10/themes/{theme_id}/assets.json?asset[key]=templates/index.liquid Retrieves a single asset for a theme
- PUT /admin/api/2020-10/themes/{theme_id}/assets.json Creates or updates an asset for a theme
- DELETE /admin/api/2020-10/themes/{theme_id}/assets.json?asset[key]=layout/theme.liquid Deletes an asset from a theme
Asset 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. |
key |
The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset |
public_url
read-only |
The public-facing URL of the asset. |
size
read-only |
The asset size in bytes. |
theme_id
read-only |
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. |
Endpoints
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a list of all assets for a theme
GET /admin/api/2020-10/themes/828155753/assets.json
View Response
HTTP/1.1 200 OK
{
"assets": [
{
"key": "templates/page.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 147,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_schema.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-main.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-main.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 297,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-devider.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/content_section.liquid",
"public_url": null,
"created_at": "2016-02-11T14:31:50-05:00",
"updated_at": "2016-02-11T14:31:50-05:00",
"content_type": "text/x-liquid",
"size": 997,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-footer.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-footer.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1434,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css.liquid",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css.liquid?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 14675,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-pink.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.js",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.js?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/javascript",
"size": 348,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/footer_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 999,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-green.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-green.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1542,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-content.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 134,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/product.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2796,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/cart.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2047,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1571,
"checksum": null,
"theme_id": 828155753
},
{
"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": "text/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-menu.jpg",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-menu.jpg?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/jpeg",
"size": 1609,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/article.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2486,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/header_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 998,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/collection.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 946,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-sidebar.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-sidebar.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 124,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-orange.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-orange.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1548,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/product_section.liquid",
"public_url": null,
"created_at": "2016-02-14T16:31:41-05:00",
"updated_at": "2016-02-14T16:31:41-05:00",
"content_type": "text/x-liquid",
"size": 2440,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/css",
"size": 14058,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/blog.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 786,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_data.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
}
]
}
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, see Asset properties.
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a Liquid template
GET /admin/api/2020-10/themes/828155753/assets.json?asset[key]=templates/index.liquid
View Response
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": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
}
}
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.
src
|
The source URL of an image. Include in the body of the PUT request to upload the image to Shopify. |
source_key
|
The path within the theme to an existing asset. Include in the body of the PUT request to create a duplicate asset. |
Change an existing Liquid template's value
PUT /admin/api/2020-10/themes/828155753/assets.json
{
"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>"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:41-05:00",
"content_type": "text/x-liquid",
"size": 110,
"checksum": "cd71db2e14df976c8aa44b44c8dae77b",
"theme_id": 828155753
}
}
Create an image asset by providing a base64-encoded attachment
PUT /admin/api/2020-10/themes/828155753/assets.json
{
"asset": {
"key": "assets/empty.gif",
"attachment": "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/empty.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/empty.gif?v=1609541443",
"created_at": "2021-01-01T17:50:43-05:00",
"updated_at": "2021-01-01T17:50:43-05: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
PUT /admin/api/2020-10/themes/828155753/assets.json
{
"asset": {
"key": "assets/bg-body.gif",
"src": "http://apple.com/new_bg.gif"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1609541444",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:44-05:00",
"content_type": "image/gif",
"size": 43,
"checksum": "45cf913e5d9d3c9b2058033056d3dd23",
"theme_id": 828155753
}
}
Duplicate an existing asset by providing a source key
PUT /admin/api/2020-10/themes/828155753/assets.json
{
"asset": {
"key": "layout/alternate.liquid",
"source_key": "layout/theme.liquid"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "layout/alternate.liquid",
"public_url": null,
"created_at": "2021-01-01T17:50:46-05:00",
"updated_at": "2021-01-01T17:50:46-05:00",
"content_type": "text/x-liquid",
"size": 3049,
"checksum": "1879a06996941b2ff1ff485a1fe60a97",
"theme_id": 828155753
}
}
Deleting an asset required by the theme fails with an error
DELETE /admin/api/2020-10/themes/828155753/assets.json?asset[key]=layout/theme.liquid
View Response
HTTP/1.1 403 Forbidden
{
"message": "layout/theme.liquid could not be deleted"
}
Delete an image from a theme
DELETE /admin/api/2020-10/themes/828155753/assets.json?asset[key]=assets/bg-body.gif
View Response
HTTP/1.1 200 OK
{
"message": "assets/bg-body.gif was successfully deleted"
}
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, see Theme structure.
To learn how to create your own theme, see Building themes.
What you can do with Asset
The Shopify API lets you do the following with the Asset resource. More detailed versions of these general actions may be available:
- GET /admin/api/2021-01/themes/{theme_id}/assets.json Retrieves a list of assets for a theme
- GET /admin/api/2021-01/themes/{theme_id}/assets.json?asset[key]=templates/index.liquid Retrieves a single asset for a theme
- PUT /admin/api/2021-01/themes/{theme_id}/assets.json Creates or updates an asset for a theme
- DELETE /admin/api/2021-01/themes/{theme_id}/assets.json?asset[key]=layout/theme.liquid Deletes an asset from a theme
Asset 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. |
key |
The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset |
public_url
read-only |
The public-facing URL of the asset. |
size
read-only |
The asset size in bytes. |
theme_id
read-only |
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. |
Endpoints
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a list of all assets for a theme
GET /admin/api/2021-01/themes/828155753/assets.json
View Response
HTTP/1.1 200 OK
{
"assets": [
{
"key": "templates/page.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 147,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_schema.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-main.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-main.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 297,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-devider.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/content_section.liquid",
"public_url": null,
"created_at": "2016-02-11T14:31:50-05:00",
"updated_at": "2016-02-11T14:31:50-05:00",
"content_type": "text/x-liquid",
"size": 997,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-footer.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-footer.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1434,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css.liquid",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css.liquid?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 14675,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-pink.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.js",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.js?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/javascript",
"size": 348,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/footer_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 999,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-green.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-green.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1542,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-content.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 134,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/product.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2796,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/cart.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2047,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1571,
"checksum": null,
"theme_id": 828155753
},
{
"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": "text/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-menu.jpg",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-menu.jpg?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/jpeg",
"size": 1609,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/article.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2486,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/header_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 998,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/collection.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 946,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-sidebar.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-sidebar.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 124,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-orange.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-orange.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1548,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/product_section.liquid",
"public_url": null,
"created_at": "2016-02-14T16:31:41-05:00",
"updated_at": "2016-02-14T16:31:41-05:00",
"content_type": "text/x-liquid",
"size": 2440,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/css",
"size": 14058,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/blog.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 786,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_data.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
}
]
}
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, see Asset properties.
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a Liquid template
GET /admin/api/2021-01/themes/828155753/assets.json?asset[key]=templates/index.liquid
View Response
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": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
}
}
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.
src
|
The source URL of an image. Include in the body of the PUT request to upload the image to Shopify. |
source_key
|
The path within the theme to an existing asset. Include in the body of the PUT request to create a duplicate asset. |
Change an existing Liquid template's value
PUT /admin/api/2021-01/themes/828155753/assets.json
{
"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>"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:41-05:00",
"content_type": "text/x-liquid",
"size": 110,
"checksum": "cd71db2e14df976c8aa44b44c8dae77b",
"theme_id": 828155753
}
}
Create an image asset by providing a base64-encoded attachment
PUT /admin/api/2021-01/themes/828155753/assets.json
{
"asset": {
"key": "assets/empty.gif",
"attachment": "R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/empty.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/empty.gif?v=1609541443",
"created_at": "2021-01-01T17:50:43-05:00",
"updated_at": "2021-01-01T17:50:43-05: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
PUT /admin/api/2021-01/themes/828155753/assets.json
{
"asset": {
"key": "assets/bg-body.gif",
"src": "http://apple.com/new_bg.gif"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1609541444",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2021-01-01T17:50:44-05:00",
"content_type": "image/gif",
"size": 43,
"checksum": "45cf913e5d9d3c9b2058033056d3dd23",
"theme_id": 828155753
}
}
Duplicate an existing asset by providing a source key
PUT /admin/api/2021-01/themes/828155753/assets.json
{
"asset": {
"key": "layout/alternate.liquid",
"source_key": "layout/theme.liquid"
}
}
View Response
HTTP/1.1 200 OK
{
"asset": {
"key": "layout/alternate.liquid",
"public_url": null,
"created_at": "2021-01-01T17:50:46-05:00",
"updated_at": "2021-01-01T17:50:46-05:00",
"content_type": "text/x-liquid",
"size": 3049,
"checksum": "1879a06996941b2ff1ff485a1fe60a97",
"theme_id": 828155753
}
}
Deleting an asset required by the theme fails with an error
DELETE /admin/api/2021-01/themes/828155753/assets.json?asset[key]=layout/theme.liquid
View Response
HTTP/1.1 403 Forbidden
{
"message": "layout/theme.liquid could not be deleted"
}
Delete an image from a theme
DELETE /admin/api/2021-01/themes/828155753/assets.json?asset[key]=assets/bg-body.gif
View Response
HTTP/1.1 200 OK
{
"message": "assets/bg-body.gif was successfully deleted"
}
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, see Theme structure.
To learn how to create your own theme, see Building themes.
What you can do with Asset
The Shopify API lets you do the following with the Asset resource. More detailed versions of these general actions may be available:
- GET /admin/api/2021-04/themes/{theme_id}/assets.json Retrieves a list of assets for a theme
- GET /admin/api/2021-04/themes/{theme_id}/assets.json?asset[key]=templates/index.liquid Retrieves a single asset for a theme
- PUT /admin/api/2021-04/themes/{theme_id}/assets.json Creates or updates an asset for a theme
- DELETE /admin/api/2021-04/themes/{theme_id}/assets.json?asset[key]=layout/theme.liquid Deletes an asset from a theme
Asset 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. |
key |
The path to the asset within a theme. It consists of the file's directory and filename. For example, the asset |
public_url
read-only |
The public-facing URL of the asset. |
size
read-only |
The asset size in bytes. |
theme_id
read-only |
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. |
Endpoints
fields
|
Show only certain fields, specified by a comma-separated list of field names |
Retrieve a list of all assets for a theme
GET /admin/api/2021-04/themes/828155753/assets.json
View Response
HTTP/1.1 200 OK
{
"assets": [
{
"key": "templates/page.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 147,
"checksum": null,
"theme_id": 828155753
},
{
"key": "config/settings_schema.json",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/json",
"size": 4570,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-main.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-main.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 297,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-devider.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-devider.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1016,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/content_section.liquid",
"public_url": null,
"created_at": "2016-02-11T14:31:50-05:00",
"updated_at": "2016-02-11T14:31:50-05:00",
"content_type": "text/x-liquid",
"size": 997,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-footer.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-footer.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1434,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css.liquid",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css.liquid?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 14675,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-pink.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-pink.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1562,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.js",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.js?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "application/javascript",
"size": 348,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/footer_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 999,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-green.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-green.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1542,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-content.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-content.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 134,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/product.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2796,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/cart.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2047,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1571,
"checksum": null,
"theme_id": 828155753
},
{
"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": "text/x-liquid",
"size": 3252,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/index.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 1068,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/sidebar-menu.jpg",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/sidebar-menu.jpg?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/jpeg",
"size": 1609,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/article.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 2486,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/header_section.liquid",
"public_url": null,
"created_at": "2017-04-28T10:30:00-04:00",
"updated_at": "2017-04-28T10:30:00-04:00",
"content_type": "text/x-liquid",
"size": 998,
"checksum": null,
"theme_id": 828155753
},
{
"key": "templates/collection.liquid",
"public_url": null,
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "text/x-liquid",
"size": 946,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-sidebar.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-sidebar.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 124,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/bg-body-orange.gif",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/bg-body-orange.gif?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00",
"content_type": "image/gif",
"size": 1548,
"checksum": null,
"theme_id": 828155753
},
{
"key": "sections/product_section.liquid",
"public_url": null,
"created_at": "2016-02-14T16:31:41-05:00",
"updated_at": "2016-02-14T16:31:41-05:00",
"content_type": "text/x-liquid",
"size": 2440,
"checksum": null,
"theme_id": 828155753
},
{
"key": "assets/shop.css",
"public_url": "https://cdn.shopify.com/s/files/1/0006/9093/3842/t/1/assets/shop.css?v=1278963110",
"created_at": "2010-07-12T15:31:50-04:00",
"updated_at": "2010-07-12T15:31:50-04:00"