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

# Hub analytics

> Team-admin endpoints for membership KPIs, engagement leaderboards, and email deliverability.

Analytics endpoints are scoped to a hub and require a team-owner Bearer token.
All responses are `application/vnd.api+json`.

## Base path

```
/api/teams/{team_id}/hubs/{hub_id}/analytics
```

All endpoints accept optional `from` / `to` ISO-8601 query parameters
(`from` must be strictly before `to`). When omitted, a default window is applied
(30 days for most endpoints, 24 hours for `/email`).

***

## GET /overview

Returns the three core membership KPIs for the hub.

**Resource type:** `analytics_overview`

| Attribute              | Description                                             |
| ---------------------- | ------------------------------------------------------- |
| `total_active_members` | Memberships with `status=active`                        |
| `new_members`          | Active members whose `created_at` falls in `[from, to)` |
| `active_members`       | Active members seen within the last 30 days             |

***

## GET /engagement

Returns membership KPIs plus six community/content leaderboards.

**Resource type:** `analytics_engagement`

| Attribute                 | Description                                                 |
| ------------------------- | ----------------------------------------------------------- |
| `total_active_members`    | See `/overview`                                             |
| `new_members`             | See `/overview`                                             |
| `active_members`          | See `/overview`                                             |
| `top_members_by_posts`    | Members ranked by discussion count                          |
| `top_members_by_comments` | Members ranked by comment count                             |
| `top_posts`               | Discussions ranked by `comment_count` then `reaction_count` |
| `top_content`             | Content nodes ranked by distinct member completions         |
| `top_spaces`              | Spaces ranked by post count then total reactions            |
| `recent_members`          | Newest active joiners                                       |

Default: all sections returned at top-10.

### Single-section pagination

Add `section=<name>` and `page[size]=<1..100>` to fetch one section only:

```
GET /analytics/engagement?section=top_posts&page[size]=5
```

Valid `section` values: `top_members_by_posts`, `top_members_by_comments`,
`top_posts`, `top_content`, `top_spaces`, `recent_members`.

Soft-deleted discussions and comments are excluded from all leaderboards.

***

## GET /email

Returns email deliverability KPIs. Default window: last 24 hours.

**Resource type:** `analytics_email_deliverability`

| Attribute        | Description                            |
| ---------------- | -------------------------------------- |
| `sent`           | Total emails sent (pool sends)         |
| `delivered`      | Delivered count                        |
| `bounced_hard`   | Hard bounces                           |
| `bounced_soft`   | Soft bounces                           |
| `complained`     | Spam complaints                        |
| `unsubscribed`   | Unsubscribes                           |
| `bounce_rate`    | `(bounced_hard + bounced_soft) / sent` |
| `complaint_rate` | `complained / delivered`               |
