---
title: "Prometheus metrics scrape endpoint"
method: GET
path: "/api/v1/metrics"
tags: ["Metrics"]
---

# Prometheus metrics scrape endpoint

`GET /api/v1/metrics`

## Request

- Base URL: `https://app.lastping.dev`
- URL: `https://app.lastping.dev/api/v1/metrics`
- Auth: one of:
  - API key in header `X-Api-Key`
  - HTTP bearer

Returns the authenticated project's checks as Prometheus gauges in
[Prometheus text exposition format 0.0.4](https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format).

**Metrics emitted (per check, labelled `id`, `name`, `slug`):**
- `lastping_check_up` — 1 if status is `up`, else 0
- `lastping_check_state{state="up|late|down|new"}` — one-hot gauge for current state
- `lastping_check_last_ping_timestamp_seconds` — unix seconds of last ping (omitted when never pinged)
- `lastping_check_due_timestamp_seconds` — unix seconds of next expected ping (omitted if null)
- `lastping_check_grace_seconds` — grace period in seconds
- `lastping_check_paused` — 1 if paused, else 0
- `lastping_checks` — count of checks in the project

**Authentication:** accepts either `X-Api-Key: lp_…` or `Authorization: Bearer lp_…`
(the Bearer form is provided specifically for Prometheus `scrape_config`).

**Example Prometheus `scrape_config`:**
```yaml
scrape_configs:
  - job_name: lastping
    scrape_interval: 60s
    authorization:
      credentials: lp_YOUR_API_KEY
    static_configs:
      - targets: [app.lastping.dev]
    metrics_path: /api/v1/metrics
    scheme: https
```

## Response `200`

Prometheus text exposition (format 0.0.4). Content-Type is
`text/plain; version=0.0.4; charset=utf-8`.

## Other responses

- `401`: Missing or invalid API key.
- `429`: Too many requests. The per-principal fixed-window rate limit has been exceeded. Retry after the number of seconds indicated by the `Retry-After` response header. The problem body's `code` is `RATE_LIMITED`. It names this limiter specifically, so a client can tell it apart from the application-level throttles that also answer 429 with their own codes and their own, much longer, `Retry-After` values (`TEST_PING_RATE_LIMITED`, `TOO_MANY_ATTEMPTS`). Back off globally on `RATE_LIMITED`; back off on the one operation for the others. The principal is the API key for a key-authenticated request and the USER for a browser session, so every tab one person has open shares one budget.

---

[API](https://skmtc.dev/lastping/apis/lastping-management-api.md) · [All operations](https://skmtc.dev/lastping/apis/lastping-management-api/llms.txt) · [OpenAPI document](https://skmtc.dev/lastping/apis/lastping-management-api/revisions/bbc6eda91c46?raw)
