Sending your first request

This guide describes the basic steps for getting started with Shopify's GraphQL Admin API.

Setup

To begin building with Shopify's APIs, you need to set up a development store and a way to send API requests.

Set up a development store

If you're new to building Shopify integrations, then you need to create a Shopify Partner account and create a development store. A development store is a free Shopify account that you can use to install and test your apps. To learn more, see Creating development stores.

Steps:

  1. Create a Partner account, if you don't already have one.
  2. Create a development store, or log into an existing one.
  3. Generate API credentials for a private app, and take note of the API password.
  4. Generate data for your store by using the Shopify Developer Tools app. Use the app to generate some orders, products, and customers.

Api clients

After you have a store and a set of API credentials, you need a way to make requests to the API.

The Shopify GraphiQL app

The Shopify GraphiQL app allows you to make GraphQL requests and see the responses within the context of your own shop. This is the preferred method for learning and exploring Shopify's GraphQL APIs because the app provides many features within your Shopify admin, such as auto-complete and API documentation.

For this guide, we recommend configuring the app with the following read and write permissions:

  • Products
  • Customers
  • Orders
  • Draft orders

These permissions enable you to use any of the Run in GraphiQL links throughout the following pages.

Standalone HTTP clients

You can use any standalone application that can perform HTTP requests to interact with the API. These are excellent testing tools because they allow you to configure multiple environments, allowing you to switch between your test and production shops with ease.

See our Shopify Learning Kit Partner Blog Post for a full tutorial on setting up Insomnia.

cURL

You can make requests directly from your terminal. This is the most direct way to interact with the API because it requires no additional software on your machine. The format for making cURL requests is as follows:

  • { store } — your development store's name
  • { api_password } — the API password of your private app
curl -X POST \
  https://{ store }.myshopify.com/admin/api/2019-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: { api_password }' \
  -d ' {
      "query": "query { shop { id name email } }"
  }'

Send your first GraphQL query

When you have set up your development store and API client, you can make a request to Shopify's API.

The following query uses the GraphQL Admin API to request the shop node, as well as the id, name, and email fields.

POST /admin/api/2019-10/graphql.json

query {
  shop {
    id
    name
    email
  }
}

JSON response

{
  "data": {
    "shop": {
      "id": "gid:\/\/shopify\/Shop\/17681717",
      "name": "johns-apparel",
      "email": "john@johns-apparel.com"
    }
  },
  ...
}

Run in GraphiQL

Next steps

  • GraphQL Queries — Learn how to write more detailed queries and get data across multiple resources

Sign up for a Partner account to get started.

Sign up