---
title: "Counts a product's customers by status."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.sherpo.io/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Sherpo merchant API › customer

`GET /v1/stores/{store}/products/{product}/customers/stats`

## Authentication

- `bearer`, http, header `Authorization`, scopes: `customer:read`

## Path parameters

- `store` (`productCustomerStats.path.store`; string, required) — The store's id.
- `product` (`productCustomerStats.path.product`; string, required) — An id, or `slug:<slug>`.
  - minLength 1

## Code samples

### cURL

```bash
curl --request GET \
  --url 'https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/customers/stats' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = 'https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/customers/stats';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.sherpo.io/merchant/v1/stores/<store>/products/<product>/customers/stats"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

Counts a product's customers by status.

#### Example

```json
{
  "total": 0,
  "by_status": {
    "scheduled": 0,
    "unpaid": 0,
    "active": 0,
    "expired": 0,
    "past_due": 0,
    "paused": 0,
    "cancelled": 0,
    "ended": 0,
    "revoked": 0,
    "cancelling": 0,
    "refunded": 0
  },
  "by_kind": {
    "subscription": 0,
    "grant": 0
  },
  "active_granted": 0,
  "active_subscribed": 0
}
```

- `total` (`productCustomerStats.response.200.total`; number, required)
- `by_status` (`productCustomerStats.response.200.by_status`; object, required)
  - `scheduled` (`productCustomerStats.response.200.by_status.scheduled`; number, required)
  - `unpaid` (`productCustomerStats.response.200.by_status.unpaid`; number, required)
  - `active` (`productCustomerStats.response.200.by_status.active`; number, required)
  - `expired` (`productCustomerStats.response.200.by_status.expired`; number, required)
  - `past_due` (`productCustomerStats.response.200.by_status.past_due`; number, required)
  - `paused` (`productCustomerStats.response.200.by_status.paused`; number, required)
  - `cancelled` (`productCustomerStats.response.200.by_status.cancelled`; number, required)
  - `ended` (`productCustomerStats.response.200.by_status.ended`; number, required)
  - `revoked` (`productCustomerStats.response.200.by_status.revoked`; number, required)
  - `cancelling` (`productCustomerStats.response.200.by_status.cancelling`; number, required)
  - `refunded` (`productCustomerStats.response.200.by_status.refunded`; number, required)
- `by_kind` (`productCustomerStats.response.200.by_kind`; object, required)
  - `subscription` (`productCustomerStats.response.200.by_kind.subscription`; number, required)
  - `grant` (`productCustomerStats.response.200.by_kind.grant`; number, required)
- `active_granted` (`productCustomerStats.response.200.active_granted`; number, required)
- `active_subscribed` (`productCustomerStats.response.200.active_subscribed`; number, required)

### default

A problem; see https://api.sherpo.io/merchant/docs/errors.

#### Example

```json
{
  "type": "http://example.com",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "context": {},
  "reached_core": true,
  "core_answer": "string"
}
```

- `type` (`productCustomerStats.response.default.type`; string, required)
  - format `uri`
- `title` (`productCustomerStats.response.default.title`; string, required)
- `status` (`productCustomerStats.response.default.status`; integer, required)
- `detail` (`productCustomerStats.response.default.detail`; string, required)
- `code` (`productCustomerStats.response.default.code`; string, optional)
- `context` (`productCustomerStats.response.default.context`; object, optional)
- `reached_core` (`productCustomerStats.response.default.reached_core`; boolean, optional)
- `core_answer` (`productCustomerStats.response.default.core_answer`; string, optional)


Source: https://docs.sherpo.io/merchant-api/reference/product-customer-stats/index.md
