GraphiQL for the Admin API
GraphiQL is an in-browser tool for writing, validating, and testing GraphQL queries. When working with Shopify's GraphQL Admin API, GraphiQL can be useful for the following tasks:
- Learning about the available queries and mutations
- Executing specific queries and mutations to extract information or accomplish tasks
For more information on GraphQL Admin API queries, refer to the GraphQL Admin API reference.
Execute queries on your store
Anchor link to section titled "Execute queries on your store"You can use GraphiQL to interact with your store's data in the following ways.
Install the GraphiQL app
Anchor link to section titled "Install the GraphiQL app"To build queries and mutations on your development store, install Shopify's GraphiQL app.
Some scopes aren't available within the GraphiQL app. The app also can't be used to access data owned by other apps. If you're developing an app, then you should use a local GraphiQL instance instead.
Use a local GraphiQL instance
Anchor link to section titled "Use a local GraphiQL instance"If you are developing an app using Shopify CLI, you can launch GraphiQL while running the dev
command by tapping the g
key.
Shopify CLI's GraphiQL instance connects as your app, so it has the same access scopes as your app, and it can access data owned by your app. It can't access data owned by other apps.
Execute queries from the Shopify.dev Assistant
Anchor link to section titled "Execute queries from the Shopify.dev Assistant"If you're running a local app server with Shopify CLI, then you can execute GraphiQL examples from the Shopify.dev Assistant.
You need to use Shopify CLI version 3.62.0 or higher. You can check your Shopify CLI version by running the following command:
Existing apps
Anchor link to section titled "Existing apps"If you have already started developing an app using Shopify CLI, then complete the following steps:
Navigate to your app directory:
Use the Shopify CLI
dev
command to start the app preview:To execute GraphQL code examples, click Run in GraphiQL in the codeblock.
If you haven't started developing an app yet, then complete the following steps:
- Install Shopify CLI.
- Scaffold an app.
Navigate to your app directory:
Use the Shopify CLI
dev
command to start the app preview:To execute GraphQL code examples, click Run in GraphiQL in the codeblock.
Execute queries on a demo store
Anchor link to section titled "Execute queries on a demo store"This is a read-only demo which can execute queries without needing to connect to a development store.
- Click Explorer and use checkboxes and fields to build GraphQL queries.
- Click Docs to expand the Documentation Explorer. You can search schemas to view descriptions and supported fields.
Launch GraphiQL in its own window.