GET /bgp/peers/stat-history

Per-peer BMP Statistics Report samples over a trailing window: the router's own prefixes_rejected (RFC 7854 §4.8 stat 0 — "my inbound policy refused N of your paths", router-authoritative, no inference) and as_path_loops (stat 4), plus the Adj-RIB-In/Loc-RIB gauges. Values are raw cumulative counters that reset with the underlying BGP session — derive deltas client-side and treat a decrease as a reset.

Auth: all authenticated roles

Query params: as_id and/or target_id (at least one required); hours (trailing window, default 24, max 720).

Response: 200 OK

{
  "from": "2026-08-14T12:00:00Z",
  "peers": [
    { "peer_id": "uuid",
      "samples": [ { "t": "2026-08-15T11:58:03Z", "prefixes_rejected": 42, "as_path_loops": 7, "adj_rib_in": 1223, "loc_rib": 1201 } ] }
  ]
}

Peers absent from peers sent no Statistics Reports: most routers only send them with a reporting period configured (IOS: stats-reporting-period under bmp server). An empty answer means "the router reports nothing", never "nothing rejected". On a dual-AF MP-BGP session the samples attach to the peer row matching the transport address family. Samples are floored at one per peer per 30s and pruned after retention.bgp_peer_stats_days (default 30). Errors: 400 when both as_id and target_id are missing.