Anchor to themePublishtheme
themePublish
mutation
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.
Publishes a theme.
Anchor to ThemePublishPayload returnsThemePublishPayload returns
- Anchor to themetheme•
The theme that was published.
- Anchor to userErrorsuser•
Errors [ThemePublish non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Modify an existing Theme
- Publish a theme
- themePublish reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation themePublish($id: ID!) {
themePublish(id: $id) {
theme {
id
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/OnlineStoreTheme/908009861"
},
},
);
const data = await response.json();
mutation themePublish($id: ID!) {
themePublish(id: $id) {
theme {
id
}
userErrors {
code
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 themePublish($id: ID!) { themePublish(id: $id) { theme { id } userErrors { code field message } } }",
"variables": {
"id": "gid://shopify/OnlineStoreTheme/908009861"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation themePublish($id: ID!) {
themePublish(id: $id) {
theme {
id
}
userErrors {
code
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/OnlineStoreTheme/908009861"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation themePublish($id: ID!) {
themePublish(id: $id) {
theme {
id
}
userErrors {
code
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/OnlineStoreTheme/908009861"
},
},
});
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 themePublish($id: ID!) {
themePublish(id: $id) {
theme {
id
}
userErrors {
code
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/OnlineStoreTheme/908009861"
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"id": "gid://shopify/OnlineStoreTheme/908009861"
}
Response
JSON{
"themePublish": {
"theme": {
"id": "gid://shopify/OnlineStoreTheme/908009861"
},
"userErrors": []
}
}