> For the complete documentation index, see [llms.txt](https://docs.moderncollections.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.moderncollections.io/rest-api/analytics.md).

# Analytics

The Analytics API exposes aggregates for the authenticated creditor's own placements. All numbers are scoped to that creditor — there is no cross-tenant analytics surface.

## Endpoints

| Method | Path                                | Purpose                                                                                                            |
| ------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `GET`  | `/v1/analytics/summary`             | One-shot KPI snapshot (counts and amounts).                                                                        |
| `GET`  | `/v1/analytics/recovered-daily`     | Daily recovered amount + cumulative series. Query: `days` (1..180, default 30).                                    |
| `GET`  | `/v1/analytics/status-distribution` | Placement count per status.                                                                                        |
| `GET`  | `/v1/analytics/call-heatmap`        | 7×24 weekday-by-hour call attempt counts. Query: `days` (1..60, default 14).                                       |
| `GET`  | `/v1/analytics/top-debtors`         | Highest-outstanding debtors. Query: `limit` (1..50, default 10).                                                   |
| `GET`  | `/v1/analytics/days-to-payment`     | Histogram of days between placement and resolution for paid accounts, bucketed `0-7 / 8-14 / 15-30 / 31-60 / 60+`. |
| `GET`  | `/v1/analytics/email-funnel`        | Email funnel (total / sent / opened / replied / bounced). Query: `days` (1..180, default 30).                      |

The endpoints `recovery-rate`, `aging`, and `cost-per-recovery` documented previously are **not** implemented today.

## `/v1/analytics/summary` response

```json
{
  "total_placed": 142,
  "in_outreach": 98,
  "disputed": 4,
  "recovered": 18,
  "closed_uncollected": 22,
  "closed_total": 41,
  "total_placed_amount": 710000.00,
  "total_recovered_amount": 92500.00,
  "total_fees_earned": 4625.00,
  "recovery_rate": 0.127,
  "average_days_to_recovery": 14.3
}
```

`closed_total` rolls `closed_uncollected`, `recalled`, `resolved`, `resolved_out_of_band`, and `withdrawn_by_creditor` into one bucket so the dashboard doesn't silently lose out-of-band placements as new resolution statuses are added.

`recovery_rate` is rounded to 3 decimals; `average_days_to_recovery` is rounded to 1 decimal (or `null` when there have been no paid placements).

This endpoint is documented here because it is the only analytics endpoint that returns a static KPI snapshot.

## `/v1/analytics/recovered-daily` response

```json
{
  "series": [
    {"day": "2026-04-13", "amount": 0.0, "cumulative": 92500.0},
    {"day": "2026-04-14", "amount": 1500.0, "cumulative": 94000.0}
  ]
}
```

Missing days are backfilled with `amount: 0` and a running `cumulative` so the chart doesn't jump.

## `/v1/analytics/status-distribution` response

```json
{
  "buckets": [
    {"status": "in_outreach", "count": 98},
    {"status": "paid", "count": 18}
  ]
}
```

## `/v1/analytics/top-debtors` response

```json
{
  "debtors": [
    {
      "id": "<uuid>",
      "company_name": "Acme Inc.",
      "outstanding": 32500.00,
      "placement_count": 4
    }
  ]
}
```

Includes only placements with status in {`in_outreach`, `pending_payment`, `disputed`, `ready`}.

## What is NOT exposed

* **Cross-tenant benchmarks.** Per-creditor only.
* **Per-debtor analytics rollup endpoints.** Surface them in your own UI by joining results from `GET /v1/placements` with the `top-debtors` aggregate.
* **Cost-per-placement detail.** Costs are tracked internally in `cost_logs`; no partner-facing endpoint surfaces them today.

## Cache semantics

Analytics endpoints are recomputed on every request from the live database — there is no read-through cache layer today.

## See also

* [Webhooks: payment.commitment\_made](/webhooks/events/payment.commitment_made.md)
* [Guides: reconcile payments back to accounting](/integration-guides/reconcile-payments-back-to-accounting.md)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.moderncollections.io/rest-api/analytics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
