--- title: themeCreate - GraphQL Admin description: >- Creates a theme using an external URL or for files that were previously uploaded using the [stagedUploadsCreate mutation](https://shopify.dev/api/admin-graphql/latest/mutations/stageduploadscreate). These themes are added to the [Themes page](https://admin.shopify.com/themes) in Shopify admin. api_version: 2024-10 api_name: admin type: mutation api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/themeCreate' md: 'https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/themeCreate.txt' --- # theme​Create 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](https://docs.google.com/forms/d/e/1FAIpQLSfZTB1vxFC5d1-GPdqYunWRGUoDcOheHQzfK2RoEFEHrknt5g/viewform). Creates a theme using an external URL or for files that were previously uploaded using the [stagedUploadsCreate mutation](https://shopify.dev/api/admin-graphql/latest/mutations/stageduploadscreate). These themes are added to the [Themes page](https://admin.shopify.com/themes) in Shopify admin. ## Arguments * name [String](https://shopify.dev/docs/api/admin-graphql/2024-10/scalars/String) The name of the theme to be created. * source [URL!](https://shopify.dev/docs/api/admin-graphql/2024-10/scalars/URL) required An external URL or a [staged upload URL](https://shopify.dev/api/admin-graphql/latest/mutations/stageduploadscreate) of the theme to import. *** ## Theme​Create​Payload returns * theme [Online​Store​Theme](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/OnlineStoreTheme) The theme that was created. * user​Errors [\[Theme​Create​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/ThemeCreateUserError) non-null The list of errors that occurred from executing the mutation. *** ## Examples * ### Create a new theme from an url with a custom name #### Query ```graphql mutation themeCreate($source: URL!, $name: String!) { themeCreate(source: $source, name: $name) { theme { name role } userErrors { field message } } } ``` #### Variables ```json { "source": "http://www.example.com/dawn.zip", "name": "Dawn" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2024-10/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" } }' ``` #### Remix ```javascript 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(); ``` #### Ruby ```ruby 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) ``` #### Node.js ```javascript 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" }, }, }); ``` #### Response ```json { "themeCreate": { "theme": { "name": "Dawn", "role": "UNPUBLISHED" }, "userErrors": [] } } ``` * ### Creates a theme #### Query ```graphql mutation ThemeCreate($name: String, $source: URL!) { themeCreate(name: $name, source: $source) { theme { id } userErrors { code field message } } } ``` #### Variables ```json { "name": "New Theme", "source": "http://someurl.com/lemongrass.zip" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation ThemeCreate($name: String, $source: URL!) { themeCreate(name: $name, source: $source) { theme { id } userErrors { code field message } } }", "variables": { "name": "New Theme", "source": "http://someurl.com/lemongrass.zip" } }' ``` #### Remix ```javascript const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation ThemeCreate($name: String, $source: URL!) { themeCreate(name: $name, source: $source) { theme { id } userErrors { code field message } } }`, { variables: { "name": "New Theme", "source": "http://someurl.com/lemongrass.zip" }, }, ); const data = await response.json(); ``` #### Ruby ```ruby 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($name: String, $source: URL!) { themeCreate(name: $name, source: $source) { theme { id } userErrors { code field message } } } QUERY variables = { "name": "New Theme", "source": "http://someurl.com/lemongrass.zip" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation ThemeCreate($name: String, $source: URL!) { themeCreate(name: $name, source: $source) { theme { id } userErrors { code field message } } }`, "variables": { "name": "New Theme", "source": "http://someurl.com/lemongrass.zip" }, }, }); ``` #### Response ```json { "themeCreate": { "theme": { "id": "gid://shopify/OnlineStoreTheme/1049083724" }, "userErrors": [] } } ``` * ### themeCreate reference [Open in GraphiQL](http://localhost:3457/graphiql?query=mutation%20themeCreate\(%24source%3A%20URL!%2C%20%24name%3A%20String!\)%20%7B%0A%20%20themeCreate\(source%3A%20%24source%2C%20name%3A%20%24name\)%20%7B%0A%20%20%20%20theme%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%20%20role%0A%20%20%20%20%7D%0A%20%20%20%20userErrors%20%7B%0A%20%20%20%20%20%20field%0A%20%20%20%20%20%20message%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22source%22%3A%20%22http%3A%2F%2Fwww.example.com%2Fdawn.zip%22%2C%0A%20%20%22name%22%3A%20%22Dawn%22%0A%7D) ```javascript 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(); ``` ## Input variables JSON ```json { "source": "http://www.example.com/dawn.zip", "name": "Dawn" } ``` ## Response JSON ```json { "themeCreate": { "theme": { "name": "Dawn", "role": "UNPUBLISHED" }, "userErrors": [] } } ```