LastPing Routes API
The Routes API from LastPing — 2 operation(s) for routes.
The Routes API from LastPing — 2 operation(s) for routes.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/lastping-dev:lastping-dev-routes-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: LastPing Management Routes API
version: '1.0'
description: 'The LastPing Management API lets you create, configure, and manage uptime
checks for your project. All mutating endpoints require a valid API key
supplied in the `X-Api-Key` request header.
## MCP server for AI agents
LastPing ships an MCP (Model Context Protocol) server so AI agents can
create and manage monitors, query incidents, and set up their own
dead-man''s-switch — all in one conversation. The hosted server is at
`https://mcp.lastping.dev/mcp`; connect with `Authorization: Bearer `.
See lastping.dev/mcp/ for setup instructions
and the full tool list.'
contact:
url: https://lastping.dev
servers:
- url: /
description: Management API (relative path — prepend your host)
security: []
tags:
- name: Routes
paths:
/api/v1/checks/{id}/routes:
parameters:
- name: id
in: path
required: true
description: UUID of the check.
schema:
type: string
format: uuid
example: 550e8400-e29b-41d4-a716-446655440000
get:
operationId: listRoutes
summary: List routes for a check
description: 'Returns all routing rules for the check. Each rule maps an event type
(`down`, `recovery`, `fail`, `every-run`, `success`, `started`,
`blocked`, `note`) to a list of channel UUIDs. Always returns a JSON
array (never null).'
tags:
- Routes
security:
- ApiKeyAuth: []
responses:
'200':
description: Array of routes (may be empty).
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Route'
'401':
description: Missing or invalid API key.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'404':
description: Check not found in this project.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
/api/v1/checks/{id}/routes/{event_type}:
parameters:
- name: id
in: path
required: true
description: UUID of the check.
schema:
type: string
format: uuid
example: 550e8400-e29b-41d4-a716-446655440000
- name: event_type
in: path
required: true
description: 'Event type to route. `every-run`, `success` and `started` are not state changes: `every-run` notifies once per completed run, `success` only on a successful run, and `started` when a run begins. None of the three is flap-damped, and all three share one per-channel rate budget (default 60/hr) that is separate from the budget down/recovery/fail draw from — a chatty monitor routed to any combination of the three can exhaust that shared budget and suppress its own later notifications on that channel. Prefer a low-stakes destination for them. `blocked` fires when the agent reports it is blocked (waiting on a human) via a `blocked` ping and is still blocked 10 minutes later: the notification is held 10 minutes, a note, step, success, fail or cancel for the same run inside that time cancels it (a title does not), and a run sends it at most once per blocked stretch. A `blocked` ping sent without a run id belongs to no run, so any non-blocked ping on the monitor ends its stretch instead: a start, log, note, success, fail or cancel of any run, or a step of the monitor''s current run (any step when no run is current). It shares the down/recovery/fail alert budget, not the info one. It is distinct from the `blocked`-CAUSE `down` event that fires separately if the block outlasts `blocked_timeout_s`. `note` is an agent-reported free-text informational signal and shares the every-run/success/started info budget. `expiring` warns that an HTTPS monitor''s TLS certificate or its domain registration expires soon, once per warning threshold; it opens no incident and has a budget of its own.'
schema:
type: string
enum:
- down
- recovery
- fail
- every-run
- success
- started
- blocked
- note
- expiring
example: down
put:
operationId: upsertRoute
summary: Upsert a route
description: 'Creates or replaces the routing rule for the given event type on a check.
`channel_ids` is the complete new list (empty list removes all channels for
this event type). Duplicate channel IDs in the request are silently deduped.
All referenced channels must belong to the authenticated project.'
tags:
- Routes
security:
- ApiKeyAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- channel_ids
properties:
channel_ids:
type: array
items:
type: string
format: uuid
description: Ordered list of channel UUIDs to notify for this event type.
example:
- c1d2e3f4-0000-0000-0000-000000000001
example:
channel_ids:
- c1d2e3f4-0000-0000-0000-000000000001
responses:
'200':
description: Route upserted; returns the stored state.
content:
application/json:
schema:
$ref: '#/components/schemas/Route'
'400':
description: Invalid request body, invalid event_type, or unknown/cross-tenant channel ID.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'401':
description: Missing or invalid API key.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'404':
description: Check not found in this project.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
delete:
operationId: deleteRoute
summary: Delete a route
description: Removes the routing rule for the given event type. Returns 204 No Content on success.
tags:
- Routes
security:
- ApiKeyAuth: []
responses:
'204':
description: Route deleted.
'400':
description: id is not a valid UUID, or event_type is not one of down/recovery/fail/every-run/success/started/blocked/note.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'401':
description: Missing or invalid API key.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'404':
description: Check or route not found in this project.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
components:
schemas:
Problem:
type: object
description: RFC 7807 problem detail returned on errors (Content-Type application/problem+json).
properties:
type:
type: string
description: URI identifying the problem type. Currently always "about:blank".
example: about:blank
title:
type: string
description: Short human-readable summary of the problem type.
example: Not Found
status:
type: integer
description: HTTP status code.
example: 404
detail:
type: string
description: Human-readable explanation specific to this occurrence.
example: check not found
engine:
type: string
description: Always "lastping".
example: lastping
service_version:
type: string
description: Running version of the api service.
example: dev
request_id:
type: string
description: Echo of X-Request-Id header (or a generated UUID when absent).
example: b5d3f2a1-0c7e-4b8d-a991-f3e0c2d1a4b7
code:
type: string
description: 'Machine-readable, SCREAMING_SNAKE_CASE error code (e.g.
`MONITOR_NOT_FOUND`, `SESSION_ONLY`, `CSRF_REQUIRED`,
`READ_ONLY_IMPERSONATION`, `IMPERSONATION_UNAVAILABLE`,
`VIEW_AS_CHANGED`, `INVALID_SCHEDULE`). Omitted for the small set of errors that
predate this convention and never got one. A client should branch
on `code`, not on `detail`''s prose, which may change wording
without notice.
'
example: MONITOR_NOT_FOUND
fix:
type: string
description: 'One-sentence, human-readable remediation for this `code` — what
to send instead, or what to do next. Omitted when `code` is
omitted.
'
example: Verify the check id belongs to your project; use GET /api/v1/checks to list your monitors.
Route:
type: object
description: A routing rule that maps a check event type to a list of notification channels.
properties:
event_type:
type: string
enum:
- down
- recovery
- fail
- every-run
- success
- started
- blocked
- note
- expiring
description: 'The check event that triggers this route. `down`, `recovery` and `fail` fire on a state change. `every-run`, `success` and `started` are informational: `every-run` fires once per completed run (success or failure), `success` fires only on a successful run, and `started` fires when a run begins. All three are bounded only by how often the monitor runs (not by state changes), and they share one per-channel rate budget (default 60/hr) separate from down/fail/recovery — a chatty monitor routed to any combination of the three can starve its own notifications once that shared budget is exhausted. `blocked` fires when the agent reports it is blocked (waiting on a human) via a `blocked` ping and is still blocked 10 minutes later: the notification is held 10 minutes, a note, step, success, fail or cancel for the same run inside that time cancels it (a title does not), and a run sends it at most once per blocked stretch (until one of those ends the stretch). A `blocked` ping sent without a run id belongs to no run, so any non-blocked ping on the monitor ends its stretch instead: a start, log, note, success, fail or cancel of any run, or a step of the monitor''s current run (any step when no run is current). It is agent-reported rather than a system-derived state change, but it draws on the down/recovery/fail alert budget rather than the info one, because a blocked run needs a human and must not be starved by chatty info traffic. It is distinct from the `blocked`-CAUSE incident: if the block outlasts `blocked_timeout_s`, a separate `down` event fires with cause `blocked` (routable via the bare `down` route or a `down/blocked` per-cause override), not another `blocked`-event-type notification. `note` is an agent-reported, informational free-text signal (no state change) and shares the every-run/success/started info budget.'
example: down
channel_ids:
type: array
items:
type: string
format: uuid
description: Ordered list of channel UUIDs to notify (never null; may be empty).
example:
- c1d2e3f4-0000-0000-0000-000000000001
responses:
RateLimited:
description: '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.
'
headers:
Retry-After:
description: Seconds to wait before retrying.
schema:
type: integer
example: 30
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-Api-Key
description: 'Project API key. Obtain from your LastPing project settings.
**Every key carries a scope**, which is what it is permitted to do:
| Scope | Reaches |
| --- | --- |
| `read` | Every `GET`. |
| `write` | Everything except API key management — the default for a new key. |
| `admin` | Everything, including `/api/v1/api-keys`. |
A request whose key ranks below an operation''s requirement is refused
with `403` and a problem body carrying `required_scope`, the tier the
operation needed. The rule is uniform: `GET` needs `read`, every other
method needs `write`, and the three `/api/v1/api-keys` operations need
`admin` — the list included, since key names, prefixes and lineage are
what a caller needs in order to choose which key to revoke.
Keys created before scopes existed are `admin`, so nothing that worked
before this was introduced stops working. Enforcement of this refusal
is switched on separately from the scope existing on a key.
'
BearerAuth:
type: http
scheme: bearer
description: 'Project API key presented as a Bearer token.
Accepted as an alternative to the X-Api-Key header, specifically
to allow Prometheus scrape_config `authorization: { credentials: … }`.
'
SessionCookie:
type: apiKey
in: cookie
name: lp_session
description: 'The signed-in browser session, set by the sign-in flow at
`/auth/login`. It is `HttpOnly`, `Secure` and `SameSite=Lax`, so it
cannot be read by script and is not a credential you can obtain or
store the way an API key is.
A handful of operations accept **only** this, and refuse an API key of
any scope with `403 SESSION_ONLY`. They act on a PERSON rather than on a
project (`/api/v1/me/password`, `/api/v1/me/email`,
`/api/v1/me/delete`), or they hand a stored credential back to the
person who owns it. Those operations name `SessionCookie` and nothing
else, so a client generated from this document does not offer a key
where a key cannot work.
Every write made with this cookie also needs the CSRF double-submit
header: send the `lp_csrf` cookie''s value in `X-CSRF-Token` on `POST`,
`PUT`, `PATCH` and `DELETE`, or the request is refused `403
CSRF_REQUIRED`.
While an admin is viewing an account read only, every write made with
this cookie is refused `403 READ_ONLY_IMPERSONATION`. If the view-as
state cannot be read, the request is answered `503
IMPERSONATION_UNAVAILABLE` and nothing is served or written.
The console sends `X-LP-View-As: <user id>` on every write while it
believes it is viewing an account (the `user_id` GET /api/v1/me
reported with `viewing_as` set). A write carrying that header when no
view-as is active, or when the active one is of a different account,
is refused `409 VIEW_AS_CHANGED` and nothing is written: the page''s
picture of the session is stale, and it should re-read GET
/api/v1/me. With a matching view-as the write is still refused `403
READ_ONLY_IMPERSONATION`. Other clients never need to send it.
'