Bugs on creating segments with the match keyword

Hi, there is a bug preventing segment creation through graphql when the segment query has the keyword “MATCH” even though it is a perfectly valid segment query and it was able to be created successfully on shopify admin dashboard:

It fails with segmentCreate graphql:

mutation segmentCreate($name: String!, $query: String!) {
  segmentCreate(name: $name, query: $query) {
      segment {
          id
      }
      userErrors {
          field
          message
      }
  }
}

variables:

{
  "name":"Customers with store credit not tagged", 
  "query":"store_credit_accounts MATCHES (balance > 0) AND customer_tags NOT CONTAINS 'has_store_credit_balance'"
}

However, it gives this error:

{
  "data": {
    "segmentCreate": {
      "segment": null,
      "userErrors": [
        {
          "field": [
            "query"
          ],
          "message": "Query Line 1 Column 0: 'MATCHES' is unexpected."
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 20000,
        "currentlyAvailable": 19990,
        "restoreRate": 1000
      }
    }
  }
}

However, when creating it through admin dashboard, it works:

1 Like

Hey Andrew,

Thanks for sharing this. This is currently a known limitation with our stable API’s. This is working in the unstable version though. I don’t currently have a timeline on if it will be added to the release candidate 2025-10 or if it will be later but I would expect that to be noted in the developers changelog