Shopify admin graphql api give the error to access the shop email

Topic summary

A developer is encountering an error when trying to access shop email addresses via Shopify’s Admin GraphQL API in production, despite the same query working successfully in a development store.

Technical Details:

  • The query attempts to retrieve shop.email and billingAddress fields
  • Code uses the @shopify/shopify-api package
  • Error occurs specifically in production/live stores, not development environments

Proposed Solutions:

  • One participant suggests the email field may not be valid when querying from the billingAddress object
  • Alternative approaches mentioned include using customer.count() and customer.list() methods

Current Status:
The issue remains unresolved. The developer is seeking:

  • Customer email and count data from Admin API without requiring customer consent
  • More detailed guidance on implementing the suggested alternative methods

The discussion indicates potential API permission or scope differences between development and production store environments.

Summarized with AI on November 22. AI used: claude-sonnet-4-5-20250929.

Hi All,

I want to access MailingAddress represents a customer mailing address. i am referring to getting the store email address associated with their store details.

this is the code.
it was working on a development store not working on production server.
https://shopify.dev/docs/api/admin-graphql/2022-10/objects/Shop#field-shop-email

import { Shopify } from "@shopify/shopify-api";

Route.get("/api/test", async (req, res,next) => {

 const shop_qgql = await client.query({
    data: `{
      shop {
        name
        email
        billingAddress {
          id
          country
        }
      }
    }`,
  });

}
1 Like

@clickrapt If you can help on this query.

it was working on a development store not working on production store..

1 Like

Hi @1080

I am not sure, but I don’t think you can query the email address from the BillingAddress object, In this instance the email feild may not be valid. again Just a guess not sure, Good luck

1 Like

@clickrapt email i was able to get from the shop.email it was correct. this api Query was working fine in development store. it was not working on live store we need customer consent.

is thire any way to get the customer email and count from the admin api without the shopify customer data reviews.

Try the customer.count() and customer.list() methods.

@clickrapt can you please provide me the more details where to use that method ?