---
title: "Affiliate click statistics of one component"
method: GET
path: "/api/admin/components/{id}/stats"
tags: ["admin-components"]
---

# Affiliate click statistics of one component

`GET /api/admin/components/{id}/stats`

## Request

- Base URL: `https://voltplan.app`
- URL: `https://voltplan.app/api/admin/components/{id}/stats`
- Auth: HTTP bearer

Aggregates the `component_click_events` of the component. Bot and crawler user agents are skipped (`isBotUserAgent`, which also treats a missing or empty `user_agent` as a bot). An unknown `id` answers 200 with zero counts.

## Response `200`

Click statistics.

- AdminComponentStats: Human affiliate clicks of one component (bot user agents excluded).
  - `total` integer, required: All clicks, all time.
  - `today` integer, required: Clicks since 00:00 UTC.
  - `last7Days` integer, required: Clicks in the last 7 × 24 h.
  - `last30Days` integer, required: Clicks in the last 30 × 24 h.
  - `byCountry` object, required: Clicks by `resolved_country`; `unknown` when empty.
  - `bySource` object, required: Clicks by `source`; `unknown` when empty.
  - `byApp` object, required: Clicks by app: the `source` prefix before `_` when it is a known app, else `voltplan`.
  - `dailyBuckets` AdminComponentStatsDay[], required: Last 30 UTC days, oldest first; the last entry is today.
    - `date` string, required: UTC day.
    - `count` integer, required

## Other responses

- `403`: Admin access required. Returned for a missing, invalid or expired bearer token as well as for a valid token whose user lacks `is_admin=true`; admin endpoints never answer 401.
- `500`: PocketBase read failed.

---

[API](https://skmtc.dev/voltplan/apis/voltplan-api.md) · [All operations](https://skmtc.dev/voltplan/apis/voltplan-api/llms.txt) · [OpenAPI document](https://skmtc.dev/voltplan/apis/voltplan-api/revisions/575b86a7af92?raw)
