API Documentation

The PingBase API is a REST API that lets you manage monitors, retrieve check results, and configure your status page programmatically.

Base URL

https://pingba-se-worker.pingbase.workers.dev

All endpoints accept and return application/json. All authenticated requests require a Bearer token in the Authorization header.

Authentication

PingBase supports two authentication methods: JWT tokens (for interactive use) and API keys (for CI, scripts, and integrations). Both use the same Authorization: Bearer header.

JWT Token — for interactive use, expires after 7 days
# Get a token via login
curl -X POST https://pingba-se-worker.pingbase.workers.dev/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"yourpassword"}'

# Use the token
Authorization: Bearer eyJ...
API Key — for CI/CD, scripts, CLI, and integrations. Never expires.
# Create an API key in Dashboard → API Keys
# Keys look like: pb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Use the key exactly like a JWT token
Authorization: Bearer pb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Or via environment variable (for CLI and integrations)
export PINGBASE_API_KEY=pb_live_...

Requests without a valid token to authenticated endpoints return 401 Unauthorized.

Errors

All errors return a JSON body with an error field.

{ "error": "Invalid email or password (min 8 chars)" }
StatusMeaning
400Bad request — missing or invalid parameters
401Unauthorized — missing or invalid token
403Forbidden — plan limit reached
404Resource not found
409Conflict — e.g. email already registered
500Internal server error

Auth

POST /api/auth/register

Create a new account. Returns a JWT token and creates a default status page.

Request
{
  "email": "you@example.com",
  "password": "minlength8"
}
Response 200
{
  "token": "eyJ...",
  "plan": "free",
  "statusPageSlug": "you-a1b2c3"
}
curl
curl -X POST https://pingba-se-worker.pingbase.workers.dev/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"mypassword"}'
POST /api/auth/login

Log in to an existing account. Returns a fresh JWT token valid for 7 days.

Request
{
  "email": "you@example.com",
  "password": "mypassword"
}
Response 200
{
  "token": "eyJ...",
  "plan": "free"
}
curl
curl -X POST https://pingba-se-worker.pingbase.workers.dev/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"mypassword"}'

User

GET /api/me Requires auth

Returns your account details including current plan.

Response 200
{
  "id": "uuid",
  "email": "you@example.com",
  "plan": "free",
  "created_at": 1712345678
}
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/me \
  -H "Authorization: Bearer $TOKEN"

Plan values: free · pro · business · past_due

Monitors

GET /api/monitors Requires auth

Returns all monitors for your account, ordered by creation date.

Response 200
[
  {
    "id": "uuid",
    "user_id": "uuid",
    "name": "My API",
    "url": "https://api.example.com/health",
    "interval_minutes": 5,
    "is_active": 1,
    "status": "up",
    "last_checked_at": 1712345678,
    "created_at": 1712345000
  }
]
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/monitors \
  -H "Authorization: Bearer $TOKEN"
POST /api/monitors Requires auth

Create a new monitor. The check interval is set automatically based on your plan (5 min on Free, 1 min on Pro/Business). Returns 403 if your plan limit is reached.

Request
{
  "name": "My API",
  "url": "https://api.example.com/health"
}
Response 201
{
  "id": "uuid",
  "user_id": "uuid",
  "name": "My API",
  "url": "https://api.example.com/health",
  "interval_minutes": 5,
  "is_active": 1,
  "status": "pending",
  "last_checked_at": null,
  "created_at": 1712345678
}
curl
curl -X POST https://pingba-se-worker.pingbase.workers.dev/api/monitors \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"My API","url":"https://api.example.com/health"}'

Plan limits

Free5 monitors · 5-min checks
Pro10 monitors · 1-min checks
Business50 monitors · 1-min checks
DELETE /api/monitors/:id Requires auth

Delete a monitor. Returns 404 if the monitor doesn't exist or belongs to another user.

Response 200
{ "success": true }
curl
curl -X DELETE \
  https://pingba-se-worker.pingbase.workers.dev/api/monitors/MONITOR_ID \
  -H "Authorization: Bearer $TOKEN"

