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.
# 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...
# 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)" }
| Status | Meaning |
|---|---|
| 400 | Bad request — missing or invalid parameters |
| 401 | Unauthorized — missing or invalid token |
| 403 | Forbidden — plan limit reached |
| 404 | Resource not found |
| 409 | Conflict — e.g. email already registered |
| 500 | Internal server error |
Auth
/api/auth/register
Create a new account. Returns a JWT token and creates a default status page.
{
"email": "you@example.com",
"password": "minlength8"
}
{
"token": "eyJ...",
"plan": "free",
"statusPageSlug": "you-a1b2c3"
}
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"}'
/api/auth/login
Log in to an existing account. Returns a fresh JWT token valid for 7 days.
{
"email": "you@example.com",
"password": "mypassword"
}
{
"token": "eyJ...",
"plan": "free"
}
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
/api/me
Requires auth
Returns your account details including current plan.
{
"id": "uuid",
"email": "you@example.com",
"plan": "free",
"created_at": 1712345678
}
curl https://pingba-se-worker.pingbase.workers.dev/api/me \ -H "Authorization: Bearer $TOKEN"
Plan values: free · pro · business · past_due
Monitors
/api/monitors
Requires auth
Returns all monitors for your account, ordered by creation date.
[
{
"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 https://pingba-se-worker.pingbase.workers.dev/api/monitors \ -H "Authorization: Bearer $TOKEN"
/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.
{
"name": "My API",
"url": "https://api.example.com/health"
}
{
"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 -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
| Free | 5 monitors · 5-min checks |
| Pro | 10 monitors · 1-min checks |
| Business | 50 monitors · 1-min checks |
/api/monitors/:id
Requires auth
Delete a monitor. Returns 404 if the monitor doesn't exist or belongs to another user.
{ "success": true }
curl -X DELETE \ https://pingba-se-worker.pingbase.workers.dev/api/monitors/MONITOR_ID \ -H "Authorization: Bearer $TOKEN"
Check Results
/api/monitors/:id
Requires auth
Returns the last 100 check results for a monitor, newest first.
[
{
"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 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
/api/status-page
Requires auth
Returns your status page configuration including its public slug.
{
"id": "uuid",
"user_id": "uuid",
"slug": "you-a1b2c3",
"title": "My Status Page",
"description": null,
"created_at": 1712345000
}
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}
/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.
{
"monitor_id": "uuid"
}
{ "success": true }
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"}'
/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.
{
"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 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.
/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 https://pingba-se-worker.pingbase.workers.dev/api/heartbeat/YOUR_HEARTBEAT_TOKEN
{ "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.
/api/api-keys
Requires auth
List all API keys (names and IDs only — the key itself is only shown once at creation).
[
{
"id": "uuid",
"name": "CI pipeline",
"created_at": 1712345678
}
]
curl https://pingba-se-worker.pingbase.workers.dev/api/api-keys \ -H "Authorization: Bearer $TOKEN"
/api/api-keys
Requires auth
Create a new API key. The full key is returned once and cannot be retrieved again — store it securely.
{ "name": "CI pipeline" }
{
"id": "uuid",
"name": "CI pipeline",
"key": "pb_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": 1712345678
}
/api/api-keys/:id
Requires auth
Revoke an API key. All requests using that key will immediately return 401.
curl -X DELETE \ https://pingba-se-worker.pingbase.workers.dev/api/api-keys/KEY_ID \ -H "Authorization: Bearer $TOKEN"
Health
/api/health
Public
Returns worker status. Use this to verify the API is reachable.
{ "ok": true, "ts": 1712345678000 }
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.
npm install -g pingbase-cli
# Create an API key in Dashboard → API Keys, then: export PINGBASE_API_KEY=pb_live_...
# 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_KEY | Your API key (required) | — |
| PINGBASE_API_URL | Override API base URL | https://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.
npm install -g pingbase-mcp
{
"mcpServers": {
"pingbase": {
"command": "pingbase-mcp",
"env": {
"PINGBASE_API_KEY": "pb_live_..."
}
}
}
}
| Tool | Description |
|---|---|
| list_monitors | List all monitors with current status |
| create_monitor | Create a new HTTP or heartbeat monitor |
| delete_monitor | Delete a monitor by ID |
| get_monitor_status | Get recent check results for a monitor |
| list_incidents | List active and recent incidents |
| create_incident | Post a manual incident to your status page |
| update_incident | Update 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.
# 1. Create an API key: Dashboard → API Keys # 2. Add it as a GitHub secret: Settings → Secrets → PINGBASE_API_KEY
- name: Check uptime monitors
uses: pingbase/check-monitors@v1
with:
api-key: ${{ secrets.PINGBASE_API_KEY }}
- 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'
- 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-key | API key (required) |
| monitor-id | Specific monitor (all if omitted) |
| fail-on-down | Fail workflow if down (default: true) |
| api-url | Override API base URL |
Outputs
| status | Overall: up, down, or pending |
| monitors-down | Comma-separated IDs of down monitors |
| monitors-up | Comma-separated IDs of up monitors |