---
title: "App-access retention cohorts (weekly)"
method: GET
path: "/api/analytics/retention"
tags: ["analytics"]
---

# App-access retention cohorts (weekly)

`GET /api/analytics/retention`

Weekly registration-cohort retention: for each registration week, the share of patients active (app accesses) in each subsequent week. Coordinator role sees only patients under their supervisors.

## Query parameters

- `granularity` string — Cohort granularity: week or month.
- `from_date` string, date, nullable — Registration cohort start (YYYY-MM-DD). Defaults to 180 days ago.
- `to_date` string, date, nullable — Registration cohort end (YYYY-MM-DD). Defaults to today.
- `target_statuses` string, nullable — Comma-separated status keys (e.g. attivo,mai pagato). Empty for all.

## Response `200`

Successful Response

- RetentionResponse — Registration-cohort retention matrix (app accesses), by week or month.
  - `granularity` string, required — Cohort granularity: week or month
  - `tracking_start` string, date, nullable — Earliest day with tracked access data. Cells whose period is before this have no data (render as n/d, not 0%).
  - `cohorts` RetentionCohortRow[] — Cohorts, oldest first
    - `cohort_start` string, date, required — Registration period from_date (week Monday, or month first day)
    - `cohort_size` integer, required — Patients registered in this period
    - `cells` RetentionCohortCell[] — Retention per period offset, ascending
      - `period_offset` integer, required — Periods (weeks or months) since registration (0 = registration period)
      - `active` integer, required — Cohort patients active in this period
      - `pct` number, required — Active over cohort size (0-100)

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/corabea/apis/corabea-api.md) · [All operations](https://skmtc.dev/corabea/apis/corabea-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/corabea/corabea-api/revisions/13c1bce1bdc4/schema)
