GraphQL is a query language for APIs. It allows to define the structure of the requested data, which makes it possible to avoid returning overly large amounts of data.

Shopify’s Admin API can be queried with GraphQL. GraphQL queries are executed by sending POST HTTP requests. This can be achieved in Python with the requests module like so:

import requests
import json

url = ''
headers = {"Content-Type": "application/graphql",
           "X-Shopify-Access-Token": YOUR_ACCESS_TOKEN}

request =, data=your_query, headers=headers)

Set your API access keyword in YOUR_ACCESS_TOKEN. There are many examples given on how to structure the queries. Here is a simple example to get your 10 latest orders and their respective IDs:

your_query = """
  orders(first: 10) {
    edges {
      node {

Happy querying!