# Subrite statistics

**Summary:** Endpoints for Subrite statistics

- Role: [Developers](https://www.subrite.no/developers)
- Source: https://www.subrite.no/developers/subrite-statistics
- Updated: 2026-10-13
- Markdown index: https://www.subrite.no/developers/llms.txt

<a id="get-api-v1-stats-stats"></a>
## Get basic stats

`GET /api/v1/stats/stats`

**Authentication:** Bearer token (JWT)

### Responses

#### 200

Content type: `application/json` · `StatsDTO`

| Name | Type | Description |
| --- | --- | --- |
| `totalActiveSubcriptions` (Required) | `number` |   |
| `totalActivePaidSubcriptions` (Required) | `number` |   |
| `totalActiveMembers` (Required) | `number` |   |
| `totalActivePaidMembers` (Required) | `number` |   |
| `totalRegisteredMembers` (Required) | `number` |   |
| `totalLoginYesterday` (Required) | `number` |   |
| `totalWaitingForActivationSubscriptions` (Required) | `number` |   |
| `totalRecurringRevenue` (Required) | `TotalRecurringRevenueDTO` |   |
| `totalRecurringRevenue.recurringMrr` (Required) | `number` |   |
| `totalRecurringRevenue.recurringArr` (Required) | `number` |   |
| `totalRecurringRevenue.estimatedMrr` (Required) | `number` |   |
| `totalRecurringRevenue.estimatedArr` (Required) | `number` |   |
| `totalChurn` (Required) | `TotalChurnDTO` |   |
| `totalChurn.totalChurn` (Required) | `number` | Can be null |
| `totalChurn.totalChurnPeriodLabel` (Required) | `string` |   |
| `totalChurn.totalChurnYear` (Required) | `number` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` |   |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "totalActiveSubcriptions": 0,
  "totalActivePaidSubcriptions": 0,
  "totalActiveMembers": 0,
  "totalActivePaidMembers": 0,
  "totalRegisteredMembers": 0,
  "totalLoginYesterday": 0,
  "totalWaitingForActivationSubscriptions": 0,
  "totalRecurringRevenue": {
    "recurringMrr": 0,
    "recurringArr": 0,
    "estimatedMrr": 0,
    "estimatedArr": 0
  },
  "totalChurn": {
    "totalChurn": 0,
    "totalChurnPeriodLabel": "string",
    "totalChurnYear": 0
  }
}
```

<a id="get-api-v1-stats-total-stats"></a>
## Get all stats for nth days

`GET /api/v1/stats/total-stats`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `days` (Required) | query | `number` |   |

### Responses

#### 200

Content type: `application/json` · `StatsForNthDaysDTO`

| Name | Type | Description |
| --- | --- | --- |
| `totalNewPaidSubscriptions` (Required) | `number` |   |
| `totalPaidRenewals` (Required) | `number` |   |
| `totalCanceledPaidSubscriptions` (Required) | `number` |   |
| `totalStoppedPaidSubscriptions` (Required) | `number` |   |
| `totalReactivatedSubscriptions` (Required) | `number` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

| Name | Type | Description |
| --- | --- | --- |
| `messageCode` (Required) | `string` | Allowed values: `"badRequest"` |
| `message` | `string` |   |
| `errors` (Required) | `array of FieldError` |   |
| `errors[].field` (Required when parent is present) | `string` |   |
| `errors[].fieldValue` (Required when parent is present) | `string` |   |
| `errors[].identifier` (Required when parent is present) | `string` |   |
| `errors[].identifierValue` (Required when parent is present) | `string` |   |
| `errors[].messageCode` (Required when parent is present) | `string` |   |
| `errors[].message` | `string` |   |
| `errors[].errorType` (Required when parent is present) | `string` |   |

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/stats/total-stats?days=%3Cdays%3E' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "totalNewPaidSubscriptions": 0,
  "totalPaidRenewals": 0,
  "totalCanceledPaidSubscriptions": 0,
  "totalStoppedPaidSubscriptions": 0,
  "totalReactivatedSubscriptions": 0
}
```

<a id="get-api-v1-stats-feeds"></a>
## Get all activity feeds for admin

`GET /api/v1/stats/feeds`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"createdAt"`, `"id"`, `"updatedAt"` · Default: `"createdAt"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |
| `filter` | query | `FilteredActivityLogAction` | Allowed values: `"initial_purchase"`, `"subscription_renewed"`, `"auto_renewal_turned_off"`, `"auto_renewal_turned_on"`, `"subscription_expired"`, `"payment_failed"`, `"subscription_deactivated"`, `"subscription_inactive"`, `"subscription_reactivated"`, `"subscription_stopped"`, `"next_renewal_updated"`, `"recurring_price_updated"`, `"activation_date_updated"`, `"subscription_activated"`, `"subscription_canceled_before_activation"`, `"update_member_profile"`, `"update_consent"`, `"login"`, `"change_initiated"`, `"change_completed"`, `"change_cancelled"`, `"seat_invitation_sent"`, `"seat_invitation_removed"`, `"seat_invitation_accepted"`, `"seat_member_added"`, `"group_owner_access_enabled"`, `"group_owner_access_disabled"`, `"seat_gift_receiver_added"`, `"seat_gift_receiver_removed"`, `"seat_gift_receiver_accepted"`, `"seat_gift_receiver_invitation_sent"`, `"invoice_sent"`, `"payment_method_updated"`, `"payment_method_removed"`, `"payment_provider_updated"`, `"invoice_address_updated"`, `"delivery_address_updated"`, `"credit_note_created"`, `"refund_registered"`, `"payment_registered"`, `"vipps_recurring_charge_initiated"`, `"ledger_matched"`, `"ledger_unmatched"`, `"ledger_transaction_ignored"`, `"signup"` |
| `exclude` | query | `string` |   |

### Responses

#### 200

Content type: `application/json` · `ActivityLogResponsePaginated`

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of ActivityLogResponse` |   |
| `items[].action` (Required when parent is present) | `ActivityLogAction` | Allowed values: `"initial_purchase"`, `"subscription_renewed"`, `"auto_renewal_turned_off"`, `"auto_renewal_turned_on"`, `"subscription_expired"`, `"payment_failed"`, `"subscription_activated"`, `"subscription_deactivated"`, `"subscription_inactive"`, `"subscription_reactivated"`, `"subscription_stopped"`, `"subscription_canceled_before_activation"`, `"activation_date_updated"`, `"next_renewal_updated"`, `"recurring_price_updated"`, `"change_initiated"`, `"change_completed"`, `"change_cancelled"`, `"seat_invitation_sent"`, `"seat_invitation_removed"`, `"seat_invitation_accepted"`, `"seat_member_added"`, `"group_owner_access_enabled"`, `"group_owner_access_disabled"`, `"seat_gift_receiver_added"`, `"seat_gift_receiver_removed"`, `"seat_gift_receiver_accepted"`, `"seat_gift_receiver_invitation_sent"`, `"invoice_sent"`, `"payment_method_updated"`, `"payment_method_removed"`, `"payment_provider_updated"`, `"invoice_address_updated"`, `"delivery_address_updated"`, `"credit_note_created"`, `"refund_registered"`, `"payment_registered"`, `"vipps_recurring_charge_initiated"`, `"ledger_matched"`, `"ledger_unmatched"`, `"ledger_transaction_ignored"`, `"update_member_profile"`, `"update_consent"`, `"login"`, `"signup"`, `"gdpr_deleted"` |
| `items[].feed` (Required when parent is present) | `object` |   |
| `items[].createdAt` (Required when parent is present) | `string (date-time)` |   |
| `items[].memberId` (Required when parent is present) | `string` |   |
| `items[].memberNumber` (Required when parent is present) | `number` |   |
| `items[].id` (Required when parent is present) | `number` |   |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/feeds \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "items": [
    {
      "feed": {}
    }
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="get-api-v1-stats-referrer-stats"></a>
## Get all sales grouped by referrer for nth days or date range

`GET /api/v1/stats/referrer-stats`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `days` | query | `number` |   |
| `dateFrom` | query | `string` |   |
| `dateTo` | query | `string` |   |
| `page` | query | `number` | Default: `1` · `minimum`: `1` |
| `take` | query | `number` | Default: `10` · `minimum`: `1`, `maximum`: `50` |
| `orderBy` | query | `string` | Allowed values: `"count"` · Default: `"count"` |
| `orderDirection` | query | `string` | Allowed values: `"asc"`, `"desc"` · Default: `"desc"` |

### Responses

#### 200

Content type: `application/json` · `ReferrerStatsDtoPaginated`

| Name | Type | Description |
| --- | --- | --- |
| `items` (Required) | `array of ReferrerStatsDto` |   |
| `items[].referrer` (Required when parent is present) | `string` |   |
| `items[].count` (Required when parent is present) | `number` |   |
| `items[].lastPurchasedAt` (Required when parent is present) | `string (date-time)` |   |
| `meta` (Required) | `PageMeta` |   |
| `meta.page` (Required) | `number` |   |
| `meta.take` (Required) | `number` |   |
| `meta.count` (Required) | `number` |   |
| `meta.pageCount` (Required) | `number` |   |
| `meta.hasPreviousPage` (Required) | `boolean` |   |
| `meta.hasNextPage` (Required) | `boolean` |   |

#### 400

Content type: `application/json` · `ErrorResponse`

badRequest

Same fields as [Get all stats for nth days (400)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-total-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "badRequest",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/referrer-stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "items": [
    {}
  ],
  "meta": {
    "page": 0,
    "take": 0,
    "count": 0,
    "pageCount": 0,
    "hasPreviousPage": true,
    "hasNextPage": true
  }
}
```

<a id="get-api-v1-stats-export-referrer-stats"></a>
## Export all sales by referrer nth days

`GET /api/v1/stats/export/referrer-stats`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `dateFrom` | query | `string (date-time)` |   |
| `dateTo` | query | `string (date-time)` |   |
| `fileFormat` | query | `string` |   |

### Responses

#### 200

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/export/referrer-stats \
  --header 'Authorization: Bearer <token>'
```

<a id="post-api-v1-stats-cron-subscription-summary"></a>
## Run subscription summary job for all tenants

`POST /api/v1/stats/cron/subscription-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

| Name | Type | Description |
| --- | --- | --- |
| `tenantIds` | `array of number` | Default: `[]` |

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/subscription-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="post-api-v1-stats-cron-product-summary"></a>
## Run product summary job for all tenants

`POST /api/v1/stats/cron/product-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/product-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="post-api-v1-stats-cron-member-summary"></a>
## Run member summary job for all tenants

`POST /api/v1/stats/cron/member-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/member-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="post-api-v1-stats-cron-subscription-activity-summary"></a>
## Run subscription activity summary job for all tenants

`POST /api/v1/stats/cron/subscription-activity-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsCronDTO`

| Name | Type | Description |
| --- | --- | --- |
| `tenantIds` | `array of number` | Default: `[]` |
| `dataDate` | `string (date-time)` |   |

**Example request body**

`application/json`

```json
{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/subscription-activity-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}'
```

<a id="post-api-v1-stats-cron-recurring-revenue"></a>
## Run recurring revenue job for all tenants

`POST /api/v1/stats/cron/recurring-revenue`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/recurring-revenue \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="post-api-v1-stats-cron-consent-activity-summary"></a>
## Run consent activity summary job for all tenants

`POST /api/v1/stats/cron/consent-activity-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsCronDTO`

Same fields as [Run subscription activity summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-activity-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/consent-activity-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}'
```

<a id="post-api-v1-stats-cron-consent-channel-activity-summary"></a>
## Run consent channel activity summary job for all tenants

`POST /api/v1/stats/cron/consent-channel-activity-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsCronDTO`

Same fields as [Run subscription activity summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-activity-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/consent-channel-activity-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}'
```

<a id="post-api-v1-stats-cron-podcast-access-summary"></a>
## Run podcast access summary job for all tenants

`POST /api/v1/stats/cron/podcast-access-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsCronDTO`

Same fields as [Run subscription activity summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-activity-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/podcast-access-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": [],
  "dataDate": "yyyy-MM-dd"
}'
```

<a id="post-api-v1-stats-cron-spotify-user-summary"></a>
## Run Spotify user summary job for all tenants

`POST /api/v1/stats/cron/spotify-user-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/spotify-user-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="get-api-v1-stats-historical-subscriptions"></a>
## Get historical subscriptions

`GET /api/v1/stats/historical-subscriptions`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `type` | query | `SubscriptionType` | Allowed values: `"all"`, `"free"`, `"paid"` |
| `groupBy` | query | `GroupByType` | Allowed values: `"subscriptionPlan"`, `"package"`, `"paymentProvider"` |
| `noOfLine` | query | `NoOfLine` | Allowed values: `3`, `4`, `5`, `7`, `100` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `data` (Required) | `array of HistoricalStatsData` |   |
| `data[].label` (Required when parent is present) | `number` |   |
| `data[].entities` (Required when parent is present) | `array of StatsGraphData` |   |
| `data[].entities[].id` (Required when parent is present) | `number` |   |
| `data[].entities[].name` (Required when parent is present) | `string` |   |
| `data[].entities[].count` (Required when parent is present) | `number` |   |
| `data[].entities[].additionalData` | `number` |   |
| `data[].year` (Required when parent is present) | `number` |   |
| `period` (Required) | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-subscriptions \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-historical-products"></a>
## Get historical products

`GET /api/v1/stats/historical-products`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `type` | query | `ProductType` | Allowed values: `"all"`, `"free"`, `"paid"` |
| `noOfLine` | query | `NoOfLine` | Allowed values: `3`, `4`, `5`, `7`, `100` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-products \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-historical-members"></a>
## Get historical members

`GET /api/v1/stats/historical-members`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `type` | query | `MemberType` | Allowed values: `"all"`, `"paid"` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-members \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-historical-current-revenue"></a>
## Get estimated revenue: measured up to the current period, projected after it

`GET /api/v1/stats/historical-current-revenue`

Each bucket carries two series — recurring (auto-renew on) and expiring (auto-renew off). Buckets after the current period are projected from active subscriptions and capped 12 months ahead. Every bucket carries the same shape whether it was measured or projected — the split point is the current period — and the plan and package options for the graph filter are served separately by /current-revenue-filter-options.

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `estimation` | query | `RevenuePeriod` | Allowed values: `"monthly"`, `"quarterly"`, `"yearly"` |
| `period` | query | `TimelineGranularity` | Bucket granularity. Daily is not accepted here: this graph projects forward, and a per-day projection would walk up to 365 generate\_series buckets across every active subscription — and carries no meaning at that resolution. · Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. May be in the future — periods after the current one are projected from active subscriptions, capped at 12 months ahead. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `subscriptionPlanId` | query | `number` | Limit the graph to a single subscription plan. Omit for all plans. · `minimum`: `1` |
| `packageId` | query | `number` | Limit the graph to a single product package. Omit for all packages. · `minimum`: `1` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-current-revenue \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-current-revenue-filter-options"></a>
## Get plan and package options for the estimated-revenue graph filter

`GET /api/v1/stats/current-revenue-filter-options`

All-time options, independent of the graph window. The two lists co-filter each other from the selection passed in: subscriptionPlanId narrows the packages to those observed with that plan, packageId narrows the plans the same way, and neither list is narrowed by its own selection — so every option offered draws a chart with data in it, and the current choice can always be changed. Pass the graph filter as it stands and re-fetch when it changes; omit both for every option the tenant has. The pairs come from the snapshots the graph itself renders, so a package that has carried several plans over its life keeps all of them. Served under the dashboard permission so an admin without plans-and-products access can still filter the graph. Not paged, because each list fills one dropdown: at most 500 plans and the same number of packages are returned, so a tenant with a very long product history cannot produce an unbounded response. Both lists are ordered by revenue in the most recent snapshot, largest first, with name breaking ties; options no longer sold rank last.

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `subscriptionPlanId` | query | `number` | The plan currently selected in the graph filter. Narrows the package options to the packages observed with that plan; the plan options themselves stay complete. · `minimum`: `1` |
| `packageId` | query | `number` | The package currently selected in the graph filter. Narrows the plan options to the plans observed with that package; the package options themselves stay complete. · `minimum`: `1` |

### Responses

#### 200

Content type: `application/json` · `CurrentRevenueFilterOptionsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `availablePlans` (Required) | `array of RevenueFilterOption` | Subscription plans available to filter, largest current revenue first, at most 500 |
| `availablePlans[].id` (Required when parent is present) | `number` |   |
| `availablePlans[].name` (Required when parent is present) | `string` |   |
| `availablePackages` (Required) | `array of RevenueFilterOption` | Product packages available to filter, largest current revenue first, at most 500 |
| `availablePackages[].id` (Required when parent is present) | `number` |   |
| `availablePackages[].name` (Required when parent is present) | `string` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/current-revenue-filter-options \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "availablePlans": [
    {}
  ],
  "availablePackages": [
    {}
  ]
}
```

<a id="get-api-v1-stats-timeline-extent"></a>
## Get the earliest available data date for a stats graph timeline

`GET /api/v1/stats/timeline-extent`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `graph` (Required) | query | `TimelineGraph` | Which stats graph to report the earliest available data date for. · Allowed values: `"subscriptions"`, `"currentRevenue"`, `"members"`, `"products"`, `"consents"`, `"consentChanges"`, `"consentSource"`, `"subscriptionActivity"`, `"podcastUsers"` |

### Responses

#### 200

Content type: `application/json` · `TimelineExtentResDto`

| Name | Type | Description |
| --- | --- | --- |
| `earliestDate` | `string` | Earliest date (yyyy-MM-dd) for which this graph has data, or null when the graph has no data yet. · Can be null |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl 'https://api.subrite.no/api/v1/stats/timeline-extent?graph=subscriptions' \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "earliestDate": "2021-03-15"
}
```

