# Dashboard

> Aggregate the caller's activity events into volume, fee and count totals.

The dashboard endpoint sums the money and count columns of the caller's activity events over a time window, grouped by the dimensions you choose (day, chain, event type, source, platform, quote mint).

Money comes back as integer strings in raw units: USD amounts in micro-USD, native amounts in the chain's base unit (lamports, wei). A bucket that spans chains adds lamports to wei, so group by `chain` whenever you read `amount_native`.

Base URL: `https://api-mig.proxima.tools`

## Endpoints

- `GET /dashboard`: Retrieve dashboard aggregates

### Retrieve dashboard aggregates

`GET /dashboard`

Returns the caller's activity totals over a window, grouped by the requested dimensions. (Bearer JWT)

- Token: Upgraded session token, bound to a license.
- Read-only tokens: allowed.
- Retry: Safe to retry.

Without `since` and `until`, the window is the last 30 days ending now. Without `group_by`, rows are grouped by `event_type`.

> Not called by the current web app. The admin dashboard uses `GET /admin/dashboard`, which takes the same parameters.

> Money fields are strings so large sums keep full precision. Parse them with a big-number type.

#### Query parameters

- `since` (integer, optional): Window start in Unix seconds. Defaults to 30 days before `until`.
- `until` (integer, optional): Window end in Unix seconds. Defaults to now.
- `chain` (string, optional): Restrict to one chain ID.
- `event_type` (string, optional): Restrict to one event type.
- `source` (string, optional): Restrict to one event source.
- `group_by` (string, optional, default "event_type"): Comma-separated dimensions: `day`, `chain`, `event_type`, `source`, `platform`, `quote_mint`. The SDK also accepts an array and joins it.

#### Returns 200 OK

- `from` (integer): Window start used, in Unix seconds.
- `to` (integer): Window end used, in Unix seconds.
- `group_by` (array<string>): Grouping columns applied. `chain` is reported as `chain_id`.
- `rows` (array<object>): One row per group. Only the grouped dimensions are present.
  - `day` (string): UTC day (`YYYY-MM-DD`).
  - `chain_id` (string): Chain ID.
  - `event_type` (string): Event type.
  - `source` (string | null): Event source.
  - `platform` (string | null): Launchpad.
  - `quote_mint` (string | null): Quote token mint or address.
  - `amount_usd` (string): Sum in micro-USD.
  - `amount_native` (string): Sum in native base units.
  - `amount_quote` (string): Sum in quote token base units.
  - `amount_token` (string): Sum in launched-token base units.
  - `fee_native` (string): Fees in native base units. Only in the admin variant of this aggregate.
  - `fee_usd` (string): Fees in micro-USD. Only in the admin variant of this aggregate.
  - `native_mixed` (boolean): `true` when the row spans several chains, so `amount_native` mixes units.
  - `count_sum` (number): Sum of the events' item counts.
  - `event_count` (number): Number of events in the row.

#### Errors

| Status | Code | Message | When | What to do |
| --- | --- | --- | --- | --- |
| 400 | `bad_request` | `invalid group_by dimension: <dimension>` | `group_by` names an unknown dimension. | Use `day`, `chain`, `event_type`, `source`, `platform` or `quote_mint`. |

#### Example request

```bash
curl "https://api-mig.proxima.tools/dashboard?group_by=day%2Cchain" \
  -H "Authorization: Bearer $PROXIMA_JWT"
```

#### Example response

```json
{
  "from": 1790985600,
  "to": 1793614500,
  "group_by": [
    "chain_id",
    "event_type"
  ],
  "rows": [
    {
      "chain_id": "sol",
      "event_type": "buy",
      "amount_usd": "18422310000",
      "amount_native": "109400000000",
      "amount_quote": "0",
      "amount_token": "84211000000000",
      "native_mixed": false,
      "count_sum": 0,
      "event_count": 412
    }
  ]
}
```
