Hi I’m trying to create a customer segment using the store_credit_accounts function via the GraphQL Admin API, but I’m getting syntax errors. The exact same query works perfectly in the Shopify Admin UI segment builder.
Using the MATCHES syntax (as per the segment query language reference):
mutation {
segmentCreate(
name: "Customers with Expiring Store Credit"
query: "store_credit_accounts MATCHES (next_expiry_date <= +30d)") {
segment {
id
name
query
}
}
}
**Error Response:
**
{
“data”: {
“segmentCreate”: {
“segment”: null,
“userErrors”: [
{
“field”: [“query”],
“message”: “Query Line 1 Column 0: ‘MATCHES’ is unexpected.”
}
]
}
}
}
Has anyone successfully created segments with store credit filters via the API? Any guidance would be greatly appreciated!