List metrics

List a source's or an application's ingested and user-defined metrics.

GET https://telemetry.betterstack.com/api/v4/metrics

Query parameters

source_id
string
application_id
string
name_filter
string
order
DEFAULT cardinality string
page
integer
per_page
DEFAULT 50 integer
team_id
string

Headers

Authorization
required string

Results are paginated

Use pagination.next and pagination.prev to move through pages or jump to a specific one using page and per_page. See Pagination.

200

Response body

{
  "data": [
    {
      "id": "http_requests_total",
      "type": "source_metric",
      "attributes": {
        "name": "http_requests_total",
        "type": "float64",
        "origin": "ingested",
        "layout": "row-based",
        "aggregations": [
          "avg",
          "max",
          "min"
        ],
        "data_points": 182400,
        "active_series": 37,
        "sql_expression": null,
        "json_dot_notation": null,
        "query_examples": [
          "avgMergeIf(value_avg, name = 'http_requests_total')",
          "avgMergeIf(rate_avg, name = 'http_requests_total')   -- per-second rate, for counters"
        ],
        "labels": [
          "host",
          "method",
          "status"
        ]
      }
    }
  ],
  "pagination": {
    "first": "https://telemetry.betterstack.com/api/v4/metrics?page=1",
    "last": "https://telemetry.betterstack.com/api/v4/metrics?page=1",
    "prev": null,
    "next": null,
    "total_count": 1
  },
  "usage_available": true
}
401

Response body

{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
403
404
422

Response attributes

id
string
type
string
name
string
attributes.type
string
origin
string
layout
string
aggregations
array of strings
data_points
integer
active_series
integer
sql_expression
string or null
json_dot_notation
string or null
query_examples
array of strings
labels
array of strings or null
usage_available
boolean
pagination.first
string
pagination.last
string
pagination.prev
string or null
pagination.next
string or null
pagination.total_count
integer

Example cURL

Metrics of a source Filter by name
curl --request GET \
  --url "https://telemetry.betterstack.com/api/v4/metrics?source_id=123456" \
  --header "Authorization: Bearer $TOKEN"
curl --request GET \
  --url "https://telemetry.betterstack.com/api/v4/metrics?source_id=123456&name_filter=http_*" \
  --header "Authorization: Bearer $TOKEN"