You can fetch all metrics with following curl expression:

url=http://{urIPorhostname}:9090    
curl -s  $url/api/v1/label/__name__/values | jq -r ".data[]" | sort 
Answer from Boris Ivanov on Stack Overflow
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › api
HTTP API | Prometheus
The following endpoints provide streamed discovery results for metric names, label names, and label values: GET /api/v1/search/metric_names POST /api/v1/search/metric_names GET /api/v1/search/label_names POST /api/v1/search/label_names GET /api/v1/search/label_values POST /api/v1/search/label_values
Top answer
1 of 4
7

You can fetch all metrics with following curl expression:

url=http://{urIPorhostname}:9090    
curl -s  $url/api/v1/label/__name__/values | jq -r ".data[]" | sort 
2 of 4
2

All the metrics for a particular instance IP:9100 can be obtained via the following PromQL query:

{instance="IP:9100"}

This query returns all the metrics, which have the given instance="IP:9100" label. See time series selector docs for more details. See also PromQL tutorial.

The {instance="IP:9100"} query can be sent to the following Prometheus querying APIs:

  • /api/v1/query - this endpoint returns matching time series values at the given timestamp specified via time query arg. For example, curl 'http://prometheus:9090/api/v1/query?query={instance="IP:9100"}' . Make sure you properly encoded query arg with percent encoding. See this demo.
  • /api/v1/series - this endpoint returns matching time series without any data, e.g. only metric names and labels are returned. For example, curl 'http://prometheus:9090/api/v1/series?match[]={instance="IP:9100"}'. Make sure you properly encoded match[] arg with percent encoding. See this demo
  • /api/v1/query_range - this endpoint returns calculated datapoints for matching time series on the selected time range [start ... end] with the given step interval between samples. See more details about calculated datapoints in these docs.

If you want returning just unique metric names without labels, then you can query /api/v1/label/__name__/values endpoint: curl http://prometheus:9090/api/v1/label/__name__/values . The __name__ is a special label name used in Prometheus for referring to metric names. Note that multiple time series may share the same metric name. For example, http_requests_total{path="/foo"} and http_requests_total{path="/bar"} time series share http_requests_total metric name, while they differ by path label values.

Discussions

promql - Prometheus endpoint of all available metrics - Stack Overflow
Show all available metrics, use __name__ instead: localhost:9090/api/v1/label/__name__/values 2020-07-30T03:01:27.613Z+00:00 ... The localhost:9090/api/v1/metadata api endpoint also shows HELP description. API reference 2021-11-30T10:03:13.587Z+00:00 ... Save this answer. ... Show activity on this post. Prometheus ... More on stackoverflow.com
🌐 stackoverflow.com
Prometheus metrics and API Star

Pretty simple integration, but the Prometheus client for python really needs to be used in multi-process mode with most production scale web applications, since (in my experience) you aren't going to get decent performance without spreading you queries across multiple instances.

