# History: API reference

3 endpoints. Base URL `https://princegeorgepulse.ca/api/v1`. Conventions (envelope, paging, fields, formats, limits) are on the [overview](https://princegeorgepulse.ca/developers/). [All endpoints](https://princegeorgepulse.ca/developers/reference/).

## GET /api/v1/history/series {#get-history-series}

Every recorded live series: id, label, unit, number of readings and date range.

PG Pulse records each live reading (weather, air, rivers, outages, fires, roads, Kp, airport METAR) into its database every time the source refreshes, every 5 to 30 minutes. Raw readings are kept 90 days; hourly averages, minimums and maximums are kept indefinitely.

- Cache: 10 min
- Source: [PG Pulse live history: readings recorded from Open-Meteo, ECCC, Water Survey of Canada, BC Hydro, BC Wildfire Service, DriveBC, NOAA SWPC and NOAA AWC on every refresh](https://princegeorgepulse.ca/dashboard/)
- Licence: Mixed: see each item’s source

Also accepts `fields` (sparse fieldset) and `format` (`json`, `md`).

**Example request**

```bash
curl "https://princegeorgepulse.ca/api/v1/history/series"
```

**Example response** (trimmed)

```json
{
  "data": [
    {
      "id": "weather.temp",
      "label": "Temperature",
      "unit": "°C",
      "group": "Weather",
      "source": "weather",
      "decimals": 1,
      "points": 621,
      "hours": 373,
      "first": "2026-10-01T03:00:00.000Z",
      "last": "2026-10-16T15:00:00.000Z",
      "lastValue": 11
    },
    {
      "id": "weather.feels_like",
      "label": "Feels like",
      "unit": "°C",
      "group": "Weather",
      "source": "weather",
      "decimals": 1,
      "points": 621,
      "hours": 373,
      "first": "2026-10-01T03:00:00.000Z",
      "last": "2026-10-16T15:00:00.000Z",
      "lastValue": 11
    },
    "… 41 more"
  ],
  "meta": {
    "source": "PG Pulse live history: readings recorded from Open-Meteo, ECCC, Water Survey of Canada, BC Hydro, BC Wildfire Service, DriveBC, NOAA SWPC and NOAA AWC on every refresh",
    "sourceUrl": "https://princegeorgepulse.ca/dashboard/",
    "updatedAt": "2026-10-16T15:49:18.321Z",
    "ageSec": 0,
    "license": "Mixed: see each item’s source",
    "attribution": "The upstream named in each series (`meta.series.source`), via PG Pulse (princegeorgepulse.ca)"
  },
  "links": {
    "self": "/api/v1/history/series",
    "next": null,
    "docs": "/developers/reference/history/#get-history-series"
  }
}
```

## GET /api/v1/history {#get-history}

Time series for one or more recorded series (temperature, river level, outages…) between two dates.

Pass `series` as a comma-separated list of ids from /history/series (up to 8). Each point has `t` (ISO time, or a YYYY-MM-DD local day for `interval=day`) and `value`; hourly and daily points add `min`, `max` and `n` (readings).

- Cache: 5 min
- Source: [PG Pulse live history: readings recorded from Open-Meteo, ECCC, Water Survey of Canada, BC Hydro, BC Wildfire Service, DriveBC, NOAA SWPC and NOAA AWC on every refresh](https://princegeorgepulse.ca/dashboard/)
- Licence: Mixed: see each item’s source

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `series` | query | string | Series ids, comma-separated. Required. Example: `weather.temp,weather.feels_like`. |
| `from` | query | string | Start: ISO date/datetime, or a span back from `to` such as 48h, 7d or 30d (default 7d). Example: `7d`. |
| `to` | query | string | End: ISO date/datetime (default now). |
| `interval` | query | string | `raw` (every recorded reading; kept 90 days), `hour` or `day` (hourly rollups, kept indefinitely), or `auto` (raw up to 3 days, hourly up to 120 days, then daily). One of: `auto`, `raw`, `hour`, `day`. |

Also accepts `fields` (sparse fieldset) and `format` (`json`, `md`).

**Example request**

```bash
curl "https://princegeorgepulse.ca/api/v1/history?series=weather.temp&from=48h"
```

**Example response** (trimmed)

```json
{
  "data": [
    {
      "series": "weather.temp",
      "label": "Temperature",
      "unit": "°C",
      "interval": "raw",
      "truncated": false,
      "points": [
        {
          "t": "2026-10-14T16:00:00.000Z",
          "value": 8.3
        },
        {
          "t": "2026-10-14T17:00:00.000Z",
          "value": 9.6
        },
        "… 69 more"
      ]
    }
  ],
  "meta": {
    "source": "Environment and Climate Change Canada (city page weather bc-79, weather alerts, SWOB observations); NOAA Aviation Weather Center (METAR); Open-Meteo forecast API (model detail)",
    "sourceUrl": "https://weather.gc.ca/en/location/index.html?coords=53.917,-122.750",
    "updatedAt": "2026-10-16T15:00:00.000Z",
    "ageSec": 2958,
    "license": "CC BY 4.0, Open-Meteo.com (https://open-meteo.com/en/licence); Environment and Climate Change Canada Data Servers End-use Licence (https://eccc-msc.github.io/open-data/licence/readme_en/)",
    "attribution": "The upstream named in each series (`meta.series.source`), via PG Pulse (princegeorgepulse.ca)",
    "from": "2026-10-14T15:49:18.000Z",
    "to": "2026-10-16T15:49:18.000Z",
    "interval": "raw",
    "series": [
      {
        "id": "weather.temp",
        "source": "Environment and Climate Change Canada (city page weather bc-79, weather alerts, SWOB observations); NOAA Aviation Weather Center (METAR); Open-Meteo forecast API (model detail)"
      }
    ]
  },
  "links": {
    "self": "/api/v1/history?series=weather.temp&from=48h",
    "next": null,
    "docs": "/developers/reference/history/#get-history"
  }
}
```

## GET /api/v1/live/sources {#get-live-sources}

Freshness of every live source: when it was last fetched, its cache lifetime and the last error.

- Cache: 1 min
- Source: [PG Pulse live data cache](https://princegeorgepulse.ca/dashboard/)
- Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

Also accepts `fields` (sparse fieldset) and `format` (`json`, `md`).

**Example request**

```bash
curl "https://princegeorgepulse.ca/api/v1/live/sources"
```

**Example response** (trimmed)

```json
{
  "data": [
    {
      "key": "air",
      "source": "Environment and Climate Change Canada AQHI (Prince George); Open-Meteo air quality model; BC Ministry of Environment air monitoring stations",
      "fetchedAt": "2026-10-16T15:37:20.627Z",
      "ageSec": 718,
      "ttlSec": 1800,
      "stale": false,
      "lastError": null,
      "failures": 0
    },
    {
      "key": "airport",
      "source": "NOAA Aviation Weather Center (METAR and TAF for CYXS)",
      "fetchedAt": "2026-10-16T15:47:23.115Z",
      "ageSec": 115,
      "ttlSec": 600,
      "stale": false,
      "lastError": null,
      "failures": 0
    },
    "… 32 more"
  ],
  "meta": {
    "source": "PG Pulse live data cache",
    "sourceUrl": "https://princegeorgepulse.ca/dashboard/",
    "updatedAt": "2026-10-16T15:49:18.327Z",
    "ageSec": 0,
    "license": "CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)",
    "attribution": "PG Pulse (princegeorgepulse.ca)"
  },
  "links": {
    "self": "/api/v1/live/sources",
    "next": null,
    "docs": "/developers/reference/history/#get-live-sources"
  }
}
```
