Get customer statistics
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/customers/statistics';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://apibase.ecomweb.app/api/v1/stores/example/customers/statistics \ --header 'x-api-key: <x-api-key>'Returns store-wide customer figures: totals, new customers this month, active and inactive counts, average orders per customer, growth against last month and the five customers who spent the most. Deleted customers are not counted.
Required scopes: read:customers
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Responses
Section titled “Responses”object
Customers that are not deleted.
Customers created since the start of the current month.
Customers with a recent order.
Customers without a recent order, including those who never ordered.
Orders per customer, on average.
Up to five customers who spent the most.
object
Account status set by the store. An inactive customer cannot sign in.
Ordering activity: active for a recent order, inactive for an old one, never_ordered for none. Separate from status.
Customer ID.
Email address. Empty for a customer created with a phone number only.
Full name.
Phone number, or null.
Avatar image URL, or null.
ID of the sign-in identity linked to the customer, or null for a customer who never signed in.
Internal notes about the customer, or null.
When the customer was created, as an ISO 8601 timestamp.
When the customer was last updated, as an ISO 8601 timestamp.
When the customer was deleted, or null while the customer is live.
Date of the first order, as an ISO 8601 timestamp. Absent when the customer has no orders.
Date of the latest order, as an ISO 8601 timestamp. Absent when the customer has no orders.
Days since the latest order. Absent when the customer has no orders.
Orders placed by the customer.
Cancelled orders.
Refunded orders.
Orders that count towards revenue: those neither cancelled nor refunded.
Total spent across revenue orders, in the store currency.
Average value of a revenue order, in the store currency.
Orders placed as a guest with the customer’s email and linked to them by it.
Growth in customer count against the end of last month, as a percentage.
Example
{ "top_customers": [ { "status": "active", "activity_state": "active" } ]}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}