Your safety is important to us. If you notice any suspicious emails that appear to come from Shopify, please forward them to safety@shopify.com. Visit the Help Center page on phishing for more information.

Theme

A theme is the look and feel template for your Shopify shop.

Theme

A shop can have multiple themes which take the role of either "published" or "unpublished". Each shop can have 20 themes total, including one main theme, and a max of 19 unpublished themes. The published theme is the one customers see when visiting the shop in a desktop browser. Unpublished themes are themes that customers cannot currently see. When you publish a theme, the previously published theme will become unpublished.

What you can do with Theme

The Shopify API lets you do the following with the Theme resource. More detailed versions of these general actions may be available:

Theme properties

created_at
"created_at": "2012-08-24T14:01:47-04:00"

The date and time when the theme was created. The API returns this value in ISO 8601 format.

id
"id": 828155753

A unique numeric identifier for the theme.

name
"name": "Comfort"

The name of the theme.

role
"role": "main"

Specifies how the theme is being used within the shop. Valid values are:

  • main: the theme customers see when visiting the shop in a desktop browser.
  • unpublished: the theme that customers cannot currently see.

updated_at
"updated_at": "2012-08-24T14:01:47-04:00"

The date and time when the theme was last updated. The API returns this value in ISO 8601 format.

previewable
"previewable": true

Indicates if the theme can currently be previewed.

processing
"processing": true

Indicates if files are still being copied into place for this theme.

Endpoints

GET /admin/themes.json
get a list of a shop's themes
fields

comma-separated list of fields to include in the response

GET /admin/themes.json
View Response
HTTP/1.1 200 OK
{
  "themes": [
    {
      "id": 828155753,
      "name": "Comfort",
      "created_at": "2017-01-05T15:36:16-05:00",
      "updated_at": "2017-01-05T15:36:16-05:00",
      "role": "main",
      "theme_store_id": null,
      "previewable": true,
      "processing": false
    },
    {
      "id": 976877075,
      "name": "Speed",
      "created_at": "2017-01-05T15:36:16-05:00",
      "updated_at": "2017-01-05T15:36:16-05:00",
      "role": "mobile",
      "theme_store_id": null,
      "previewable": true,
      "processing": false
    },
    {
      "id": 752253240,
      "name": "Sandbox",
      "created_at": "2017-01-05T15:36:16-05:00",
      "updated_at": "2017-01-05T15:36:16-05:00",
      "role": "unpublished",
      "theme_store_id": null,
      "previewable": true,
      "processing": false
    }
  ]
}
GET /admin/themes/828155753.json
get a single theme
fields

comma-separated list of fields to include in the response

GET /admin/themes/#{id}.json
View Response
HTTP/1.1 200 OK
{
  "theme": {
    "id": 828155753,
    "name": "Comfort",
    "created_at": "2017-01-05T15:36:16-05:00",
    "updated_at": "2017-01-05T15:36:16-05:00",
    "role": "main",
    "theme_store_id": null,
    "previewable": true,
    "processing": false
  }
}
POST /admin/themes.json
Create a theme by providing the public URL of a .zip containing the theme. The theme always starts out with a role of "unpublished." If a different role is provided in the POST request, the theme will be given that role only after all its files have been extracted and stored by Shopify (which might take a couple of minutes).

Trying to create a theme without a name will return an error

POST /admin/themes.json
{
  "theme": {
    "body": "foobar"
  }
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
  "errors": {
    "name": [
      "can't be blank"
    ]
  }
}

Create a theme from a URL and give it a custom name and role.

POST /admin/themes.json
{
  "theme": {
    "name": "Lemongrass",
    "src": "http:\/\/themes.shopify.com\/theme.zip",
    "role": "main"
  }
}
View Response
HTTP/1.1 201 Created
{
  "theme": {
    "id": 1049083724,
    "name": "Lemongrass",
    "created_at": "2017-01-05T15:36:32-05:00",
    "updated_at": "2017-01-05T15:36:32-05:00",
    "role": "unpublished",
    "theme_store_id": null,
    "previewable": false,
    "processing": false
  }
}
PUT /admin/themes/752253240.json
Update a theme's attributes

changing the theme's role to main will publish the theme to that role

PUT /admin/themes/#{id}.json
{
  "theme": {
    "id": 752253240,
    "role": "main"
  }
}
View Response
HTTP/1.1 200 OK
{
  "theme": {
    "id": 752253240,
    "name": "Sandbox",
    "created_at": "2017-01-05T15:36:16-05:00",
    "updated_at": "2017-01-05T15:36:32-05:00",
    "role": "main",
    "theme_store_id": null,
    "previewable": true,
    "processing": false
  }
}

Update the theme's name

PUT /admin/themes/#{id}.json
{
  "theme": {
    "id": 752253240,
    "name": "Experimental"
  }
}
View Response
HTTP/1.1 200 OK
{
  "theme": {
    "id": 752253240,
    "name": "Experimental",
    "created_at": "2017-01-05T15:36:16-05:00",
    "updated_at": "2017-01-05T15:36:33-05:00",
    "role": "unpublished",
    "theme_store_id": null,
    "previewable": true,
    "processing": false
  }
}
DELETE /admin/themes/752253240.json
Delete a theme

Permanently delete a theme

DELETE /admin/themes/#{id}.json
View Response
HTTP/1.1 200 OK
{
  "id": 752253240,
  "name": "Sandbox",
  "created_at": "2017-01-05T15:36:16-05:00",
  "updated_at": "2017-01-05T15:36:16-05:00",
  "role": "unpublished",
  "theme_store_id": null,
  "previewable": true,
  "processing": false
}