LastPing CI API
The CI API from LastPing — 2 operation(s) for ci.
The CI API from LastPing — 2 operation(s) for ci.
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-ci-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 CI 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: CI
paths:
/api/v1/checks/{id}/runs:
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: listCIRuns
summary: List run history for a check (CI/CD runs and agent/heartbeat runs)
description: 'Returns the last N runs for the check, newest first — both CI/CD runs
(pings that carry structured `ci_meta`, received from a CI/CD provider
webhook) and agent/heartbeat runs (pings that carry only a `rid` set at
`/start`, with no `ci_meta`). A ping with neither `ci_meta` nor a `rid`
is not a run and is excluded.
CI runs include the full failure context decoded from `ci_meta`:
`run_url`, `commit_sha`, `branch`, `actor`, `failing_stage`, `duration_s`,
and `outcome`. These fields are CI-only — they are simply absent
(omitted, not null or empty string) on an agent/heartbeat run. When a
matching incident (opened within ±10 minutes of the ping) exists,
`incident_cause`, `incident_detail`, and `incident_resolved` are
populated on either kind — enabling unattended failure triage without
following links to the CI provider.
`duration_ms` is separate from `duration_s` and is NOT CI-only: it is
the wall-clock duration LastPing itself measured from the run''s
`/start` -> success timing, present on any run (CI or agent/heartbeat)
whose success ping paired with its start. Use it to answer "how long
does this job normally take?" for a non-CI monitor, where `duration_s`
is never populated.
Every entry also carries the run id (`rid`) and, when the run reported
progress markers to `//step?rid=…`, the `steps` it reached. A run
that stalled therefore names the step it wedged on without a second
call. Steps are matched on `rid`, so they appear only when the job or
agent posts `/step` with the same run id it started with.
Always returns a JSON array (never null).'
tags:
- CI
security:
- ApiKeyAuth: []
parameters:
- name: limit
in: query
required: false
description: Maximum number of runs to return (default 20, max 100).
schema:
type: integer
default: 20
maximum: 100
example: 20
responses:
'200':
description: Array of runs — CI runs and agent/heartbeat runs (may be empty).
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CIRun'
'400':
description: id is not a valid UUID.
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'
/ci/{id}/detail:
parameters:
- name: id
in: path
required: true
description: 'Check UUID. Identifies the check whose open incident is annotated, and
— while the X-LastPing-Token header remains optional — also acts as a
capability token. Keep this UUID confidential.
'
schema:
type: string
format: uuid
example: 550e8400-e29b-41d4-a716-446655440000
- name: X-LastPing-Token
in: header
required: false
description: 'The check''s CI secret — the same value the provider webhook signs with,
revealed (password-gated) under the monitor''s CI settings. Compared in
constant time.
Sending it is currently optional so that workflows written before this
header existed keep working, but it WILL become mandatory: a call that
does not authenticate is rate limited and logged today, and rejected
with 401 once enforcement is switched on. Send it.
'
schema:
type: string
example: s3cr3t-from-the-monitor-ci-settings
post:
operationId: attachCIFailureDetail
summary: Attach CI failure detail to the open incident
description: 'Stores a bounded (<=64 KB) failure log excerpt on the check''s most recent
open incident. Intended to be called from a CI workflow''s if: failure()
step so the failure reason is visible inside LastPing without needing to
follow a link to the CI provider.
Authentication: present the check''s CI secret in the X-LastPing-Token
header; it is compared in constant time. No X-Api-Key header is required
or checked. A request that does not authenticate is rate limited per
check (10 per 15 minutes) and falls back to the check UUID in the path as
a capability token — until enforcement is switched on, after which it is
rejected with 401.
Idempotency / race: if there is no open incident when this request arrives
the request is accepted as a no-op and 200 OK is returned.
Privacy: the detail body is never logged on the server side.'
tags:
- CI
requestBody:
required: true
description: 'Raw text body containing the failure log excerpt. Truncated server-side
to 64 KB if longer.
'
content:
text/plain:
schema:
type: string
example: 'STEP failed: go test ./... exited with code 1'
responses:
'200':
description: 'Detail accepted. Returns 200 OK whether or not an open incident
existed (no open incident = accepted no-op).
'
'401':
description: 'The CI secret was missing or wrong, and enforcement is switched on.
'
content:
text/plain:
schema:
type: string
'404':
description: 'The id path segment is not a valid UUID, or no such check exists.
'
content:
text/plain:
schema:
type: string
'429':
description: 'Too many unauthenticated calls for this check (10 per 15 minutes).
Authenticated calls are not counted against this window.
'
content:
text/plain:
schema:
type: string
components:
schemas:
RunStep:
type: object
description: 'One progress marker reported inside an armed run via
`GET|HEAD|POST https://ping.lastping.dev/<uuid>/step?rid=<run-id>&step=<name>`.
A step resets the monitor''s stall clock (`step_timeout_s`) and is
recorded on the run''s timeline. It does **not** change the monitor''s
status, does not count as a ping for silence detection, and does not
extend the run budget `COALESCE(max_runtime_s, grace_s)`.
'
properties:
seq:
type: integer
format: int32
description: 1-based position of this step within its run.
example: 2
name:
type: string
description: 'Step label from `?step=`, trimmed and truncated to 200 characters.
Defaults to `step` when the parameter is absent or blank.
'
example: db migrate
at:
type: string
format: date-time
description: RFC 3339 UTC timestamp when the step ping was received.
example: '2026-07-20T10:04:00Z'
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.
CIRun:
type: object
description: 'A single run entry — either a CI/CD run (structured failure context
decoded from `ci_meta`) or an agent/heartbeat run (only `rid` set, no
`ci_meta`) — plus the nearest correlated incident. Designed for agent
consumption: all fields are flat (no nesting) so failure triage does not
require link-following. Fields marked "CI-only" below are omitted
entirely on an agent/heartbeat run.
'
required:
- id
- kind
- received_at
- incident_resolved
- span_count
- tokens_in
- tokens_out
- cost_usd
- cost_source
properties:
id:
type: string
format: uuid
description: Ping UUID that represents this CI run.
example: a0b1c2d3-0000-0000-0000-000000000001
kind:
type: string
description: 'Ping kind. One of `success`, `start`, `fail`, `log`, `cancel`,
`blocked`, `note` (see the `Ping` schema); CI/CD webhooks
typically post `success` or `fail`.
'
example: fail
received_at:
type: string
format: date-time
description: RFC 3339 UTC timestamp when the ping was received.
example: '2026-07-20T10:00:00Z'
rid:
type: string
description: 'Run id this ping carried (`?rid=`), omitted when the ping carried
none. It is the key `steps` are matched on.
'
example: '9876543210'
title:
type: string
description: 'Title for this run, stored on the run''s `/start` ping — distinct
from `body_excerpt`. Matched on `rid`
the same way `steps` is — both pings of a run (its start and its
terminal ping) carry it. Set by whichever call reaches it FIRST
with a non-empty title: the body of the run''s own `/start` call,
or a later `POST .../title?rid=<run-id>` sent any time while the
run is still open — same request shape as `/blocked` and `/note`,
but (unlike them) it records no ping of its own: it only
ever sets `title` on the run''s existing `/start` ping, so it
never appears as a `kind` in the `Ping` schema. Only the first
non-empty write counts; neither a later `/start` body nor a
later `/title` call can change a title once one is set. Omitted
when nothing has set a title yet, which is the common case:
every existing monitor''s runs are untitled until a caller starts
setting one.
'
example: nightly backup
steps:
type: array
description: 'Progress markers the run reported to `/<uuid>/step?rid=…`, in the
order they happened. Omitted entirely when the run reported none —
an absent `steps` means the run was not instrumented with steps, not
that it reported zero.
Steps are matched on `rid`, so a CI run only carries them when the
job posted `/step` with the same run id the CI webhook reports. The
two pings of one run (its `start` and its terminal ping) share a rid
and therefore both carry that run''s timeline.
At most 100 steps are stored per run.
'
items:
$ref: '#/components/schemas/RunStep'
run_url:
type: string
description: 'CI-only. Direct URL to the CI/CD run page. Omitted when unavailable,
and always omitted on an agent/heartbeat run.
'
example: https://github.com/acme/repo/actions/runs/9876543210
commit_sha:
type: string
description: 'CI-only. Full or abbreviated commit SHA that triggered the run.
Omitted when unavailable, and always omitted on an agent/heartbeat run.
'
example: deadbeefcafe0000
branch:
type: string
description: 'CI-only. Branch name that triggered the run. Omitted when
unavailable, and always omitted on an agent/heartbeat run.
'
example: main
actor:
type: string
description: 'CI-only. Username or identity that triggered the run. Omitted when
unavailable, and always omitted on an agent/heartbeat run.
'
example: octocat
failing_stage:
type: string
description: "CI-only. Name of the failing step or job (omitted when unavailable,\nand always omitted on an agent/heartbeat run).\n\nAvailability differs by provider:\n * **GitLab CI** — always populated on a failed pipeline, from the\n stage of the first failed entry in the hook's `builds[]`.\n * **GitHub Actions** — requires the repository webhook to\n subscribe to **Workflow jobs** (`workflow_job`) in addition to\n **Workflow runs**. Only `workflow_job` carries per-step\n conclusions; with `workflow_run` alone this field is always\n omitted.\n * **Jenkins** — never populated. The Notification Plugin payload\n reports only the build's overall result and carries no\n per-stage or per-step detail.\n"
example: go test ./...
duration_s:
type: integer
format: int64
description: 'CI-only. Run duration in seconds. Omitted when unavailable or zero,
and always omitted on an agent/heartbeat run.
'
example: 120
duration_ms:
type: integer
format: int64
description: 'Wall-clock duration in milliseconds, measured by LastPing from the
run''s `/start` -> success timing (`pings.duration_ms`). Present on
ANY completed run — CI or agent/heartbeat — whose success ping
paired with a preceding start on the same `rid`; omitted otherwise.
Distinct from `duration_s`: that field is CI-only and self-reported
by the provider from `ci_meta`, this one is computed by LastPing
for every run kind. The two can each be present without the other
and must not be treated as confirming each other.
'
example: 128734
outcome:
type: string
description: 'CI-only. Normalised run outcome string from the CI provider (e.g.
`failure`, `success`). Always omitted on an agent/heartbeat run.
'
example: failure
incident_cause:
type: string
description: 'Cause from the correlated incident (e.g. `silence`, `fail`,
`overrun`, `never_started`, `runaway`, `stalled`, `blocked`,
`upstream`) if
one was opened within ±10 minutes of this run. Empty when no
incident correlates.
'
example: fail
incident_detail:
type: string
description: 'Log excerpt attached to the correlated incident via the `/ci/{id}/detail`
endpoint. Empty when no detail has been posted or no incident correlates.
'
example: 'STEP failed: go test ./... exited with code 1'
incident_resolved:
type: boolean
description: 'True when the correlated incident has been closed (resolved). False when
the incident is still open or when no incident correlates.
'
example: false
span_count:
type:
- integer
- 'null'
format: int64
description: Number of OTLP spans recorded for this run. Null when the run was never traced.
example: 14
tokens_in:
type:
- integer
- 'null'
format: int64
description: Sum of `gen_ai.usage.input_tokens` across this run's GenAI spans. Null when the run was never traced.
example: 1820
tokens_out:
type:
- integer
- 'null'
format: int64
description: Sum of `gen_ai.usage.output_tokens` across this run's GenAI spans. Null when the run was never traced.
example: 340
cost_usd:
type:
- string
- 'null'
description: 'Summed cost of this run''s GenAI spans, as decimal text, never a
JSON number. Each span''s cost is the one its SDK reported
(`gen_ai.usage.cost`) or, when it reported none, LastPing''s
estimate from the model''s published price and the span''s token
counts (`cost_source` says
which). Null when the run was never traced, or when no
span has either: no reported cost and no known price for its
model.
'
example: '0.021400'
cost_source:
type: string
description: 'What `cost_usd` is made of. A plain string, not an enum, so a new
value never breaks a client: `client` when every priced call''s
cost was reported by the client (the exporter''s own figure, or
Claude Code''s per-call cost), `estimated` when LastPing priced
every call at API list prices, `mixed` when the sum holds both,
empty when `cost_usd` is null.
'
example: estimated
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.
'