Prometheus Rules API

Endpoints for retrieving loaded recording rules and alerting rules.

Operations 1

GET /api/v1/rules Prometheus Get rules #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/prometheus-rules-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

prometheus-rules-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Prometheus Alertmanager Admin Rules API
  description: The Prometheus Alertmanager HTTP API v2 provides endpoints for querying active alert status, creating and managing silences, retrieving receiver configurations, and checking cluster peer status. Alertmanager deduplicates, groups, and routes alert notifications to receivers such as email, PagerDuty, Slack, and OpsGenie. The API base path is /api/v2.
  version: v0.28.0
  contact:
    name: Prometheus Project
    url: https://prometheus.io/community/
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://{host}:{port}
  description: Alertmanager server
  variables:
    host:
      default: localhost
      description: Alertmanager server hostname
    port:
      default: '9093'
      description: Alertmanager server port
tags:
- name: Rules
  description: Endpoints for retrieving loaded recording rules and alerting rules.
paths:
  /api/v1/rules:
    get:
      operationId: getRules
      summary: Prometheus Get rules
      description: Returns a list of alerting and recording rules currently loaded. Rules include the rule expression, their last evaluation time, and any active alerts for alerting rules.
      tags:
      - Rules
      parameters:
      - name: type
        in: query
        description: Filter by rule type.
        schema:
          type: string
          enum:
          - alert
          - record
      - name: rule_name[]
        in: query
        description: Filter by rule name.
        schema:
          type: array
          items:
            type: string
      - name: rule_group[]
        in: query
        description: Filter by rule group name.
        schema:
          type: array
          items:
            type: string
      - name: file[]
        in: query
        description: Filter by the file the rule group was loaded from.
        schema:
          type: array
          items:
            type: string
      responses:
        '200':
          description: Rules returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RulesResponse'
components:
  schemas:
    RuleGroup:
      type: object
      description: A group of recording and alerting rules.
      required:
      - name
      - rules
      properties:
        name:
          type: string
          description: Group name.
        file:
          type: string
          description: File the group was loaded from.
        interval:
          type: number
          description: Evaluation interval in seconds.
        limit:
          type: integer
          description: Maximum number of alerts this group can produce.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/Rule'
          description: List of rules in this group.
        lastEvaluation:
          type: string
          format: date-time
          description: Timestamp of the last evaluation.
        evaluationTime:
          type: number
          description: Duration of the last evaluation in seconds.
    RulesResponse:
      type: object
      description: Response containing recording and alerting rule groups.
      required:
      - status
      - data
      properties:
        status:
          type: string
          enum:
          - success
          - error
        data:
          type: object
          properties:
            groups:
              type: array
              items:
                $ref: '#/components/schemas/RuleGroup'
    Rule:
      type: object
      description: A recording rule or alerting rule.
      required:
      - name
      - query
      - type
      properties:
        name:
          type: string
          description: Rule or alert name.
        query:
          type: string
          description: PromQL expression of the rule.
        labels:
          type: object
          additionalProperties:
            type: string
          description: Labels to add to the rule output.
        annotations:
          type: object
          additionalProperties:
            type: string
          description: Annotations for alerting rules (e.g., summary, description).
        duration:
          type: number
          description: Alerting duration in seconds (for rules with for clauses).
        health:
          type: string
          enum:
          - ok
          - err
          - unknown
          description: Rule evaluation health.
        lastError:
          type: string
          description: Last evaluation error if health is err.
        lastEvaluation:
          type: string
          format: date-time
          description: Timestamp of last evaluation.
        evaluationTime:
          type: number
          description: Time taken for the last evaluation in seconds.
        type:
          type: string
          enum:
          - recording
          - alerting
          description: Whether this is a recording or alerting rule.
        alerts:
          type: array
          items:
            $ref: '#/components/schemas/AlertInstance'
          description: Currently active alerts for alerting rules.
    AlertInstance:
      type: object
      description: An instance of a firing or pending alert.
      properties:
        labels:
          type: object
          additionalProperties:
            type: string
          description: Labels of this alert instance.
        annotations:
          type: object
          additionalProperties:
            type: string
          description: Annotations of this alert instance.
        state:
          type: string
          enum:
          - firing
          - pending
          description: Current alert state.
        activeAt:
          type: string
          format: date-time
          description: Time the alert became active.
        value:
          type: string
          description: The value of the expression at the time of the last evaluation.
externalDocs:
  description: Alertmanager Documentation
  url: https://prometheus.io/docs/alerting/latest/alertmanager/