All routes require an authenticated Medusa Admin user. Unauthenticated requests return
401.Metric keys
| Key | Unit | Description |
|---|---|---|
mrr | currency | Monthly recurring revenue |
churn_rate | percentage | Subscriber churn rate |
ltv | currency | Estimated lifetime value |
active_subscriptions_count | count | Number of active subscriptions |
MRR and LTV resolve to null when the selected dataset lacks a single valid currency context.
Shared filter parameters
All three read routes (/kpis, /trends, /export) accept the same filter parameters.
ISO datetime lower bound. Must be on or before
date_to. Maximum analytics window is 731 days.ISO datetime upper bound.
Filter by subscription status. Supported values:
active, paused, cancelled, past_due.Filter by product ID. Accepts a single value or an array.
Filter by cadence using serialized tokens such as
week:1, month:1, or year:1. Accepts a single value or an array.Time bucket granularity. One of
day, week, or month. Defaults to day.Timezone for bucket boundaries. Only
UTC is supported in MVP.GET /admin/subscription-analytics/kpis
Returns the KPI summary payload used by the Admin analytics overview cards.Response
Array of KPI summaries, one per supported metric key.
Resolved filter values used for the query.
Analytics schema version identifier.
Timestamp when the response was generated.
Response example
Errors
| Code | Error | Meaning |
|---|---|---|
400 | invalid_data | Invalid filter shape, unsupported grouping value, or invalid frequency token |
GET /admin/subscription-analytics/trends
Returns grouped time-series data for Admin analytics charts. Each series covers one metric key and contains one point per time bucket within the requested range.Response
Array of trend series, one per metric key.
Resolved filter values.
Analytics schema version identifier.
Timestamp when the response was generated.
Response example
Errors
| Code | Error | Meaning |
|---|---|---|
400 | invalid_data | Invalid filter shape, unsupported grouping value, or invalid frequency token |
GET /admin/subscription-analytics/export
Returns an export payload aligned with the active analytics filters. The export is synchronous and supportsjson and csv formats. Rows represent one entry per time bucket.
Additional query parameter
Export format. One of
json or csv. Defaults to json.Response
Resolved export format.
Resolved filter values.
Analytics schema version identifier.
Timestamp when the export was generated.
Suggested file name for the export.
MIME type for the export format.
Ordered column names for the export dataset.
Flattened export rows. Each row contains one value per column. Metric cells may be
null.Response example
Errors
| Code | Error | Meaning |
|---|---|---|
400 | invalid_data | Invalid filter shape, unsupported grouping value, unsupported export format, or invalid frequency token |
POST /admin/subscription-analytics/rebuild
Triggers a manual rebuild of daily analytics snapshots for a historical date range. Reuses the same shared workflow used by scheduled and incremental analytics jobs. Rebuild is day-level idempotent — rerunning the same range is safe.Body parameters
ISO datetime start of the rebuild range.
ISO datetime end of the rebuild range. Maximum manual rebuild window is 365 days.
Optional reason for the rebuild, recorded for audit purposes.
Request example
Response
Rebuild range start.
Rebuild range end.
Number of calendar days processed.
Total subscription records evaluated.
Snapshot rows created or updated.
Rows skipped during the rebuild.
Days that could not be processed.
Days where processing failed. Partial failure does not change the HTTP status to
500.Response example
Errors
| Code | Error | Meaning |
|---|---|---|
400 | invalid_data | Invalid request body or rebuild window exceeds 365 days |