Prometheus Admin API

Administrative endpoints for TSDB management including snapshots and tombstone cleanup. Requires --web.enable-admin-api flag.

OpenAPI Specification

prometheus-admin-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prometheus Alertmanager Admin 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: Admin
  description: Administrative endpoints for TSDB management including snapshots and tombstone cleanup. Requires --web.enable-admin-api flag.
paths:
  /api/v1/admin/tsdb/snapshot:
    post:
      operationId: createTsdbSnapshot
      summary: Prometheus Create TSDB snapshot
      description: Creates a snapshot of all current data into the snapshots/ directory under the data directory and returns the directory name. Requires --web.enable-admin-api flag.
      tags:
      - Admin
      parameters:
      - name: skip_head
        in: query
        description: Skip data present in the head block if true. Defaults to false.
        schema:
          type: boolean
          default: false
      responses:
        '200':
          description: Snapshot created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                    - success
                  data:
                    type: object
                    properties:
                      name:
                        type: string
                        description: Directory name of the snapshot.
                        example: 20240316T105532Z-fcea73e5e91ba6db
        '403':
          description: Admin API not enabled
  /api/v1/admin/tsdb/delete_series:
    post:
      operationId: deleteTsdbSeries
      summary: Prometheus Delete series
      description: Deletes data for a selection of series in a time range by creating tombstones. The series data is not immediately removed but marked for deletion during the next compaction cycle. Requires --web.enable-admin-api flag.
      tags:
      - Admin
      parameters:
      - name: match[]
        in: query
        required: true
        description: Repeated label matcher argument to select series to delete.
        schema:
          type: array
          items:
            type: string
      - name: start
        in: query
        description: Start of the time range to delete. Defaults to minimum time.
        schema:
          type: string
      - name: end
        in: query
        description: End of the time range to delete. Defaults to maximum time.
        schema:
          type: string
      responses:
        '204':
          description: Deletion tombstones created successfully
        '400':
          description: Bad request — invalid match or time parameters
        '403':
          description: Admin API not enabled
  /api/v1/admin/tsdb/clean_tombstones:
    post:
      operationId: cleanTombstones
      summary: Prometheus Clean tombstones
      description: Removes the deleted data from disk and cleans up existing tombstones. This operation triggers a compaction on all blocks with tombstones. Requires --web.enable-admin-api flag.
      tags:
      - Admin
      responses:
        '204':
          description: Tombstones cleaned successfully
        '403':
          description: Admin API not enabled
externalDocs:
  description: Alertmanager Documentation
  url: https://prometheus.io/docs/alerting/latest/alertmanager/