<a id="get-api-v1-stats-historical-subscriptions-activity"></a>
## Get qty of historical new/stopped subscriptions

`GET /api/v1/stats/historical-subscriptions-activity`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-subscriptions-activity \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-historical-churn-rates"></a>
## Get qty of historical churn rates

`GET /api/v1/stats/historical-churn-rates`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `DataSelectionPeriod` | Allowed values: `"weekly"`, `"monthly"` |
| `type` | query | `ChurnType` | Allowed values: `"gross"`, `"net"` |
| `groupBy` | query | `GroupByType` | Allowed values: `"subscriptionPlan"`, `"package"`, `"paymentProvider"` |
| `subscriptionType` | query | `SubscriptionType` | Allowed values: `"all"`, `"free"`, `"paid"` |
| `noOfLine` | query | `NoOfLine` | Allowed values: `3`, `4`, `5`, `7`, `100` |

### Responses

#### 200

Content type: `application/json` · `HistoricalChurnRateResDto`

| Name | Type | Description |
| --- | --- | --- |
| `detailsChurn` (Required) | `HistoricalStatsResDto` |   |
| `detailsChurn.data` (Required) | `array of HistoricalStatsData` |   |
| `detailsChurn.data[].label` (Required when parent is present) | `number` |   |
| `detailsChurn.data[].entities` (Required when parent is present) | `array of StatsGraphData` | Nested fields omitted: depth limit. |
| `detailsChurn.data[].year` (Required when parent is present) | `number` |   |
| `detailsChurn.period` (Required) | `DataSelectionPeriod` | Allowed values: `"weekly"`, `"monthly"` |
| `totalChurn` (Required) | `HistoricalStatsResDto` |   |
| `totalChurn.data` (Required) | `array of HistoricalStatsData` |   |
| `totalChurn.data[].label` (Required when parent is present) | `number` |   |
| `totalChurn.data[].entities` (Required when parent is present) | `array of StatsGraphData` | Nested fields omitted: depth limit. |
| `totalChurn.data[].year` (Required when parent is present) | `number` |   |
| `totalChurn.period` (Required) | `DataSelectionPeriod` | Allowed values: `"weekly"`, `"monthly"` |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-churn-rates \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "detailsChurn": {
    "data": [],
    "period": "weekly"
  },
  "totalChurn": {
    "data": [],
    "period": "weekly"
  }
}
```

<a id="get-api-v1-stats-historical-consent-activity"></a>
## Get qty of historical new/stopped consents

`GET /api/v1/stats/historical-consent-activity`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `consentIds` | query | `array of number` | Array of consent IDs to filter by |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-consent-activity \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-historical-consent-summary"></a>
## Get qty of historical new/stopped consents

`GET /api/v1/stats/historical-consent-summary`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `status` | query | `MemberConsentStatus` | Allowed values: `"accepted"`, `"withdrawn"` |
| `noOfLine` | query | `NoOfLine` | Allowed values: `3`, `4`, `5`, `7`, `100` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-consent-summary \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-historical-consent-channel-summary"></a>
## Get historical consent channel summary

`GET /api/v1/stats/historical-consent-channel-summary`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `type` | query | `MemberConsentStatus` | Allowed values: `"accepted"`, `"withdrawn"` |
| `consentIds` | query | `array of number` | Array of consent IDs to filter by |
| `noOfLine` | query | `NoOfLine` | Allowed values: `3`, `4`, `5`, `7`, `100` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/historical-consent-channel-summary \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-subscription-ended-by-reason"></a>
## Get subscription ended by reason (stop by user, user did not pay, stop by admin)

`GET /api/v1/stats/subscription-ended-by-reason`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `filter` | query | `SubscriptionEndedFilter` | Allowed values: `"yesterday"`, `"last_7_days"`, `"last_30_days"`, `"last_year"` |

### Responses

#### 200

Content type: `application/json` · `SubscriptionEndedByReasonResDto`

| Name | Type | Description |
| --- | --- | --- |
| `data` (Required) | `array of SubscriptionEndedByReasonData` |   |
| `data[].reason` (Required when parent is present) | `string` |   |
| `data[].quantity` (Required when parent is present) | `number` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/subscription-ended-by-reason \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {}
  ]
}
```

