The GraphQL Endpoint
Unlike the REST Admin API which has a variety of endpoints, the GraphQL Admin API has a single endpoint:
Make your first call to the GraphQL Admin API
We recommend installing Shopify’s own GraphiQL app to explore your shop’s data using the new API.
Once you've installed the app, you can test it by running the following query:
A successful query results in a response similar to the following:
Congratulations, you’ve made your first call to the GraphQL Admin API!
The GraphQL Admin API requires an access token for making authenticated requests.
You can obtain an access token either by creating a private app and using that app's API password, or by following the OAuth authorization process.
- From your Shopify admin, click Apps.
- Click Manage private apps.
- Click Create a new private app.
- Enter the details for your private app.
- Click Save.
Use the generated API password as the access token.
To get the access token, follow the OAuth authorization flow in the OAuth guide.
Using your access token
Include the access token as a
X-Shopify-Access-Token header in all GraphQL queries and mutations.
Query the GraphQL Admin API
You can access the GraphQL Admin API endpoint using cURL or any other HTTP client. For the following examples, make sure to replace <SHOP> with your store’s domain and <ACCESS_TOKEN> with the token you generated in the Authentication section.
To make a query to the using curl, send a POST request with your query as the JSON payload.
In GraphQL, queries are the equivalent of REST’s GET action verb. They generally begin with one of the objects listed under QueryRoot and can get data from any connections that object has. Even though a POST is being sent to the GraphQL endpoint, if the body only contains queries, data will only be retrieved and not modified.
Query the inventory levels of the first ten locations where a variant is stored.
Mutations are the equivalent of REST’s data-modifying action verbs.
Increase available inventory at a location.