> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/customer-report.md).

# Customer Report

Administrative, read-only endpoint that returns a **customer report** — one row per user, combining the user's profile and communication permissions with order statistics aggregated over all of the user's orders.

### Core Capabilities

* List every user on the channel — registered and guest users, active and inactive, staff included — ordered by `id` ascending by default.
* Each row carries four order aggregates computed at request time: `total_order_count`, `total_orderitem_count`, `total_order_amount`, and `total_order_discount_amount`, plus `last_order_date`.
* Filter by profile fields, communication permissions, dates, groups, `attributes` keys, and whether the user has placed an order (`is_customer`).
* Sort by any field of the row except `logged_ip`, including the aggregates (e.g. `?sort=-total_order_amount`).
* Large default page size: **1000** rows, up to **10000** with `limit`.

Only `GET` is supported; `POST`, `PUT`, `PATCH`, and `DELETE` return `405`.

### Order Aggregates

| Field                         | Computation                                                                        |
| ----------------------------- | ---------------------------------------------------------------------------------- |
| `total_order_count`           | Number of the user's orders.                                                       |
| `total_orderitem_count`       | Number of order item records across all of the user's orders.                      |
| `total_order_amount`          | Sum of `amount` of the user's orders; `0.00` when the user has no order.           |
| `total_order_discount_amount` | Sum of `discount_amount` of the user's orders; `0.00` when the user has no order.  |
| `last_order_date`             | `created_date` of the user's most recent order; `null` when the user has no order. |

* Every order is counted **regardless of its status** — cancelled and refunded orders are included.
* When sorting by `last_order_date`, users without an order (`null`) come **last** in ascending order and **first** in descending order.
* Filters narrow the rows but never change the aggregates: a user's totals are the same with or without `is_customer` or any other filter.

### Filtering

| Parameter                                                                                             | Match                                                                                                                                                                                                       |
| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`                                                                                                  | Exact user identifier.                                                                                                                                                                                      |
| `email`                                                                                               | Case-insensitive exact match on the user's **email address records** (every address the account has registered, verified or not), not on the `email` column of the row.                                     |
| `first_name`, `last_name`, `phone`, `gender`                                                          | Case-insensitive **exact** match — partial values return an empty page.                                                                                                                                     |
| `email_allowed`, `sms_allowed`, `call_allowed`, `is_active`                                           | Boolean (`true` / `false`).                                                                                                                                                                                 |
| `is_customer`                                                                                         | `true` or `True` selects users with at least one order; **any other value** (including `1` or `yes`) selects users without an order.                                                                        |
| `platform`                                                                                            | Exact match on `attributes.register_client_type`, the client the user registered from.                                                                                                                      |
| `date_joined`                                                                                         | Exact registration date-time in ISO 8601 (`2026-01-01T10:30:00Z`).                                                                                                                                          |
| `date_joined__gt`, `date_joined__gte`, `date_joined__lt`, `date_joined__lte`                          | Registration date and time. Accepts a date (`2026-01-01`, read as midnight UTC) or a date-time (`2026-01-01T10:30:00Z`, `2026-01-01 10:30:00`).                                                             |
| `last_login`, `last_login__gt`, `last_login__gte`, `last_login__lt`, `last_login__lte`                | Last login date-time in ISO 8601 (`2026-01-01T10:30:00Z`).                                                                                                                                                  |
| `date_of_birth`, `date_of_birth__gt`, `date_of_birth__gte`, `date_of_birth__lt`, `date_of_birth__lte` | Date of birth (`1990-05-17`).                                                                                                                                                                               |
| `modified_date`, `modified_date__gt`, `modified_date__gte`, `modified_date__lt`, `modified_date__lte` | Last modification date-time of the user record in ISO 8601 (`2026-01-01T10:30:00Z`).                                                                                                                        |
| `group` / `group__not`                                                                                | Users that are / are not members of the given group identifier.                                                                                                                                             |
| `attributes__<key>`                                                                                   | Case-insensitive substring match on a key of the user's attributes. Add `__exact` for an exact match or `__isnull=true` / `false` for key absence / presence (e.g. `?attributes__logged_ip__isnull=false`). |

* A filter parameter followed by `!` negates it (e.g. `?gender!=male`).

### Dynamic Settings & Environment Variables

No dynamic settings (`dj_dynamic_settings`) and no environment variables affect this endpoint. The row set, the aggregates, the filters, and the page size behave identically regardless of management-panel configuration.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/commerce-openapis/admin/customer-report.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