<a id="get-api-v1-stats-payment-method-stats"></a>
## Get payment method statistics (quantity or share and churn rate)

`GET /api/v1/stats/payment-method-stats`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `viewType` | query | `PaymentMethodViewType` | Allowed values: `"quantity"`, `"share_and_churn"` |

### Responses

#### 200

Content type: `application/json` · `PaymentMethodStatsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `data` (Required) | `array of PaymentMethodData` |   |
| `data[].paymentProvider` (Required when parent is present) | `string` |   |
| `data[].quantity` (Required when parent is present) | `number` |   |
| `data[].share` | `number` |   |
| `data[].churnRate` | `number` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/payment-method-stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {}
  ]
}
```

<a id="get-api-v1-stats-podcast-users-summary"></a>
## Get podcast users summary (Spotify + other apps, stacked)

`GET /api/v1/stats/podcast-users-summary`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `period` | query | `TimelineGranularity` | Allowed values: `"daily"`, `"weekly"`, `"monthly"`, `"quarterly"`, `"yearly"` |
| `fromDate` | query | `string` | Start of custom date range (yyyy-MM-dd). Requires toDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `toDate` | query | `string` | End of custom date range (yyyy-MM-dd). Requires fromDate. · `pattern`: `/^\d{4}-\d{2}-\d{2}$/` |
| `subscriptionStatus` | query | `SUBSCRIPTION_STATUS` | Allowed values: `"all"`, `"active"` |

