How to get current alerts via HTTP API

I’m trying to get active alerts (instances) via HTTP API. Endpoint /api/alertmanager/grafana/api/v2/alerts works fine, but I noticed that Grafana’s Alert List panel can also get instances in Pending state, which I would like too. I assume it uses /api/annotations but I wonder - how does it show only active alert instances? GET returns all history (up to limit of 100, by default). I cannot figure out how to filter it (either by query params or in returned data) to only show current alert instances (in Alerting or Pending state).

EDIT: If I understand Alert List code, it uses legacy API /api/alerts, but it returns empty array when I try it.

Thank you!

Hi @alespour

Using the Network monitor tab in the browser inspector, I see the API being called by the alert list visualization is /api/prometheus/grafana/api/v1/rules

I tested it and it does deliver alerts in pending status