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

# Get Pageviews Over Time — GET /api/websites/{id}/pageviews

> Fetch pageview and session counts grouped by a time interval for charting trends. Supports comparison periods, timezone-aware bucketing, and all filters.

Use this endpoint to retrieve the data that powers the time-series chart on the Betterumami Overview screen. The response provides two parallel arrays — `pageviews` and `sessions` — where each element is a `{x, y}` point with a date string and a count. Choose your bucket size with the `unit` parameter (`minute`, `hour`, `day`, `month`, or `year`) and optionally request a comparison series for trend overlays.

`GET /api/websites/{websiteId}/pageviews`

## Request

### Headers

**Authorization** `string` *required*

Bearer token. Pass your API key: `Authorization: Bearer <api-key>`

### Path Parameters

**websiteId** `string` *required*

The unique UUID of the website to query.

### Query Parameters

#### Date Range & Grouping

**startAt** `number`

Start of the date range as a Unix timestamp in **milliseconds**. Use this or `startDate`.

**endAt** `number`

End of the date range as a Unix timestamp in **milliseconds**. Use this or `endDate`.

**startDate** `string`

Start of the date range as an ISO 8601 date or datetime. Use this or `startAt`.

**endDate** `string`

End of the date range as an ISO 8601 date or datetime. Use this or `endAt`.

**unit** `string`

Time bucket size for grouping data points. One of `minute`, `hour`, `day`, `month`, or `year`. Defaults to `day`.

**timezone** `string`

IANA time zone for date bucketing, e.g. `Europe/London`. Defaults to UTC.

**compare** `string`

Attach a comparison series to the response. `prev` uses the immediately preceding period; `yoy` uses the same period one year ago.

#### Filters

**path** `string`

Filter to a specific URL path, e.g. `/pricing`.

**referrer** `string`

Filter by referring URL.

**title** `string`

Filter by page title.

**query** `string`

Filter by URL query string.

**os** `string`

Filter by operating system.

**browser** `string`

Filter by browser name.

**device** `string`

Filter by device category: `desktop`, `mobile`, or `tablet`.

**country** `string`

Filter by ISO 3166-1 alpha-2 country code.

**region** `string`

Filter by visitor region or subdivision.

**city** `string`

Filter by visitor city.

**language** `string`

Filter by browser language, e.g. `fr-FR`.

**event** `string`

Filter by custom event name.

**utmSource** `string`

Filter by UTM campaign source.

**utmMedium** `string`

Filter by UTM campaign medium.

**utmCampaign** `string`

Filter by UTM campaign name.

**utmContent** `string`

Filter by UTM campaign content.

**utmTerm** `string`

Filter by UTM campaign search term.

**tag** `string`

Filter by a tag attached to tracked activity.

**hostname** `string`

Filter by hostname.

**distinctId** `string`

Filter by a custom visitor identifier.

**eventType** `integer`

Filter by event type: `1` for pageviews, `2` for custom events.

**excludeBounce** `string`

Set to any non-empty value to exclude single-pageview visits.

**segment** `string`

UUID of a saved segment to apply as a filter.

**cohort** `string`

UUID of a saved cohort to filter visitors by.

**match** `string`

How multiple filters combine: `all` (AND logic, default) or `any` (OR logic).

## Response

**200 – Success**

**pageviews** `TimeSeriesPoint[]` *required*

Array of `{x, y}` data points representing pageview counts over time.

**pageviews\[].x** `string`

Date label for the bucket, formatted according to the chosen `unit`, e.g. `"2024-08-01"`.

**pageviews\[].y** `number`

Pageview count for this time bucket.

**sessions** `TimeSeriesPoint[]` *required*

Array of `{x, y}` data points representing session (visit) counts over time. Same structure as `pageviews`.

**startDate** `string`

ISO 8601 start of the resolved date range.

**endDate** `string`

ISO 8601 end of the resolved date range.

**compare** `object`

Present when `compare` is specified. Contains `pageviews`, `sessions`, `startDate`, and `endDate` for the comparison period, in the same format as the primary series.

```json 200 Response theme={null}
{
  "startDate": "2024-08-01T00:00:00Z",
  "endDate": "2024-08-07T23:59:59Z",
  "pageviews": [
    { "x": "2024-08-01", "y": 2143 },
    { "x": "2024-08-02", "y": 1987 },
    { "x": "2024-08-03", "y": 2301 },
    { "x": "2024-08-04", "y": 1756 },
    { "x": "2024-08-05", "y": 984 },
    { "x": "2024-08-06", "y": 871 },
    { "x": "2024-08-07", "y": 2129 }
  ],
  "sessions": [
    { "x": "2024-08-01", "y": 743 },
    { "x": "2024-08-02", "y": 698 },
    { "x": "2024-08-03", "y": 812 },
    { "x": "2024-08-04", "y": 601 },
    { "x": "2024-08-05", "y": 334 },
    { "x": "2024-08-06", "y": 290 },
    { "x": "2024-08-07", "y": 751 }
  ],
  "compare": {
    "startDate": "2024-07-25T00:00:00Z",
    "endDate": "2024-07-31T23:59:59Z",
    "pageviews": [
      { "x": "2024-07-25", "y": 1901 }
    ],
    "sessions": [
      { "x": "2024-07-25", "y": 680 }
    ]
  }
}
```

## Code Sample

```bash theme={null}
curl -X GET 'https://api.umami.is/v1/websites/b8d3a1f0-1c2d-4e5f-8a9b-0c1d2e3f4a5b/pageviews?startAt=1722470400000&endAt=1723075200000&unit=day&timezone=America%2FNew_York' \
  -H 'Authorization: Bearer <api-key>'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.