### Responses

#### 200

Content type: `application/json` · `HistoricalTimelineStatsResDto`

Same fields as [Get historical subscriptions (200)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-historical-subscriptions).

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/podcast-users-summary \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "data": [
    {
      "entities": []
    }
  ],
  "period": "daily"
}
```

<a id="get-api-v1-stats-podcast-download-stats"></a>
## Get podcast download statistics

`GET /api/v1/stats/podcast-download-stats`

Returns download counts for 1 day, 7 days, 30 days, all time, hourly breakdown, and episode breakdown

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `date` | query | `string` | Specific date to get stats for (defaults to today) |
| `podcastId` | query | `number` | Filter by specific podcast ID |
| `fromDate` | query | `string` | Date range start for time-series chart |
| `toDate` | query | `string` | Date range end for time-series chart |
| `period` | query | `string` | Aggregation period for time-series chart · Allowed values: `"daily"`, `"weekly"`, `"monthly"` · Default: `"daily"` |
| `episodeId` | query | `string` | Filter by specific episode ID |

### Responses

#### 200

Content type: `application/json` · `PodcastDownloadStatsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `summary` (Required) | `SummaryCardsDto` | Summary statistics |
| `summary.last1Day` (Required) | `number` | Downloads in the last 24 hours |
| `summary.last7Days` (Required) | `number` | Downloads in the last 7 days |
| `summary.last30Days` (Required) | `number` | Downloads in the last 30 days |
| `summary.allTime` (Required) | `number` | All time downloads |
| `todayHourlyDownloads` (Required) | `array of HourlyDownloadDto` | Hourly downloads for today |
| `todayHourlyDownloads[].hour` (Required when parent is present) | `number` | Hour of day (0-23) |
| `todayHourlyDownloads[].count` (Required when parent is present) | `number` | Download count for this hour |
| `episodeTable` (Required) | `array of EpisodeDownloadDto` | Episode breakdown (based on fromDate/toDate if provided, otherwise last 30 days) |
| `episodeTable[].episodeId` (Required when parent is present) | `string` | Episode ID (hash from Signal) |
| `episodeTable[].episodeName` | `string` | Episode name from RSS feed |
| `episodeTable[].podcastId` (Required when parent is present) | `string` | Podcast ID |
| `episodeTable[].podcastName` | `string` | Podcast name |
| `episodeTable[].publishedDate` | `string (date-time)` | Episode published date from RSS feed |
| `episodeTable[].totalDownloads` (Required when parent is present) | `number` | Total downloads for this episode |
| `episodeTable[].percentageOfTotal` (Required when parent is present) | `number` | Percentage of total downloads |
| `timeSeriesData` (Required) | `array of TimeSeriesDataPointDto` | Time-series data for chart (based on fromDate, toDate, period parameters) |
| `timeSeriesData[].date` (Required when parent is present) | `string` | Date or period identifier (ISO date, YYYY-WW, or YYYY-MM) |
| `timeSeriesData[].count` (Required when parent is present) | `number` | Download count for this period |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/podcast-download-stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "summary": {
    "last1Day": 0,
    "last7Days": 0,
    "last30Days": 0,
    "allTime": 0
  },
  "todayHourlyDownloads": [
    {}
  ],
  "episodeTable": [
    {}
  ],
  "timeSeriesData": [
    {}
  ]
}
```

<a id="post-api-v1-stats-cron-podcast-download-summary"></a>
## Run podcast download summary job for all tenants

`POST /api/v1/stats/cron/podcast-download-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/podcast-download-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="post-api-v1-stats-backfill-podcast-download-summary"></a>
## Re-aggregate podcast download summaries for a tenant over a UTC day range

