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

# Analytics API

> Pull headline payment KPIs, a provider breakdown, and the checkout funnel for a project over a rolling window, in a single call.

The Analytics API returns a compact set of key metrics for a project so an AI agent, a programmatic dashboard, or an SDK consumer can read performance without scraping the dashboard. It powers the analytics tooling in the [PayBridgeNP MCP server](/integrations/mcp).

<Note>
  This is a read-only convenience endpoint. For row-level data, list [payments](/api-reference/payments/list-payments) instead. For period-over-period growth, query two windows and compare them yourself.
</Note>

## Scope and mode

Authenticate with a secret API key that holds the `analytics:read` scope. Results are scoped to the mode of the calling key. A sandbox key sees sandbox data, a live key sees live data.

## Endpoint

### `GET /v1/analytics/overview`

**Query parameters**

| Parameter | Type    | Default | Description                                                                                   |
| --------- | ------- | ------- | --------------------------------------------------------------------------------------------- |
| `days`    | integer | `30`    | Size of the rolling window in days, counted back from today (UTC). Clamped to the range 1–90. |

**Request**

```bash theme={null}
curl "https://api.paybridgenp.com/v1/analytics/overview?days=30" \
  -H "Authorization: Bearer sk_live_your_key"
```

**Response**

```json theme={null}
{
  "window": {
    "days": 30,
    "start": "2026-05-16T00:00:00.000Z",
    "end": "2026-06-15T09:12:44.000Z"
  },
  "payments": {
    "total": 412,
    "success": 389,
    "failed": 23,
    "success_rate": 0.9441,
    "success_volume_paisa": 5821000
  },
  "funnel": {
    "sessions_created": 540,
    "sessions_initiated": 470,
    "sessions_paid": 389,
    "conversion_rate_initiated_to_paid": 0.8277
  },
  "by_provider": [
    { "provider": "esewa",   "count": 250, "success_count": 240, "success_volume_paisa": 3500000 },
    { "provider": "khalti",  "count": 120, "success_count": 112, "success_volume_paisa": 1600000 },
    { "provider": "fonepay", "count": 42,  "success_count": 37,  "success_volume_paisa": 721000 }
  ]
}
```

**Fields**

| Field                                      | Description                                                         |
| ------------------------------------------ | ------------------------------------------------------------------- |
| `window.days`                              | The effective window size after clamping.                           |
| `window.start` / `window.end`              | UTC bounds of the window. `start` is midnight `days` ago.           |
| `payments.total`                           | Payment records created in the window.                              |
| `payments.success` / `payments.failed`     | Counts by terminal status.                                          |
| `payments.success_rate`                    | `success / total` as a fraction (0 when there are no payments).     |
| `payments.success_volume_paisa`            | Sum of succeeded payment amounts, in paisa.                         |
| `funnel.sessions_created`                  | Checkout sessions created in the window.                            |
| `funnel.sessions_initiated`                | Sessions that reached a provider (initiated, succeeded, or failed). |
| `funnel.sessions_paid`                     | Sessions that resulted in a successful payment.                     |
| `funnel.conversion_rate_initiated_to_paid` | `sessions_paid / sessions_initiated` as a fraction.                 |
| `by_provider[]`                            | Per-provider count, success count, and succeeded volume in paisa.   |

<Note>
  All money values are integers in **paisa** (1 rupee = 100 paisa), matching the rest of the API.
</Note>
