themeCreate
Requires The user needs write_themes and an exemption from Shopify to modify themes. If you think that your app is eligible for an exemption and should have access to this API, then you can submit an exception request.
Creates a theme using an external URL or for files that were previously uploaded using the stagedUploadsCreate mutation. These themes are added to the Themes page in Shopify admin.
Arguments
- Anchor to namename•
The name of the theme to be created.
- Anchor to sourcesource•URL!required
An external URL or a staged upload URL of the theme to import.
Anchor to ThemeCreatePayload returnsThemeCreatePayload returns
- Anchor to themetheme•
The theme that was created.
- Anchor to userErrorsuser•
Errors [ThemeCreate non-nullUser Error!]! The list of errors that occurred from executing the mutation.
- Create a new theme from an url with a custom name
- Creates a theme
- themeCreate reference
Examples
mutation themeCreate($source: URL!, $name: String!) {
themeCreate(source: $source, name: $name) {
theme {
name
role
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation themeCreate($source: URL!, $name: String!) { themeCreate(source: $source, name: $name) { theme { name role } userErrors { field message } } }",
"variables": {
"source": "http://www.example.com/dawn.zip",
"name": "Dawn"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation themeCreate($source: URL!, $name: String!) {
themeCreate(source: $source, name: $name) {
theme {
name
role
}
userErrors {
field
message
}
}
}`,
{
variables: {
"source": "http://www.example.com/dawn.zip",
"name": "Dawn"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation themeCreate($source: URL!, $name: String!) {
themeCreate(source: $source, name: $name) {
theme {
name
role
}
userErrors {
field
message
}
}
}`,
"variables": {
"source": "http://www.example.com/dawn.zip",
"name": "Dawn"
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation themeCreate($source: URL!, $name: String!) {
themeCreate(source: $source, name: $name) {
theme {
name
role
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"source": "http://www.example.com/dawn.zip",
"name": "Dawn"
}
response = client.query(query: query, variables: variables)