`POST /api/v1/stats/backfill/podcast-download-summary`

Re-runs the hourly aggregation with the current deduplication logic and overwrites existing hourly counts. Use to repair historical rows (e.g. inflated counts). Does not move the regular hourly cron checkpoint.

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `PodcastDownloadBackfillDTO`

| Name | Type | Description |
| --- | --- | --- |
| `tenantId` (Required) | `number` | Tenant to re-aggregate |
| `fromDate` (Required) | `string` | First UTC day to re-aggregate (inclusive) |
| `toDate` (Required) | `string` | Last UTC day to re-aggregate (inclusive) |

**Example request body**

`application/json`

```json
{
  "tenantId": 32,
  "fromDate": "2026-05-20",
  "toDate": "2026-05-21"
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/backfill/podcast-download-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantId": 32,
  "fromDate": "2026-05-20",
  "toDate": "2026-05-21"
}'
```

<a id="get-api-v1-stats-checkout-funnel-stats"></a>
## Get checkout funnel statistics

`GET /api/v1/stats/checkout-funnel-stats`

Returns funnel stage counts, conversion rates, and comparison data for checkout flow

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `fromDate` | query | `string` | Date range start |
| `toDate` | query | `string` | Date range end |
| `packageSlug` | query | `string` | Filter by single package slug |
| `paymentMethod` | query | `string` | Filter by single payment method |
| `packageSlugs` | query | `array of string` | Package slugs to compare (max 3) · `maxItems`: `3` |
| `paymentMethods` | query | `array of string` | Payment methods to compare (max 3) · `maxItems`: `3` |
| `viewMode` | query | `string` | View mode · Allowed values: `"single"`, `"compare-packages"`, `"compare-payments"` · Default: `"single"` |

