# Theme

        <p>A theme controls the look and feel of a Shopify online store.</p>
        {{ '/api/reference/theme.png' | image }}
        <p>A store can have a maximum of 20 themes, one of which is the published theme that customers see when they visit the online store. Customers can't see unpublished themes. When you publish a theme, the previously published theme becomes unpublished.</p>
        <p>To modify theme files after they're uploaded, use the <a href="/docs/admin-api/rest/reference/online-store/asset">Asset</a> resource. To learn how to create your own theme, refer to <a href="/concepts/themes"><em>Building themes</em></a></p>

## Resource Properties

### Theme

* created_at: The date and time when the theme was created. (format: 2014-04-25T16:15:47-04:00)
  * Type: x-string
  * Example: "2012-08-24T14:01:47-04:00"
* id: The unique numeric identifier for the theme.
  * Type: x-string
  * Example: 828155753
* name: The name of the theme.
  * Type: x-string
  * Example: "Comfort"
* previewable: Whether the theme can currently be previewed.
  * Type: x-string
  * Example: true
* processing: Whether files are still being copied into place for this theme.
  * Type: x-string
  * Example: true
* role:           Specifies how the theme is being used within the shop. Valid values:
          <ul>
            <li><strong>main</strong>: The theme is published. Customers see it when they visit the online store.</li>
            <li><strong>unpublished</strong>: The theme is unpublished. Customers can't see it.</li>
            <li><strong>demo</strong>: The theme is installed on the store as a demo. The theme can't be published until the merchant buys the full version.</li>
            <li><strong>development</strong>: The theme is used for development. The theme can't be published, and is temporary.</li>
          </ul>

  * Type: x-string
  * Example: "main"
* src: Specifies a public URL where Shopify can access the theme code.
  * Type: x-string
  * Example: "http://themes.shopify.com/theme.zip"
* theme_store_id:           A unique identifier applied to Shopify-made themes that are installed from the <a href="https://themes.shopify.com/">Shopify Theme Store</a> Theme Store.
          Not all themes available in the Theme Store are developed by Shopify. Returns <code>null</code> if the store's theme isn't made by Shopify, or if it wasn't installed from the Theme Store.

  * Type: x-string
  * Example: 775
* updated_at: The date and time of when the theme was last updated. (format: 2014-04-25T16:15:47-04:00)
  * Type: x-string
  * Example: "2012-08-24T14:01:47-04:00"
## Retrieves a list of themes

Retrieves a list of themes.

### Endpoint
/admin/api/#{api_version}/themes.json (GET)

### Parameters
* api_version (required): 
* fields: Show only certain fields, specified by a comma-separated list of field names.

### Responses
#### 200
Retrieves a list of themes

Examples:
##### Retrieve a list of themes
Request:
```
GET /admin/api/unstable/themes.json
```

Response:
```
HTTP/1.1 200 OK
{"themes":[{"id":828155753,"name":"Comfort","created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:29:59-05:00","role":"main","theme_store_id":null,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/828155753"},{"id":976877075,"name":"Preview of Parallax","created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:29:59-05:00","role":"demo","theme_store_id":688,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/976877075"},{"id":752253240,"name":"Sandbox","created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:29:59-05:00","role":"unpublished","theme_store_id":null,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/752253240"}]}
```
## Creates a theme

Creates a theme by providing the public URL of a ZIP file that contains the theme.
          <p>A new theme is always unpublished by default. To publish a theme when you create it, include
          <code>"role": "main"</code> in the POST request. The theme will be published only after all
          of its files have been extracted and stored by Shopify, which might take a couple of minutes.</p>

### Endpoint
/admin/api/#{api_version}/themes.json (POST)

### Parameters
* api_version (required): 

### Responses
#### 201
Creates a theme

Examples:
##### Create a theme that has a custom name and is published
Request:
```
POST /admin/api/unstable/themes.json
{"theme":{"name":"Lemongrass","src":"http://themes.shopify.com/theme.zip","role":"main"}}
```

Response:
```
HTTP/1.1 201 Created
{"theme":{"id":1049083723,"name":"Lemongrass","created_at":"2025-01-02T11:35:01-05:00","updated_at":"2025-01-02T11:35:01-05:00","role":"unpublished","theme_store_id":null,"previewable":false,"processing":true,"admin_graphql_api_id":"gid://shopify/Theme/1049083723"}}
```
#### 422
Creates a theme

Examples:
##### Creating a theme without a name fails and returns an error
Request:
```
POST /admin/api/unstable/themes.json
{"theme":{"body":"foobar"}}
```

Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"name":["can't be blank"]}}
```
## Retrieves a single theme by its ID

Retrieves a single theme by its ID.

### Endpoint
/admin/api/#{api_version}/themes/{theme_id}.json (GET)

### Parameters
* api_version (required): 
* theme_id (required): 
* fields: Show only certain fields, specified by a comma-separated list of field names.

### Responses
#### 200
Retrieves a single theme by its ID

Examples:
##### Retrieve a single theme
Request:
```
GET /admin/api/unstable/themes/828155753.json
```

Response:
```
HTTP/1.1 200 OK
{"theme":{"id":828155753,"name":"Comfort","created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:29:59-05:00","role":"main","theme_store_id":null,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/828155753"}}
```
## Modify an existing Theme

Updates an existing theme.

### Endpoint
/admin/api/#{api_version}/themes/{theme_id}.json (PUT)

### Parameters
* api_version (required): 
* theme_id (required): 

### Responses
#### 200
Modify an existing Theme

Examples:
##### Publish an unpublished theme
Request:
```
PUT /admin/api/unstable/themes/752253240.json
{"theme":{"id":752253240,"role":"main"}}
```

Response:
```
HTTP/1.1 200 OK
{"theme":{"role":"main","id":752253240,"name":"Sandbox","created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:34:59-05:00","theme_store_id":null,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/752253240"}}
```
##### Update a theme's name
Request:
```
PUT /admin/api/unstable/themes/752253240.json
{"theme":{"id":752253240,"name":"Experimental"}}
```

Response:
```
HTTP/1.1 200 OK
{"theme":{"name":"Experimental","role":"unpublished","id":752253240,"created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:34:58-05:00","theme_store_id":null,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/752253240"}}
```
## Remove an existing Theme

Deletes a theme. A theme can't be deleted while it's uploading, updating, or if the theme is the last published theme.

### Endpoint
/admin/api/#{api_version}/themes/{theme_id}.json (DELETE)

### Parameters
* api_version (required): 
* theme_id (required): 

### Responses
#### 200
Remove an existing Theme

Examples:
##### Delete a theme
Request:
```
DELETE /admin/api/unstable/themes/752253240.json
```

Response:
```
HTTP/1.1 200 OK
{"id":752253240,"name":"Sandbox","created_at":"2025-01-02T11:29:59-05:00","updated_at":"2025-01-02T11:29:59-05:00","role":"unpublished","theme_store_id":null,"previewable":true,"processing":false,"admin_graphql_api_id":"gid://shopify/Theme/752253240"}
```