ShopifyQL now available as `shopifyqlQuery` within the GraphQL Admin API

Shopify Updates: 

Developers can now leverage ShopifyQL to extract valuable insights from all merchant analytics including sales, customer, and product data via the GraphQL Admin API. This enhancement allows for more sophisticated data analysis and reporting.

For a comprehensive guide on the ShopifyQL language, please visit the ShopifyQL syntax documentation.

The shopifyqlQuery field is now accessible on the QueryRoot of the GraphQL Admin API. To learn more about using this new query field, refer to our detailed documentation.

For example, here is a query that demonstrates how to retrieve total sales data, grouped by month, starting from the beginning of the current year:

{
   shopifyqlQuery(query: "FROM sales SHOW total_sales GROUP BY month SINCE startOfYear(0y) ORDER BY month") {
    tableData {
      columns {
        name
        dataType
        displayName
      }
      rows
    }
    parseErrors
  }
}

The response contains table data with column and row values, detailing the total sales per month.

{
  "data": {
    "shopifyqlQuery": {
      "tableData": {
        "columns": [
          {
            "name": "month",
            "dataType": "MONTH_TIMESTAMP",
            "displayName": "Month"
          },
          {
            "name": "total_sales",
            "dataType": "MONEY",
            "displayName": "Total sales"
          }
        ],
        "rows": [
          {
            "month": "2025-01-01",
            "total_sales": "5542.954"
          },
          {
            "month": "2025-02-01",
            "total_sales": "1610.094"
          }
        ]
      },
      "parseErrors": []
    }
  }
}

Any parsing errors encountered during execution will be listed under parseErrors.

Back to blog