### Responses

#### 200

Content type: `application/json` · `CheckoutFunnelStatsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `funnels` (Required) | `array of FunnelDataDto` | Funnel data sets |
| `funnels[].id` (Required when parent is present) | `string` | Identifier (e.g., "all", package slug, payment method) |
| `funnels[].name` (Required when parent is present) | `string` | Display name |
| `funnels[].stages` (Required when parent is present) | `array of FunnelStageDto` | Funnel stages |
| `funnels[].stages[].name` (Required when parent is present) | `string` | Funnel stage name |
| `funnels[].stages[].count` (Required when parent is present) | `number` | Event count for this stage |
| `funnels[].stages[].percentage` (Required when parent is present) | `number` | Percentage relative to the first stage (checkout\_loaded) |
| `funnels[].stages[].drop` | `number` | Drop-off count from previous stage |
| `funnels[].stages[].dropPercent` | `number` | Drop-off percentage from previous stage |
| `funnels[].conversionRate` (Required when parent is present) | `number` | Overall conversion rate (purchases / checkout loaded) as percentage |
| `funnels[].previousConversionRate` | `number` | Previous period conversion rate |
| `funnels[].change` | `number` | Change vs previous period (percentage points) |
| `availablePackages` (Required) | `array of string` | Available package slugs for filtering |
| `availablePaymentMethods` (Required) | `array of string` | Available payment methods for filtering |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/checkout-funnel-stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "funnels": [
    {
      "stages": []
    }
  ],
  "availablePackages": [
    "string"
  ],
  "availablePaymentMethods": [
    "string"
  ]
}
```

