Grafana OnCallGrafana OnCall API referenceAlerts HTTP API

List Alerts

curl "{{API_URL}}/api/v1/alerts/" \
  --request GET \
  --header "Authorization: meowmeowmeow" \
  --header "Content-Type: application/json" 

The above command returns JSON structured like this:

{
    "count": 3,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": "AA74DN7T4JQB6",
            "incident_id": "I68T24C13IFW1",
            "created_at": "2020-05-11T20:07:43Z",
            "payload": {
                "state": "alerting",
                "title": "[Alerting] Test notification",
                "ruleId": 0,
                "message": "Someone is testing the alert notification within grafana.",
                "ruleUrl": "{{API_URL}}/",
                "ruleName": "Test notification",
                "evalMatches": [
                    {
                        "tags": null,
                        "value": 100,
                        "metric": "High value"
                    },
                    {
                        "tags": null,
                        "value": 200,
                        "metric": "Higher Value"
                    }
                ]
            }
        },
        {
            "id": "AR9SSYFKE2PV7",
            "incident_id": "I68T24C13IFW1",
            "created_at": "2020-05-11T20:07:54Z",
            "payload": {
                "state": "alerting",
                "title": "[Alerting] Test notification",
                "ruleId": 0,
                "message": "Someone is testing the alert notification within grafana.",
                "ruleUrl": "{{API_URL}}/",
                "ruleName": "Test notification",
                "evalMatches": [
                    {
                        "tags": null,
                        "value": 100,
                        "metric": "High value"
                    },
                    {
                        "tags": null,
                        "value": 200,
                        "metric": "Higher Value"
                    }
                ]
            }
        },
        {
            "id": "AWJQSGEYYUFGH",
            "incident_id": "I68T24C13IFW1",
            "created_at": "2020-05-11T20:07:58Z",
            "payload": {
                "state": "alerting",
                "title": "[Alerting] Test notification",
                "ruleId": 0,
                "message": "Someone is testing the alert notification within grafana.",
                "ruleUrl": "{{API_URL}}/",
                "ruleName": "Test notification",
                "evalMatches": [
                    {
                        "tags": null,
                        "value": 100,
                        "metric": "High value"
                    },
                    {
                        "tags": null,
                        "value": 200,
                        "metric": "Higher Value"
                    }
                ]
            }
        }
    ]
}

The following available filter parameters should be provided as get arguments:

  • incident_id
  • search—string-based inclusion search by alert payload

HTTP request

GET {{API_URL}}/api/v1/alerts/