More on reddit.com
🌐 r/Python
3
4
November 26, 2017
python , how to import prometheus endpoint metrics for processing by another system
It looks like the prometheus REST API is useful to discover targets, but not pull the metrics themselves. More on reddit.com
🌐 r/PrometheusMonitoring
1
0
September 12, 2020
Using Prometheus to ingest from foreign APIs
Write your own exporter (there are Prometheus client libraries for various languages) that queries the API and exposes its data in the Prometheus format: https://prometheus.io/docs/instrumenting/clientlibs/ https://prometheus.io/docs/instrumenting/writing_exporters/ More on reddit.com
🌐 r/PrometheusMonitoring
4
7
February 3, 2020
🌐
Last9
last9.io › blog › prometheus-api
Prometheus HTTP API: Query and Manage Metrics (2026) | Last9
March 6, 2025 - The Prometheus API comes in two main flavors: the HTTP API for direct queries and the management API for handling Prometheus itself. Master both, and you’re essentially the monitoring superhero your team didn’t know they needed. ... Explore key Prometheus functions and learn how to use them effectively for querying and analyzing metrics: Read more.
🌐
SigNoz
signoz.io › guides › how to retrieve all prometheus metrics - a step-by-step guide
How to Retrieve All Prometheus Metrics - A Step-by-Step Guide | SigNoz
October 30, 2024 - Scraping is when Prometheus collects metrics from defined targets at regular intervals. The Prometheus API, on the other hand, is used to query and retrieve metrics that have already been collected and stored in the time-series database.
🌐
DEV Community
dev.to › 0012303 › prometheus-has-a-free-api-heres-how-to-use-it-for-metrics-automation-446m
Prometheus Has a Free API: Here's How to Use It for Metrics Automation - DEV Community
March 28, 2026 - # Instant query curl -s "http://localhost:9090/api/v1/query?query=up" | jq '.data.result[] | {instance: .metric.instance, job: .metric.job, value: .value[1]}' # Range query (last hour, 15s steps) curl -s "http://localhost:9090/api/v1/query_range?query=rate(http_requests_total[5m])&start=$(date -d '1 hour ago' +%s)&end=$(date +%s)&step=15" | jq '.data.result[0].values | length' import requests from datetime import datetime, timedelta PROM_URL = "http://localhost:9090" def query_instant(promql): resp = requests.get(f"{PROM_URL}/api/v1/query", params={"query": promql}) return resp.json()["data"][
🌐
npm
npmjs.com › package › prometheus-api-metrics
prometheus-api-metrics - npm
const axios = require('axios'); const axiosTime = require('axios-time'); axiosTime(axios); try { const response = await axios({ baseURL: 'http://www.google.com', method: 'get', url: '/' }); Collector.collect(response); } catch (error) { Collector.collect(error); } ... In order to collect metrics from axios client the axios-time package is required. This package supports koa server that uses koa-router and koa-bodyparser · const { koaMiddleware } = require('prometheus-api-metrics') app.use(koaMiddleware())
      » npm install prometheus-api-metrics
    
Published: Mar 09, 2025
Version: 4.0.0
🌐
Grafana
grafana.com › docs › grafana-cloud › cost-management-and-billing › analyze-costs › metrics-costs › prometheus-metrics-costs › usage-analysis-api
Analyze metrics usage with the Prometheus API | Grafana Cloud documentation
Replace <METRICS_INSTANCE_QUERY_ENDPOINT> with the query endpoint URL from the Prometheus endpoint Details page. Once you’ve set the login and url variables, you can query the Prometheus API.
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › azure › azure-monitor › metrics › prometheus-api-promql
Query Prometheus Metrics using the API and PromQL - Azure Monitor | Microsoft Learn
Prometheus Query Language (PromQL) is a functional query language that you can use to query and aggregate time-series data. Use PromQL to query and aggregate metrics stored in an Azure Monitor workspace. This article describes how to query an ...
🌐
GitHub
gist.github.com › zulhfreelancer › da4767404a88fb2273e9259b8d96d8f8
Get all Prometheus metrics and descriptions/help texts · GitHub
get-all-prometheus-metrics.md · Requirement: promtool · curl -sg 'http://prom-server:prom-port/api/v1/metadata' | jq -r '.data' curl -sg 'http://prom-server:prom-port/api/v1/metadata' | jq -r '(["metric_name","description"], (.data | to_entries[] | [.key, .value[0].help])) | @csv' Sign up for free to join this conversation on GitHub.
🌐
GitHub
github.com › PayU › prometheus-api-metrics
GitHub - PayU/prometheus-api-metrics: API and process monitoring with Prometheus for Node.js micro-service · GitHub
const axios = require('axios'); const axiosTime = require('axios-time'); axiosTime(axios); try { const response = await axios({ baseURL: 'http://www.google.com', method: 'get', url: '/' }); Collector.collect(response); } catch (error) { Collector.collect(error); } ... In order to collect metrics from axios client the axios-time package is required. This package supports koa server that uses koa-router and koa-bodyparser · const { koaMiddleware } = require('prometheus-api-metrics') app.use(koaMiddleware())
Author: PayU
🌐
PyPI
pypi.org › project › prometheus-api-client
prometheus-api-client · PyPI
The prometheus-api-client library consists of multiple modules which assist in connecting to a Prometheus host, fetching the required metrics and performing various aggregation operations on the time series data.
      » pip install prometheus-api-client
    
