Prometheus HTTP API

Number of APIs: 30

The current stable HTTP API is reachable under /api/v1 on a Prometheus server. Any non-breaking additions will be added under that endpoint.

Format overview

The API response format is JSON. Every successful API request returns a 2xx status code.

Invalid requests that reach the API handlers return a JSON error object and one of the following HTTP response codes:

400 Bad Request when parameters are missing or incorrect. 422 Unprocessable Entity when an expression can't be executed (RFC4918). 503 Service Unavailable when queries time out or abort.

Other non-2xx codes may be returned for errors occurring before the API endpoint is reached.

An array of warnings may be returned if there are errors that do not inhibit the request execution. All of the data that was successfully collected will be returned in the data field.

The JSON response envelope format is as follows:

{
  "status": "success" | "error",
  "data": <data>,

  // Only set if status is "error". The data field may still hold
  // additional data.
  "errorType": "<string>",
  "error": "<string>",

  // Only if there were warnings while executing the request.
  // There will still be data in the data field.
  "warnings": ["<string>"]
}

Generic placeholders:

<rfc3339 | unix_timestamp>: Input timestamps may be provided either in RFC3339 format or as a Unix timestamp in seconds, with optional decimal places for sub-second precision. Output timestamps are always represented as Unix timestamps in seconds.

<series_selector>: Prometheus time series selectors like http_requests_total or http_requests_total{method=~"(GET|POST)"} and need to be URL-encoded.

<duration>: Prometheus duration strings. For example, 5m refers to a duration of 5 minutes.

<bool>: boolean values (strings true and false).

Note: Names of query parameters that may be repeated end with [].

  1. admin/tsdb-snapshot - Creates Snapshot of current data POST {{baseUrl}}/admin/tsdb/snapshot?skip_head=true

  2. Returns label values GET {{baseUrl}}/label/:label_name/values?start=irure&end=irure&match[]=irure

  3. Returns metric metadata GET {{baseUrl}}/metadata

  4. Returns current alertmanager discovery GET {{baseUrl}}/alertmanagers

  5. Returns active alerts GET {{baseUrl}}/alerts

  6. Returns currently loaded rules GET {{baseUrl}}/rules?type=alert

  7. admin/tsdb-clean_tombstones - Removes deleted data PUT {{baseUrl}}/admin/tsdb/clean_tombstones

  8. admin/tsdb-clean_tombstones - Removes deleted data POST {{baseUrl}}/admin/tsdb/clean_tombstones

  9. admin/tsdb-delete_series - Deletes selected data PUT {{baseUrl}}/admin/tsdb/delete_series?match[]=&start=irure&end=irure

  10. admin/tsdb-delete_series - Deletes selected data POST {{baseUrl}}/admin/tsdb/delete_series?match[]=irure&start=irure&end=irure