---
type: api
title: "Get Prometheus metric metadata"
description: "Get the type and unit of the metrics in time series data streams, over a fixed 24-hour lookback."
url: https://www.elastic.co/elastic/docs-builder/docs/4904/api/elasticsearch-serverless/operation/operation-prometheus-metadata
resource: https://www.elastic.co/elastic/docs-builder/docs/4904/api/elasticsearch-serverless/operation/operation-prometheus-metadata
products:
  - Elasticsearch Serverless
---

# Get Prometheus metric metadata

Authentication: required

Availability: Preview

## Paths

- `GET` `/_prometheus/{index}/api/v1/metadata`
- `GET` `/_prometheus/api/v1/metadata`

#### Path parameters

- `index` (string) — optional, leave it out to use `/_prometheus/api/v1/metadata`
  An index expression that restricts which indices are considered, for example `metrics-generic.prometheus-*`.
If you omit it, the default expression `metrics-*` is used.
Only indices with `index.mode: time_series` are considered.

## Description

Get the type and unit of the metrics in time series data streams, over a fixed 24-hour lookback.
The `help` field is always an empty string.
The endpoint mirrors the Prometheus `/api/v1/metadata` endpoint, without `match[]`, `start` and `end`.

## Required privileges

- Index privileges: `read`

## Query string parameters

- `metric` (string) — optional
  Restricts the response to one metric name.
- `limit` (number) — optional
  The maximum number of distinct metrics to return. `0` means no limit from the request.
- `limit_per_metric` (number) — optional
  The maximum number of metadata entries to return for each metric. `0` means no limit from the request.

## Responses

`application/json`

- `status` (string)
  The status of the request: `success`.
- `data` (map string to object)
  The metadata entries, keyed by metric name.
- `warnings` (string[])
  Warnings, such as a notice that the results were truncated because of `limit`.
## Code examples

#### Console

```console
GET /_prometheus/api/v1/metadata?metric=http_requests_total
```

#### JavaScript

```javascript
const response = await client.prometheus.metadata({
  metric: "http_requests_total",
});
```

#### Python

```python
resp = client.prometheus.metadata(
    metric="http_requests_total",
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_prometheus/api/v1/metadata?metric=http_requests_total" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### PHP

```php
$resp = $client->prometheus()->metadata([
    "metric" => "http_requests_total",
]);
```

#### Ruby

```ruby
response = client.prometheus.metadata(
  metric: "http_requests_total"
)
```

## Response examples

#### A successful response

`application/json`

A successful response from `GET /_prometheus/api/v1/metadata`.

```json
{
  "status": "success",
  "data": {
    "http_requests_total": [
      {
        "type": "counter",
        "help": "",
        "unit": ""
      }
    ]
  }
}
```

