Requires The user must have write_themes and write_theme_api permissions. 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.

Deletes a theme.


Anchor to id
id
required

The ID of the theme to be deleted.


Was this section helpful?

The ID of the deleted theme.

The list of errors that occurred from executing the mutation.


Was this section helpful?

Examples

Hide code
DescriptionCopy
mutation themeDelete($id: ID!) {
  themeDelete(id: $id) {
    deletedThemeId
    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 themeDelete($id: ID!) { themeDelete(id: $id) { deletedThemeId userErrors { field message } } }",
 "variables": {
    "id": "gid://shopify/OnlineStoreTheme/908009861"
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  mutation themeDelete($id: ID!) {
    themeDelete(id: $id) {
      deletedThemeId
      userErrors {
        field
        message
      }
    }
  }`,
  {
    variables: {
      "id": "gid://shopify/OnlineStoreTheme/908009861"
    },
  },
);

const data = await response.json();
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 themeDelete($id: ID!) {
    themeDelete(id: $id) {
      deletedThemeId
      userErrors {
        field
        message
      }
    }
  }
QUERY

variables = {
  "id": "gid://shopify/OnlineStoreTheme/908009861"
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `mutation themeDelete($id: ID!) {
      themeDelete(id: $id) {
        deletedThemeId
        userErrors {
          field
          message
        }
      }
    }`,
    "variables": {
      "id": "gid://shopify/OnlineStoreTheme/908009861"
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  mutation themeDelete($id: ID!) {
    themeDelete(id: $id) {
      deletedThemeId
      userErrors {
        field
        message
      }
    }
  }
QUERY;

$variables = [
  "id" => "gid://shopify/OnlineStoreTheme/908009861",
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "id": "gid://shopify/OnlineStoreTheme/908009861"
}
Hide code
Response
JSON
{
  "themeDelete": {
    "deletedThemeId": "gid://shopify/OnlineStoreTheme/908009861",
    "userErrors": []
  }
}