GraphQL Query Orders with created_at:>date is returning orders 31h before the date specified

Topic summary

A GraphQL query filtering orders by created_at:>2024-04-10T23:00:00Z was returning orders from 31 hours before the specified timestamp (starting at 2024-04-09T16:01:09Z).

Root Cause:
Incorrect query syntax caused unexpected results instead of throwing an error. The query was ignoring or misinterpreting the timestamp filter.

Solution (provided by Shopify Support):

  • Remove the comma between query parameters—GraphQL search syntax uses implicit AND operators
  • Wrap timestamps in single quotation marks for proper parsing

Corrected syntax:

query: "created_at:>'2024-04-09T23:00:00Z' AND financial_status:PAID"

Key takeaway: GraphQL can silently mishandle malformed queries rather than returning errors, making syntax validation critical for reliable filtering.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

I have a GraphQL (url=api/2024-01/graphql.json) query (see below) for orders.

The query returns orders starting on

“createdAt”: “2024-04-09T16:01:09Z”, which is 31h before the date time I specified in the query.

{
    query {
    orders(first: 250, query: "created_at:>2024-04-10T23:00:00Z, finacial_status:PAID") {
      edges {
        node {
          name
          createdAt
          processedAt
          lineItems (first: 250) {
              edges {
                  node {
                      quantity
                      discountedTotalSet {
                          shopMoney {
                              amount
                          }
                      }
                      sku
                      customAttributes {
                          key
                          value
                      }
                  }
              }
          }
          customer {
            metafield(key:"${flybuysNumberKey}", namespace:"custom") {
                namespace
                key
                value
            }
          }
        }
      }
    }
  }
  }

If I switch the date to 11th April, i get orders on the 10th at 4pm, 31h before the query date. Adding single quotes around the iso time returns zero results. If I remove the time part of the date and have “created_at:>2024-04-10” I get the same result as when the time was 23:00:00. In other words the query seems to ignore the timestamp and grab orders from the day before. It is not completely ignoring created_at. Our timezone is Australia Melbourne +10h. Shopify admin shows the orders in our TZ, but the GraphQL response data is in UTC; I don’t think a TZ mis-understanding is the cause of the problem.

How can i write a query that will only return orders in the exact timestamp that i specify?

This issue is quite serious, I can’t get a reliable set of orders in a specific time period to integrate reporting data with a partner. I am using Postman and Node.js.

This was solved by the Shopify Support team, the syntax in my query was incorrect. But instead of an error i was getting unexpected results so i assumed the query was ok. This is the correct syntax:

  • remove the comma, GraphQL search syntax implies an ANDoperator
  • wrap the timestamp in single quotation marks, GraphQL sometimes has trouble parsing timestamps

With these adjustments, the query should now look like this:

{
  orders(
    first: 250
    query: "created_at:>'2024-04-09T23:00:00Z' AND financial_status:PAID"
    sortKey: CREATED_AT
  ) {
    edges {
      node {
        name
        createdAt
      }
    }
  }