I’m building a Shopify app and want to use ShopifyQL for analytics data. I’m familiar with running Shopify GraphQL queries (using Insomnia), but I’m unsure how to properly query ShopifyQL through the API.
Specifically, I’d like to know:
What GraphQL endpoint should I use for ShopifyQL queries?
How should the query structure look (e.g., variables, syntax differences from standard GraphQL)?
Are there any examples or best practices for querying ShopifyQL via GraphQL?
Here’s an example of a ShopifyQL query I’d like to run for sales over time
query {
shopifyqlQuery(query: "FROM sales SHOW total_sales BY day SINCE -30d") {
results {
data
}
}
}
Same problem I am having right now. We just want to get the monthly totals for the Gross Sales, Discounts, and Returns.
Currently we have to use the Admin API to fetch individual Order data, then aggregate the numbers from there.
It feels like doing order-based fetching is a waste of resources on Shopify’s end (and the API consumer) since we only need the totals. In the Admin Analytics UI, you can query using ShopifyQL, but from searching I don’t think this is possible using the Admin GraphQL API.
I think this wasn’t possible until recently. This admin endpoint works for me /admin/api/2025-10/graphql.json
Be mindful you need “read reports” and/or “read analytics” scopes. Then something like this might work for you:
{ shopifyqlQuery(query: “FROM sales SHOW orders AND order_fulfillment_status IN (‘partial’, ‘unfulfilled’) GROUP BY day, order_fulfillment_status WITH TOTALS, CURRENCY ‘AUD’ SINCE -45d UNTIL today”) { tableData { columns { name dataType displayName } rows } parseErrors } }