# themeFilesUpsert Mutation

**URL:** <https://community.shopify.dev/t/themefilesupsert-mutation/14034>\
**Category:** GraphQL Admin API Troubleshooting\
**Tags:** general-gql-troubles\
**Created:** [April 22, 2025, 3:43pm UTC](https://community.shopify.dev/t/themefilesupsert-mutation/14034 "2025-04-22T15:43:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jordan\_Khalil](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/jordan_khalil/32/5796_2.png) [@Jordan\_Khalil](https://community.shopify.dev/u/Jordan_Khalil)\
**Post date:** [April 22, 2025, 3:43pm UTC](https://community.shopify.dev/t/themefilesupsert-mutation/14034/1 "2025-04-22T15:43:18Z")

</div>

Hello shopify team.

Im trying to run themeFilesUpsert Mutation to create 6 page templates but include the relevant embeded app block. For context Im creating a copy of the admins main theme and integrating all of my shopify app features to the copied theme including attempting to inject embedded app blocks when creating template pages in my Theme Files Upsert Mutation. This is so the admin doesnt have to add any embedded app blocks manually and rather injected when creating a duplicated copied theme. Here is a test case for testing in graphQL:

Mutation:

```auto
mutation themeFilesUpsert($files: [OnlineStoreThemeFilesUpsertFileInput!]!, $themeId: ID!) {
  themeFilesUpsert(files: $files, themeId: $themeId) {
    upsertedThemeFiles {
      filename
    }
    userErrors {
      field
      message
    }
  }
}

```

Input:

```auto
{
  "themeId": "gid://shopify/OnlineStoreTheme/176575381784",
  "files": [
    {
      "filename": "templates/page.inx-account-dashboard.json",
      "body": {
        "type": "TEXT",
        "value": "{\n \"sections\": {\n \"main\": {\n \"type\": \"main-page\",\n \"blocks\": {\n \"inx-account-dashboard\": {\n \"type\": \"shopify://apps/inxsql-webservice-development/blocks/inx-account-dashboard/fef96608-1583-4025-9bd9-c104950eed41\",\n \"settings\": {}\n }\n },\n \"block_order\": [\"inx-account-dashboard\"],\n \"settings\": {\n \"padding_top\": 28,\n \"padding_bottom\": 28\n }\n }\n },\n \"order\": [\"main\"]\n}"
      }
    }
  ]
}

```

Response:

```auto
{
  "data": {
    "themeFilesUpsert": {
      "upsertedThemeFiles": [],
      "userErrors": [
        {
          "field": [
            "files"
          ],
          "message": "App blocks are not accepted in this context."
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1990,
        "restoreRate": 100
      }
    }
  }
}

```

Can you inject app blocks into themefilesupsert that come from my theme extensions?

---

<div class="post-metadata">

**Author:** ![Jordan\_Khalil](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/jordan_khalil/32/5796_2.png) [@Jordan\_Khalil](https://community.shopify.dev/u/Jordan_Khalil)\
**Post date:** [April 22, 2025, 7:32pm UTC](https://community.shopify.dev/t/themefilesupsert-mutation/14034/2 "2025-04-22T19:32:53Z")

</div>

Hey shopify team. I found a solution you can close this case. Thank you.

---

<div class="post-metadata">

**Author:** ![KyleG-Shopify](https://sea1.discourse-cdn.com/shopifycommunity/user_avatar/community.shopify.dev/kyleg-shopify/32/6799_2.png) [@KyleG-Shopify](https://community.shopify.dev/u/KyleG-Shopify)\
**Post date:** [April 22, 2025, 9:51pm UTC](https://community.shopify.dev/t/themefilesupsert-mutation/14034/3 "2025-04-22T21:51:33Z")

</div>

Thanks @Jordan_Khalil !

Care to share your solution?
