customerStatistics
Requires at least one of the permissions customers:customer:list or customers:customer:read.
Returns summary counts for the customers the signed-in user may see. Needs the customers read or list permission.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query CustomerStatistics {
customerStatistics {
activeCustomers
averageOrderValue
totalCustomers
totalSalesAmount
topCustomers {
id
name
lastOrderDate
totalAmount
totalOrders
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query CustomerStatistics {\n customerStatistics {\n activeCustomers\n averageOrderValue\n totalCustomers\n totalSalesAmount\n topCustomers {\n id\n name\n lastOrderDate\n totalAmount\n totalOrders\n }\n }\n}"
}
EOF
Response:
{
"data": {
"customerStatistics": {
"activeCustomers": 0,
"averageOrderValue": 0,
"totalCustomers": 0,
"totalSalesAmount": 0,
"topCustomers": [
{
"id": "id",
"name": "string",
"lastOrderDate": "2025-01-15T00:00:00Z",
"totalAmount": 0,
"totalOrders": 0
}
]
}
}
}
customerStatistics: CustomerStatistics!
Type
CustomerStatistics object
Headline customer statistics.