> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rxscale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Statistics

> Organisation-wide dashboard and per-doctor statistics via the Management API

# Statistics

Read the same aggregate statistics your organisation's Admin Tool dashboard shows: order and
prescription volume, pharmacy order breakdowns, questionnaire submissions, and per-doctor
prescription counts.

> [!NOTE]
>
> Per-doctor statistics for a **single** doctor (`GET /doctors/{doctor_uid}/statistics`,
> permission `doctor_statistics:read`) are documented on the [Doctors](/api-reference/management/doctors#get-doctor-statistics)
> page. Questionnaire submission statistics (`GET /questionnaires/{questionnaire_uid}/statistics/submissions`)
> are documented on the [Questionnaires](/api-reference/management/questionnaires#questionnaire-submission-statistics)
> page. CSV exports of statistics are not available through this API.

## Dashboard Statistics

```bash theme={null}
GET /v1/management/statistics/dashboard
```

Returns the same aggregate statistics shown on the Admin Tool dashboard, covering the last 30
days: order and prescription counts per day and per status, pharmacy orders per pharmacy,
questionnaire submissions, doctor and product counts, and 30-day development metrics for
orders, prescriptions, anamnesis submissions, wallet passes, and patients.

**Required permission:** `statistics:read`

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/v1/management/statistics/dashboard" \
  -H "X-API-Key: your-api-key-here"
```

### Response

```json theme={null}
{
  "orders_per_day": {
    "20679": 4,
    "20680": 7,
    "20681": 2
  },
  "prescriptions_per_day": {
    "20679": 3,
    "20680": 6
  },
  "prescriptions_per_status": {
    "signed": 42,
    "waiting for doctor": 3,
    "declined": 1
  },
  "orders_per_status": {
    "completed": 38,
    "waiting for pharmacy": 5
  },
  "pharmacy_orders_per_pharmacy": {
    "ph-xyz789": {
      "display_name": "Musterapotheke",
      "statuses": {
        "in-progress": 12,
        "completed": 30
      }
    }
  },
  "submissions_per_questionnaire": {
    "questionnaires": {
      "quest-abc123": {
        "identifier": "weight-loss-intake",
        "count": 18
      }
    },
    "total": 18
  },
  "doctor_count": 5,
  "product_count": 42,
  "order_development": {
    "current_count": 45,
    "previous_count": 38,
    "development_percent": 18.42,
    "development_absolute": 7
  },
  "prescription_development": {
    "current_count": 46,
    "previous_count": 40,
    "development_percent": 15.0,
    "development_absolute": 6
  },
  "anamnesis_development": {
    "current_count": 20,
    "previous_count": 17,
    "development_percent": 17.65,
    "development_absolute": 3
  },
  "wallet_passes": {
    "total": 120,
    "current_count": 12,
    "previous_count": 9,
    "development_percent": 33.33,
    "development_absolute": 3
  },
  "patients": {
    "total": 310,
    "current_count": 25,
    "previous_count": 21,
    "development_percent": 19.05,
    "development_absolute": 4
  }
}
```

### Response Fields

| Field | Type | Description |
| - | - | - |
| `orders_per_day` | object | Order counts for the last 30 days, keyed by **day bucket** (see note below) |
| `prescriptions_per_day` | object | Prescription counts for the last 30 days, keyed by day bucket |
| `prescriptions_per_status` | object | Prescription counts grouped by status |
| `orders_per_status` | object | Order counts grouped by status |
| `pharmacy_orders_per_pharmacy` | object | Pharmacy order counts, keyed by pharmacy UID |
| `pharmacy_orders_per_pharmacy[].display_name` | string | Pharmacy display name |
| `pharmacy_orders_per_pharmacy[].statuses` | object | Pharmacy order counts grouped by status |
| `submissions_per_questionnaire.questionnaires` | object | Submission counts for the last 30 days, keyed by questionnaire UID |
| `submissions_per_questionnaire.questionnaires[].identifier` | string | Questionnaire identifier |
| `submissions_per_questionnaire.questionnaires[].count` | integer | Submissions in the last 30 days |
| `submissions_per_questionnaire.total` | integer | Total submissions across all questionnaires |
| `doctor_count` | integer | Total doctors in the organisation |
| `product_count` | integer | Total products in the organisation |
| `order_development`, `prescription_development`, `anamnesis_development` | object | Current vs. previous 30-day period — see below |
| `wallet_passes`, `patients` | object | Same shape as above, plus a cumulative `total` |

> [!NOTE]
>
> Status keys in `orders_per_status` are the literal status strings from
> [Order Statuses](/help-center/order-statuses); keys in
> `pharmacy_orders_per_pharmacy[].statuses` are from
> [Pharmacy Order Statuses](/help-center/pharmacy-order-statuses). Keys in
> `prescriptions_per_status` are the literal `PrescriptionStatus` values —
> `waiting for doctor`, `approved`, `signed`, `declined`, `cancelled`, `ON_HOLD`,
> `NON_QES_SIGNED`, `EXTERNALLY_SIGNED` — see [Prescription Statuses](/help-center/prescription-statuses)
> for what each one means. In every case, only statuses with at least one matching record in
> the window appear.

> [!NOTE]
>
> `orders_per_day` and `prescriptions_per_day` are keyed by **day bucket**: the Unix
> timestamp divided by `86400` (seconds per day), as an integer. To convert a bucket back to
> a calendar date, multiply it by `86400` to get the Unix timestamp for midnight UTC of that
> day (e.g. bucket `20680` → `20680 * 86400 = 1786752000` → `2026-08-15T00:00:00Z`).

> [!NOTE]
>
> Each development object reports `current_count` (last 30 days), `previous_count` (the 30
> days before that), `development_absolute` (the difference), and `development_percent` (the
> percent change, `null` when `previous_count` is `0`). `wallet_passes` and `patients` also
> include a cumulative `total` across all time.

### Error Responses

| Status Code | Description |
| - | - |
| `401` | Missing or invalid credentials |
| `403` | Valid credentials, but missing `statistics:read` |

## All-Doctors Statistics

```bash theme={null}
GET /v1/management/statistics/doctors
```

Returns paginated prescription statistics for **every** doctor in the organisation, keyed by
doctor UID. To get statistics for a single doctor, use [`GET /doctors/{doctor_uid}/statistics`](/api-reference/management/doctors#get-doctor-statistics)
instead.

**start\_seconds** `integer`

Start of the date range (Unix timestamp). Defaults to 30 days ago.

**end\_seconds** `integer`

End of the date range (Unix timestamp). Defaults to now.

**page** `integer` (default: 0)

Page number (0-indexed)

**limit** `integer` (default: 50)

Number of doctors per page

**Required permission:** `statistics:read`

### Example Request

```bash theme={null}
curl -X GET "https://api.rxscale.com/v1/management/statistics/doctors?start_seconds=1784160000&end_seconds=1786752000&limit=25" \
  -H "X-API-Key: your-api-key-here"
```

### Response

```json theme={null}
{
  "data": {
    "doc-abc123": {
      "display_name": "Dr. Schmidt",
      "email": "schmidt@example.com",
      "statistics": {
        "approved": 42,
        "waiting for doctor": 3
      }
    },
    "doc-def456": {
      "display_name": "Dr. Meier",
      "email": "meier@example.com",
      "statistics": {}
    }
  },
  "totalRegistries": 2,
  "totalPages": 1
}
```

### Response Fields

| Field | Type | Description |
| - | - | - |
| `data` | object | Per-doctor statistics, keyed by doctor UID |
| `data[].display_name` | string | Doctor display name |
| `data[].email` | string | Doctor email |
| `data[].statistics` | object | Prescription counts grouped by status. `{}` for a doctor with no prescriptions in the window |
| `totalRegistries` | integer | Total number of doctors in the organisation |
| `totalPages` | integer | Total number of pages for the given limit |

> [!NOTE]
>
> The analytics window is capped: a `start_seconds` further back than 30 days before `end_seconds`
> is clamped to that maximum, so requesting `start_seconds=0` does not scan every prescription
> ever created.

### Error Responses

| Status Code | Description |
| - | - |
| `401` | Missing or invalid credentials |
| `403` | Valid credentials, but missing `statistics:read` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.