<a id="post-api-v1-stats-cron-checkout-funnel-summary"></a>
## Run checkout funnel summary job for all tenants

`POST /api/v1/stats/cron/checkout-funnel-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/checkout-funnel-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="get-api-v1-stats-customer-economics"></a>
## Get customer economics

`GET /api/v1/stats/customer-economics`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `date` | query | `string (date-time)` | Optional date parameter |

### Responses

#### 200

Content type: `application/json` · `CustomerEconomicsResponseDTO`

| Name | Type | Description |
| --- | --- | --- |
| `arpu` (Required) | `number` |   |
| `churn3m` (Required) | `number` |   |
| `lifetimeValue` (Required) | `number` |   |
| `lifetimeLength` (Required) | `number` |   |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/customer-economics \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "arpu": 0,
  "churn3m": 0,
  "lifetimeValue": 0,
  "lifetimeLength": 0
}
```

<a id="get-api-v1-stats-accumulated-payment-flow"></a>
## Get accumulated payment cash flow by day

`GET /api/v1/stats/accumulated-payment-flow`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `year` | query | `number` | Year to query (optional, defaults to current year) · `minimum`: `2000`, `maximum`: `2100` |
| `month` | query | `number` | Month to query (1-12, optional, defaults to current month) · `minimum`: `1`, `maximum`: `12` |

### Responses

#### 200

Content type: `application/json` · `PaymentFlowResDto`

