# Retrieve journey statistics

`GET /v1/journeys/{id}/stats`

Requires an API key with the `journeys:read` scope. [About keys and scopes](/docs/api/authentication)

Entry, completion and exit counters for one journey.

## Path parameters

- `id` (string, required, uuid)

## Query parameters

- `startDate` (string, optional, date) — First day, inclusive, in the workspace timezone. Give with `endDate`.
- `endDate` (string, optional, date) — Last day, inclusive, no later than today. Give with `startDate`; a window is at most 366 days. Omit both for the last 30 days.

## Returns

Returns `200 OK` with a `JourneyStats` in `data`. Otherwise returns an error; [Errors](/docs/api/errors) lists every code and which to retry.

- `enrolled` (integer, required, min 0, max 9007199254740991) — Runs started.
- `active` (integer, required, min 0, max 9007199254740991) — Runs in progress now.
- `completed` (integer, required, min 0, max 9007199254740991) — Runs that reached the end.
- `exited` (integer, required, min 0, max 9007199254740991) — Runs ended early, by exit event or by hand.
- `history` (object, required) — Counts per day over the report window.
  - `startDate` (string, required, date) — First day of the window, inclusive.
  - `endDate` (string, required, date) — Last day of the window, inclusive.
  - `timezone` (string, required) — The workspace timezone the days are in.
  - `basis` ("event_time", required) — Days are counted by when each event happened.
  - `start` (string, required, date-time) — The window start as an instant.
  - `end` (string, required, date-time) — The window end as an instant.
  - `series` (object[], required) — One entry per day in the window.
    - `date` (string, required, date) — The day, in `timezone`.
    - `enrolled` (integer, required, min 0, max 9007199254740991) — Runs started that day.
    - `completed` (integer, required, min 0, max 9007199254740991) — Runs that reached the end that day.
    - `exited` (integer, required, min 0, max 9007199254740991) — Runs ended early that day.

## Example

```bash
curl https://api.kirora.io/v1/journeys/018f2a4e-6b1c-7d3e-9f40-37386ae05a6b/stats \
  -H "Authorization: Bearer $KIRORA_API_KEY"
```

Response `200`:

```json
{
  "data": {
    "enrolled": 0,
    "active": 0,
    "completed": 0,
    "exited": 0,
    "history": {
      "startDate": "2030-03-14",
      "endDate": "2030-03-14",
      "timezone": "Europe/London",
      "basis": "event_time",
      "start": "2030-03-14T09:30:00Z",
      "end": "2030-03-14T09:30:00Z",
      "series": [
        {
          "date": "2030-03-14",
          "enrolled": 0,
          "completed": 0,
          "exited": 0
        }
      ]
    }
  }
}
```