Published: Apr 13, 2026
Version: 0.7.2
🌐
Red Hat
access.redhat.com › solutions › 3775611
How to get the metrics using REST API of Prometheus in RHOCP? - Red Hat Customer Portal
May 15, 2025 - How to get the metrics using curl from Prometheus ? ... A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more. ... Here are the common uses of Markdown. ... Are you sure you want to request a translation? We appreciate your interest in having Red Hat content localized to your language. Please note that excessive use of this feature could cause delays in getting specific content you are interested in translated.
🌐
GitHub
github.com › PayU › prometheus-api-metrics › blob › master › README.md
prometheus-api-metrics/README.md at master · PayU/prometheus-api-metrics
You can expand the API metrics with more metrics that you would like to expose. All you have to do is: ... const checkoutsTotal = new Prometheus.Counter({ name: 'checkouts_total', help: 'Total number of checkouts', labelNames: ['payment_method'] });
Author: PayU
🌐
Better Stack
betterstack.com › community › questions › how-to-monitor-rest-apis-with-prometheus
How to Monitor REST APIs with Prometheus | Better Stack Community
Metrics are available at http://<host>:8000/metrics. Prometheus can scrape this endpoint to collect data. Add a scrape job in your prometheus.yml configuration: ... scrape_configs: - job_name: 'api-monitoring' static_configs: - targets: ...
🌐
Prometheus
prometheus.io › docs › prometheus › latest › querying › examples
Query examples | Prometheus
instance_cpu_time_ns{app="lion", proc="web", rev="34d0f99", env="prod", job="cluster-manager"} instance_cpu_time_ns{app="elephant", proc="worker", rev="34d0f99", env="prod", job="cluster-manager"} instance_cpu_time_ns{app="turtle", proc="api", rev="4d3a513", env="prod", job="cluster-manager"} instance_cpu_time_ns{app="fox", proc="widget", rev="4d3a513", env="prod", job="cluster-manager"} ... ...we could get the top 3 CPU users grouped by application (app) and process type (proc) like this: topk(3, sum by (app, proc) (rate(instance_cpu_time_ns[5m]))) Assuming this metric contains one time series per running instance, you could count the number of running instances per application like this: count by (app) (instance_cpu_time_ns) If we are exploring some metrics for their labels, to e.g.
🌐
SigNoz
signoz.io › guides › how to monitor rest apis with prometheus - a step-by-step guide
How to Monitor REST APIs with Prometheus - A Step-by-Step Guide | SigNoz
July 30, 2024 - Monitoring REST APIs with Prometheus is essential for maintaining high-performance, reliable web services. This guide walks you through the process of setting up Prometheus, instrumenting your API, and implementing advanced monitoring techniques. You'll learn how to track key metrics, set up health checks, and visualize your data for optimal API performance.
🌐
Better Stack
betterstack.com › community › questions › prometheus-endpoint-of-all-available-metrics
Prometheus Endpoint of All Available Metrics | Better Stack Community
November 18, 2024 - In Prometheus, you can access the endpoint that lists all available metrics by querying the /metrics endpoint of your Prometheus server.
🌐
Last9
last9.io › blog › prometheus-api-guide
An Easy and Comprehensive Guide to Prometheus API | Last9
March 27, 2025 - The Prometheus API isn’t just another tool in your tech stack – it’s the secret weapon that unlocks next-level monitoring capabilities. With it, you can: Pull metrics data programmatically from any service Prometheus scrapes
🌐
Medium
eytanmanor.medium.com › an-introduction-to-prometheus-a-tool-for-collecting-metrics-and-monitoring-services-12fcc3bdb5d6
An introduction to Prometheus — a tool for collecting metrics and monitoring services | by Eytan Manor | Medium
January 2, 2023 - If the Prometheus server is running on a Kubernetes cluster, it would usually pull this information from the Kubernetes API. Scraping — For each service in the list, send an HTTP GET /metrics request and store the metrics for later querying.