| Name | Type | Description |
| --- | --- | --- |
| `currentMonth` (Required) | `MonthlyPaymentFlowData` | Current month payment flow data |
| `currentMonth.year` (Required) | `number` | Year |
| `currentMonth.month` (Required) | `number` | Month (1-12) |
| `currentMonth.days` (Required) | `array of DailyPaymentData` | Daily accumulated payment data |
| `currentMonth.days[].day` (Required when parent is present) | `number` | Day of the month |
| `currentMonth.days[].accumulatedAmount` (Required when parent is present) | `number` | Accumulated payment amount up to this day |
| `previousMonth` (Required) | `MonthlyPaymentFlowData` | Previous month payment flow data |
| `previousMonth.year` (Required) | `number` | Year |
| `previousMonth.month` (Required) | `number` | Month (1-12) |
| `previousMonth.days` (Required) | `array of DailyPaymentData` | Daily accumulated payment data |
| `previousMonth.days[].day` (Required when parent is present) | `number` | Day of the month |
| `previousMonth.days[].accumulatedAmount` (Required when parent is present) | `number` | Accumulated payment amount up to this day |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/accumulated-payment-flow \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "currentMonth": {
    "year": 2024,
    "month": 12,
    "days": []
  },
  "previousMonth": {
    "year": 2024,
    "month": 12,
    "days": []
  }
}
```

<a id="get-api-v1-stats-logged-in-user-stats"></a>
## Get logged-in user statistics for a date range

`GET /api/v1/stats/logged-in-user-stats`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `fromDate` | query | `string` | Date range start |
| `toDate` | query | `string` | Date range end |

### Responses

#### 200

Content type: `application/json` · `LoggedInUserStatsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `totalLoggedIn` (Required) | `number` | Total unique logged-in users for the period |
| `withSubscription` (Required) | `number` | Unique logged-in users with active subscription |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/logged-in-user-stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "totalLoggedIn": 0,
  "withSubscription": 0
}
```

<a id="post-api-v1-stats-cron-logged-in-users-summary"></a>
## Run logged-in users summary job for all tenants

`POST /api/v1/stats/cron/logged-in-users-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/logged-in-users-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```

<a id="get-api-v1-stats-content-type-visit-stats"></a>
## Get content type visit statistics for a date range

`GET /api/v1/stats/content-type-visit-stats`

**Authentication:** Bearer token (JWT)

### Parameters

| Name | In | Type | Description |
| --- | --- | --- | --- |
| `fromDate` | query | `string` | Date range start |
| `toDate` | query | `string` | Date range end |

### Responses

#### 200

Content type: `application/json` · `ContentTypeVisitStatsResDto`

| Name | Type | Description |
| --- | --- | --- |
| `dataPoints` (Required) | `array of ContentTypeVisitDataPointDto` | Data points per date per content type |
| `dataPoints[].date` (Required when parent is present) | `string` | Date in YYYY-MM-DD format |
| `dataPoints[].contentType` (Required when parent is present) | `string` | Content type (website, podcast, mypage) |
| `dataPoints[].deviceType` (Required when parent is present) | `string` | Device type (desktop, mobile, or empty string) |
| `dataPoints[].count` (Required when parent is present) | `number` | Unique visit count |

#### 401

unauthorized

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/content-type-visit-stats \
  --header 'Authorization: Bearer <token>'
```

### Example response

200 · `application/json`

```json
{
  "dataPoints": [
    {}
  ]
}
```

<a id="post-api-v1-stats-cron-content-type-visit-summary"></a>
## Run content type visit summary job for all tenants

`POST /api/v1/stats/cron/content-type-visit-summary`

**Authentication:** Bearer token (JWT)

### Request body

Content type: `application/json` · Required · `StatsTenantIdsDTO`

Same fields as [Run subscription summary job for all tenants (Request body)](https://www.subrite.no/developers/subrite-statistics?md=true#post-api-v1-stats-cron-subscription-summary).

**Example request body**

`application/json`

```json
{
  "tenantIds": []
}
```

### Responses

#### 201

#### 401

Content type: `application/json` · `ErrorResponse`

unauthorized

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

**Example response**

`application/json`

```json
{
  "messageCode": "string",
  "message": "string",
  "errors": [
    {}
  ]
}
```

#### 403

Content type: `application/json` · `ErrorResponse`

forbiddenResource

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

#### 500

Content type: `application/json` · `ErrorResponse`

internalServerError

Same fields as [Get basic stats (403)](https://www.subrite.no/developers/subrite-statistics?md=true#get-api-v1-stats-stats).

### Example request

```bash
curl https://api.subrite.no/api/v1/stats/cron/content-type-visit-summary \
  --request POST \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "tenantIds": []
}'
```