Check Results

GET /api/monitors/:id Requires auth

Returns the last 100 check results for a monitor, newest first.

Response 200
[
  {
    "id": "uuid",
    "monitor_id": "uuid",
    "status": "up",
    "response_time_ms": 142,
    "status_code": 200,
    "error": null,
    "checked_at": 1712345678
  },
  {
    "id": "uuid",
    "monitor_id": "uuid",
    "status": "down",
    "response_time_ms": null,
    "status_code": null,
    "error": "Connection timeout",
    "checked_at": 1712345378
  }
]
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/monitors/MONITOR_ID \
  -H "Authorization: Bearer $TOKEN"

status"up" or "down"

response_time_ms — null when the check failed to connect

status_code — the HTTP status code returned, or null on connection failure

checked_at — Unix timestamp (seconds)

Status Page

GET /api/status-page Requires auth

Returns your status page configuration including its public slug.

Response 200
{
  "id": "uuid",
  "user_id": "uuid",
  "slug": "you-a1b2c3",
  "title": "My Status Page",
  "description": null,
  "created_at": 1712345000
}
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/status-page \
  -H "Authorization: Bearer $TOKEN"

The public URL for this status page is https://pingba.se/status/{slug}

POST /api/status-page/monitors Requires auth

Add a monitor to your public status page. Monitors are shown in the order they were added. Adding a monitor that's already on the page is a no-op.

Request
{
  "monitor_id": "uuid"
}
Response 200
{ "success": true }
curl
curl -X POST \
  https://pingba-se-worker.pingbase.workers.dev/api/status-page/monitors \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"monitor_id":"MONITOR_ID"}'
GET /api/status/:slug Public

Returns the public status page data for a given slug. No authentication required. This is the endpoint that powers the public status page at pingba.se/status/:slug.

Response 200
{
  "title": "Acme Corp Status",
  "description": null,
  "overall_status": "operational",
  "monitors": [
    {
      "id": "uuid",
      "name": "Main Website",
      "url": "https://acme.com",
      "status": "up",
      "last_checked_at": 1712345678,
      "uptime_pct": "99.98",
      "incidents": []
    }
  ]
}
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/status/your-slug

overall_status"operational" (all up) · "degraded" (any down) · "unknown" (no checks yet)

uptime_pct — 90-day uptime percentage as a string, or null if no checks recorded yet

incidents — up to 5 recent incidents with started_at, resolved_at, and is_resolved

Heartbeat

Heartbeat monitors watch your cron jobs and background tasks. Each heartbeat monitor has a unique token. Your job pings the URL on schedule — if PingBase doesn't receive a ping within the expected interval, it alerts you.

GET /api/heartbeat/:token Public

Send a ping for a heartbeat monitor. Also accepts POST and HEAD. Get the token from the dashboard (expand a heartbeat monitor → Copy Ping URL).

curl
curl https://pingba-se-worker.pingbase.workers.dev/api/heartbeat/YOUR_HEARTBEAT_TOKEN
Response 200
{ "ok": true }

Example: ping from a cron job

# In crontab or CI — run your job, then ping PingBase
0 3 * * * /usr/bin/backup.sh && curl -s https://pingba-se-worker.pingbase.workers.dev/api/heartbeat/YOUR_TOKEN

API Keys

API keys are permanent tokens for use in CI/CD, scripts, and integrations. They work as drop-in replacements for JWT tokens — use them in the Authorization: Bearer header or as the PINGBASE_API_KEY environment variable for the CLI and MCP server.

GET /api/api-keys Requires auth

List all API keys (names and IDs only — the key itself is only shown once at creation).

Response 200
[
  {
    "id": "uuid",
    "name": "CI pipeline",
    "created_at": 1712345678
  }
]
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/api-keys \
  -H "Authorization: Bearer $TOKEN"
POST /api/api-keys Requires auth

Create a new API key. The full key is returned once and cannot be retrieved again — store it securely.

