LastPing Auth API
The Auth API from LastPing — 5 operation(s) for auth.
The Auth API from LastPing — 5 operation(s) for auth.
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-auth-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 Auth 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: Auth
paths:
/api/v1/whoami:
get:
operationId: getWhoami
summary: Auth smoke-test
description: 'Returns the authenticated project_id, and for an API key its kind,
scope and expiry. Useful for verifying the API key is valid and what
it may do. `kind`, `scope` and `expires_at` are null for a console
session. `resource` is present only for an OAuth access token, which
is usable only through the LastPing MCP server.'
tags:
- Auth
security:
- ApiKeyAuth: []
- SessionCookie: []
responses:
'200':
description: API key is valid; returns the associated project_id and the key's kind, scope and expiry.
content:
application/json:
schema:
type: object
required:
- project_id
- kind
- scope
- expires_at
properties:
project_id:
type: string
format: uuid
example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
kind:
type:
- string
- 'null'
enum:
- key
- oauth
- null
description: '`key` for an API key, `oauth` for an OAuth access token made by connecting an app; null for a console session.'
example: key
scope:
type:
- string
- 'null'
enum:
- read
- write
- admin
- ingest
- null
description: The credential's scope; null for a console session.
example: write
expires_at:
type:
- string
- 'null'
format: date-time
description: When the credential expires; null when it never does, and for a console session.
example: null
resource:
type: string
description: The MCP resource an OAuth access token was issued for. Present only when kind is oauth.
example: https://mcp.lastping.dev/mcp
example:
project_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
kind: key
scope: write
expires_at: null
'401':
description: Missing or invalid API key.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
/api/v1/me:
get:
operationId: getMe
summary: Get authenticated principal
description: 'Returns the authenticated principal''s project ID and auth method.
For API-key-authenticated requests only `project_id` and `auth` are
present. For session-authenticated requests `user_id`, `email`,
`provider`, `theme`, and `console` are also included.'
tags:
- Auth
security:
- ApiKeyAuth: []
responses:
'200':
description: Authenticated principal details.
content:
application/json:
schema:
type: object
required:
- project_id
- auth
properties:
project_id:
type: string
format: uuid
description: Project the credential belongs to.
example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
auth:
type: string
enum:
- apikey
- session
description: '`apikey` for API-key requests; `session` for cookie-authenticated requests.'
example: apikey
user_id:
type: string
format: uuid
description: User ID (session-authenticated only).
example: d4c3b2a1-f6e5-0987-dcba-fe4321098765
email:
type: string
format: email
description: Verified email address (session-authenticated only).
example: user@example.com
provider:
type: string
description: 'How the account was created: `local` (email and password), `github` or `google` (session-authenticated only). It records the sign-up, not how the account signs in now: removing that GitHub or Google sign-in later leaves this value unchanged.'
example: github
theme:
type: string
enum:
- light
- dark
description: Dashboard colour theme (session-authenticated only).
example: light
console:
type: string
enum:
- templates
- spa
description: Always `spa` since the console cut-over; kept so existing clients do not break. Read-only (session-authenticated only).
example: spa
last_seen_at:
type:
- string
- 'null'
format: date-time
description: When this user last called POST /api/v1/me/seen (session-authenticated only). Null until then.
example: '2026-09-12T10:00:00Z'
viewing_as:
type:
- object
- 'null'
description: 'Session-authenticated only. Set while an admin is viewing this
account read only (the fields above then describe the account
being viewed); null otherwise. Every write made in that state
is refused 403 `READ_ONLY_IMPERSONATION`.
'
required:
- email
- expires_at
properties:
email:
type: string
format: email
description: The account being viewed.
expires_at:
type: string
format: date-time
description: When the view-as session ends on its own.
examples:
apikey:
summary: API key authentication
value:
project_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
auth: apikey
session:
summary: Session authentication
value:
project_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
auth: session
user_id: d4c3b2a1-f6e5-0987-dcba-fe4321098765
email: user@example.com
provider: github
theme: light
console: spa
last_seen_at: null
viewing_as: null
'401':
description: Missing or invalid credentials.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'503':
description: 'Session-authenticated only. An admin''s view-as session is active
but the viewed account cannot be read (it has no project, or the
view-as state could not be looked up), so nothing is served. Code
`IMPERSONATION_UNAVAILABLE`. POST /admin/view-as/end still works.
'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
/api/v1/me/password:
post:
operationId: changeMyPassword
summary: Change the session's own password
description: '**Session-only.** Validates `current_password` (skipped for an
OAuth-only account with no password set yet), persists
`new_password`, then revokes every OTHER session for the account and
issues a fresh one for this request''s cookie — a password change is
how a user locks out anyone else holding a live session for the
account.
An account with no password yet can set one only within 15 minutes
of signing in; changing a password does not count as signing in.
Outside that window the answer is 403 `REAUTH_REQUIRED` and nothing
is saved.
This does **not** revoke API keys: a key holder keeps full API
access across a password change. Revoking keys on password change is
a separate, planned capability; a user who suspects a leaked key
must revoke it via `DELETE /api/v1/api-keys/{id}`.
An API-key request gets 403 `SESSION_ONLY`, never 404. Being a
write, it also requires the CSRF double-submit header: 403
`CSRF_REQUIRED` if `X-CSRF-Token` is missing or does not match the
`lp_csrf` cookie.'
tags:
- Auth
security:
- SessionCookie: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChangePasswordRequest'
responses:
'204':
description: Password changed. This request's session cookie has been refreshed.
'400':
description: '`INVALID_PASSWORD` — new_password was not 8-200 characters — or
`WRONG_PASSWORD` — current_password did not match.
'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'403':
description: 'The request used an API key rather than a session cookie
(`SESSION_ONLY`), the session request was missing a valid
`X-CSRF-Token` header (`CSRF_REQUIRED`), or the account has no
password yet and this session carries no sign-in within the last
15 minutes (`REAUTH_REQUIRED`; sign in again, then set it).
'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
/api/v1/me/email:
post:
operationId: changeMyEmail
summary: Request a new-address verification for the session's own account
description: '**Session-only.** Sends a one-time verification link to `new_email`;
the account''s email is **not** changed yet — completion happens when
the link is clicked. Answers 204 (no-op) when `new_email` is already
the caller''s own verified address, with nothing sent.
An API-key request gets 403 `SESSION_ONLY`, never 404. Being a
write, it also requires the CSRF double-submit header: 403
`CSRF_REQUIRED` if `X-CSRF-Token` is missing or does not match the
`lp_csrf` cookie.'
tags:
- Auth
security:
- SessionCookie: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChangeEmailRequest'
responses:
'202':
description: Verification link sent to new_email. The account's email has not changed yet.
'204':
description: new_email is already the caller's own verified address. Nothing was sent.
'400':
description: '`INVALID_EMAIL` — new_email failed format validation — or
`WRONG_PASSWORD` — current_password did not match.
'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'403':
description: 'The request used an API key rather than a session cookie
(`SESSION_ONLY`), or the session request was missing a valid
`X-CSRF-Token` header (`CSRF_REQUIRED`).
'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'409':
description: '`EMAIL_IN_USE` — new_email is already verified on another account.'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
/api/v1/me/delete:
post:
operationId: deleteMyAccount
summary: Permanently delete the session's own account
description: '**Session-only.** `email` must exactly match (case-insensitive,
trimmed) the account''s own email — typed confirmation, the same
guard the dashboard''s delete-account form uses. On success, deletes
the account and everything that belongs to it (projects, monitors,
destinations, pings, incidents, deliveries, API keys, status pages,
sessions and more) and clears this request''s
session cookie.
The delete target is ALWAYS the session''s own user — never a
request-supplied id — so there is no IDOR surface here.
An API-key request gets 403 `SESSION_ONLY`, never 404. Being a
write, it also requires the CSRF double-submit header: 403
`CSRF_REQUIRED` if `X-CSRF-Token` is missing or does not match the
`lp_csrf` cookie.'
tags:
- Auth
security:
- SessionCookie: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteAccountRequest'
responses:
'204':
description: Account deleted. The session cookie has been cleared.
'400':
description: '`EMAIL_MISMATCH` — email did not match the account''s own address. Nothing was deleted.'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'403':
description: 'The request used an API key rather than a session cookie
(`SESSION_ONLY`), or the session request was missing a valid
`X-CSRF-Token` header (`CSRF_REQUIRED`).
'
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Problem'
'429':
$ref: '#/components/responses/RateLimited'
components:
schemas:
ChangePasswordRequest:
type: object
description: Body for POST /api/v1/me/password.
required:
- current_password
- new_password
properties:
current_password:
type: string
description: 'The account''s current password. Ignored (any value accepted) for
an OAuth-only account with no password set yet. Such an account
proves itself with a recent sign-in instead: it can set its first
password only within 15 minutes of signing in (403
`REAUTH_REQUIRED` otherwise).
'
example: correct horse battery staple
new_password:
type: string
minLength: 8
maxLength: 200
example: a much longer new passphrase
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.
ChangeEmailRequest:
type: object
description: 'Body for POST /api/v1/me/email. Unlike the equivalent dashboard
form, this REST endpoint requires `current_password`: it is a
directly-scriptable surface with no browser session UI in the loop,
so it gets the same current-password re-proof
POST /api/v1/me/password already requires for a comparable account
change.
'
required:
- new_email
- current_password
properties:
new_email:
type: string
format: email
maxLength: 254
example: new-address@example.com
current_password:
type: string
example: correct horse battery staple
DeleteAccountRequest:
type: object
description: Body for POST /api/v1/me/delete.
required:
- email
properties:
email:
type: string
format: email
description: 'Must exactly match (case-insensitive, trimmed) the account''s own
email address — typed confirmation, the same guard the
dashboard''s delete-account form uses.
'
example: owner@example.com
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.
'