Access Denied Error When Fetching files in Theme via GraphQL

Hi everyone,

I’ve recently developed a new Shopify app that includes a theme app extension. As part of my logic, I need to check whether the extension is active by reading from the settings_data.json file inside the current theme. For that, I’m using the following GraphQL query:

query GetStoreThemes {
  themes(first: 20) {
    edges {
      node {
        id
        name
        role
        files(filenames: ["config/settings_data.json"]) {
          edges {
            node {
              body {
                ... on OnlineStoreThemeFileBodyText {
                  content
                }
              }
            }
          }
        }
      }
    }
  }
}

I’ve already granted the following scopes to the app:

  • read_themes
  • write_themes
  • read_files
  • write_files

However, I’m getting this error in response:

{
  "errors": [
    {
      "message": "Access denied",
      "locations": [
        { "line": 8, "column": 17 }
      ],
      "path": ["themes", "edges", 6, "node", "files"],
      "extensions": {
        "code": "ACCESS_DENIED",
        "documentation": "https://shopify.dev/api/usage/access-scopes"
      }
    }
  ]
}

I’ve also attached screenshots that show the scopes and the GraphQL response for better context.

Can anyone help me figure out what’s missing? Is there a permission or specific requirement I’m overlooking when accessing files in themes?

Thanks in advance!