Request
{ "name": "CI pipeline" }
Response 200
{
  "id": "uuid",
  "name": "CI pipeline",
  "key": "pb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "created_at": 1712345678
}
DELETE /api/api-keys/:id Requires auth

Revoke an API key. All requests using that key will immediately return 401.

curl
curl -X DELETE \
  https://pingba-se-worker.pingbase.workers.dev/api/api-keys/KEY_ID \
  -H "Authorization: Bearer $TOKEN"

Health

GET /api/health Public

Returns worker status. Use this to verify the API is reachable.

Response 200
{ "ok": true, "ts": 1712345678000 }
curl
curl https://pingba-se-worker.pingbase.workers.dev/api/health

CLI

The pingbase-cli lets you manage monitors, check status, and list incidents from your terminal.

Install
npm install -g pingbase-cli
Authenticate
# Create an API key in Dashboard → API Keys, then:
export PINGBASE_API_KEY=pb_live_...
Commands
# List all monitors
pingbase monitors

# Add an HTTP monitor
pingbase add "My API" https://api.example.com

# Add a heartbeat monitor (for cron jobs)
pingbase add "Nightly Backup" --type heartbeat --interval 1440

# View recent checks for a monitor
pingbase status <monitor-id>

# Delete a monitor
pingbase delete <monitor-id>

# List active incidents
pingbase incidents

# Manage API keys
pingbase keys list
pingbase keys create "CI pipeline"
pingbase keys revoke <key-id>
Variable Description Default
PINGBASE_API_KEYYour API key (required)
PINGBASE_API_URLOverride API base URLhttps://pingba-se-worker.pingbase.workers.dev/api

MCP Server (AI)

The pingbase-mcp package exposes PingBase as an MCP (Model Context Protocol) server, letting Claude Code and other AI assistants manage your monitors via natural language.

Install
npm install -g pingbase-mcp
Configure in Claude Code — add to ~/.claude/settings.json or project .mcp.json
{
  "mcpServers": {
    "pingbase": {
      "command": "pingbase-mcp",
      "env": {
        "PINGBASE_API_KEY": "pb_live_..."
      }
    }
  }
}
Tool Description
list_monitorsList all monitors with current status
create_monitorCreate a new HTTP or heartbeat monitor
delete_monitorDelete a monitor by ID
get_monitor_statusGet recent check results for a monitor
list_incidentsList active and recent incidents
create_incidentPost a manual incident to your status page
update_incidentUpdate incident status (investigating → resolved)

Example prompts in Claude Code

  • "Check if any of my monitors are down"
  • "Create a monitor for https://api.myapp.com called 'Production API'"
  • "Post an incident saying we're investigating slow response times"
  • "Resolve the investigating incident"

GitHub Action

The PingBase GitHub Action checks your monitor status in CI/CD workflows. Use it to gate deployments, verify production health after a deploy, or block PRs when monitors are down.

Setup
# 1. Create an API key: Dashboard → API Keys
# 2. Add it as a GitHub secret: Settings → Secrets → PINGBASE_API_KEY
Basic usage — check all monitors
- name: Check uptime monitors
  uses: pingbase/check-monitors@v1
  with:
    api-key: ${{ secrets.PINGBASE_API_KEY }}
Deploy-time health check — fail if production is down
- name: Deploy
  run: npm run deploy

- name: Verify production health
  uses: pingbase/check-monitors@v1
  with:
    api-key: ${{ secrets.PINGBASE_API_KEY }}
    fail-on-down: 'true'
Check a specific monitor
- name: Check production API monitor
  uses: pingbase/check-monitors@v1
  with:
    api-key: ${{ secrets.PINGBASE_API_KEY }}
    monitor-id: your-monitor-id
    fail-on-down: 'true'

Inputs

api-keyAPI key (required)
monitor-idSpecific monitor (all if omitted)
fail-on-downFail workflow if down (default: true)
api-urlOverride API base URL

Outputs

statusOverall: up, down, or pending
monitors-downComma-separated IDs of down monitors
monitors-upComma-separated IDs of up monitors