I am trying to fetch customer information from my Shopify store using the REST API and GraphQL API, but I keep encountering errors related to access permissions and authentication.
I am using a headless app to interact with the Shopify API. Here’s the setup I’m using:
- REST API Request: I attempted to retrieve customer information using the following GET request:
GET https://[STORE-ID].myshopify.com/admin/api/2023-01/customers/8696123785497.json
With the following headers:
-H "X-Shopify-Access-Token: [YOUR_ACCESS_TOKEN]" -H "Content-Type: application/json"
Error Response:
{ "errors": "[API] Invalid API key or access token (unrecognized login or wrong password)" }
- GraphQL API Request: I also tried to create a customer using the GraphQL API with this request:
POST https://[STORE-ID].myshopify.com/admin/api/2024-10/graphql.json
Error Response:
{ "message": "Access denied for customerCreate field. Required access:
write_customers access scope." }
Any help or guidance would be greatly appreciated!
Steps Taken:
- I have confirmed that the access token I am using is correct.
- I checked the permissions in my Shopify Partner Dashboard and ensured that the necessary scopes (read_customers and write_customers) are enabled for my app.
2
Answers
Please check the API scope: it should be read_customers and write_customers scopes if any doubt then reinstall the app. Also, check the API version in your requests (2023-01 for REST and 2024-10 for GraphQL)
If your app is created via shopify admin then please confirm scopes in shopify admin -> settings -> Apps and sales channels. Click on ‘Develop Apps’ and select your app and then check Configurations.
Please make sure you have selected correct permissions. (read_customers, write_customers)
If your app is created via partners account then you need to add scopes in your app URL (Which is added in App configuration is app settings).
For example: if your app authentication file is created in PHP then scope will add like: