Skip to main content

API Reference

Authentication

All API requests require authentication. Two methods are available: a personal API key (for most integrations) and a JWT token (for web applications and endpoints that don’t yet support the key).

API Key

Create a personal API key from your profile menu. Use the X-API-Key header:

curl -H "X-API-Key: YOUR_API_KEY" \
  https://pingzen.dev/api/v1/monitors

To create an API key: Click on your profile → API Keys → Create New Key

Where X-API-Key works, and where JWT is required

Important

At this time, X-API-Key is accepted only on the monitors endpoints (CRUD, pause/resume, reorder, main statistics, timeline, second opinion, and CSV export/import). All other endpoints — /workspaces, /alerts, /incidents, /status-pages, /monitor-groups, /probes, /heartbeats (except the no-auth /ping/...), /maintenance, /feedback, /dashboard, /web-push, /scheduled-reports, /webhooks, /webhook-checks, /api-checks, /api-keys, /auth/*, /analytics, /telegram-bot, /alert-channel-configs — currently require a JWT token. This is a divergence from the historical promise of the docs; we’re closing it incrementally.

What X-API-Key covers right now:

GET/api/v1/monitorsCRUD (GET/POST/PATCH/DELETE), /reorder, /pause, /resume, /reset-stats, /results, /timeline, /status-ranges, /response-time-distribution, /cert-chain, /second-opinion, /dnsbl-providers, /export/csv, /import/csv
POST/api/v1/ping/:ping_key/:slugno auth (uses ping_key) — for heartbeats

Inside /monitors/*, these still require JWT (known divergence, being fixed): GET /:id/stats, POST /:id/check, GET /:id/sla, GET /:id/sla/export/csv|pdf, GET /:id/dnsbl/provider-history, POST /test.

JWT Token

For web applications and endpoints that don’t accept the API key, use a JWT from /auth/login:

# 1. Obtain a token (pass email and password)
ACCESS=$(curl -sS -X POST https://pingzen.dev/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@example.com","password":"…"}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["access_token"])')

# 2. Use it as Authorization: Bearer
curl -H "Authorization: Bearer $ACCESS" https://pingzen.dev/api/v1/workspaces

The access token lives for 15 minutes; for long-running integrations use the refresh_token from the same response and the /auth/refresh endpoint.

Endpoints

Complete list of all available API endpoints.

Monitors

Monitor management (22 endpoints, grouped by purpose).

CRUD

GET/api/v1/monitors— List your monitors
POST/api/v1/monitors— Create a monitor
GET/api/v1/monitors/:id— Get monitor details
PATCH/api/v1/monitors/:id— Update monitor
DELETE/api/v1/monitors/:id— Delete monitor

Operations

POST/api/v1/monitors/:id/pause— Pause monitoring
POST/api/v1/monitors/:id/resume— Resume monitoring
POST/api/v1/monitors/:id/check— Run manual check (JWT)
POST/api/v1/monitors/:id/reset-stats— Wipe accumulated history (requires confirm)
PUT/api/v1/monitors/reorder— Set custom display order
POST/api/v1/monitors/test— Test a config without saving (JWT)
GET/api/v1/monitors/export/csv— Export monitor configs as CSV (all workspaces or ?workspace_id=; secrets excluded)
POST/api/v1/monitors/import/csv— Bulk-create monitors from a CSV file (multipart; ?dry_run=true to preview, ?on_duplicate=skip|create; max 500 rows / 1 MB)

CSV import notes: you only need a url column. Files from StatusCake, the UptimeRobot bulk-upload template, and HetrixTools work as they are (, and ; are both detected). A row is a duplicate when the same URL and protocol already exist in the target workspace; duplicates are skipped by default. Without ?workspace_id=, each row goes to the workspace named in its workspace column, and a row with no workspace goes to your default workspace. Monitor names must be unique in your account, so copying one of your own workspaces into another one needs new names — clashes with existing monitors go to skipped with the reason, while rows of one file that share a name get " (2)“, " (3)”. For RTSP, a login in the address (rtsp://user:pass@host/...) moves to auth_username/auth_password, and the checker is picked the way the camera form picks it; its name comes back in the row’s probe field. You can import into your own workspaces, and into shared workspaces where you are an editor or owner (viewers get 403 or a per-row error). UptimeRobot number types (1/2/3/4) and StatusCake DoNotFind are supported. Excel files are not accepted — save them as CSV UTF-8 first. The response lists every row as created, skipped, or failed; one bad row does not stop the others.

Stats & history

GET/api/v1/monitors/:id/stats— Aggregate statistics (JWT)
GET/api/v1/monitors/:id/results— Raw check-result history
GET/api/v1/monitors/:id/timeline— Status change timeline
GET/api/v1/monitors/:id/status-ranges— Run-length-encoded status ranges
GET/api/v1/monitors/:id/response-time-distribution— Response time percentiles (P50/P90/P95/P99)
GET/api/v1/monitors/:id/sla— SLA report (JWT)
GET/api/v1/monitors/:id/sla/export/csv— Export SLA as CSV (JWT)
GET/api/v1/monitors/:id/sla/export/pdf— Export SLA as PDF (JWT)

Diagnostics

GET/api/v1/monitors/:id/cert-chain— Live inspect TLS certificate chain
GET/api/v1/monitors/:id/dnsbl/provider-history— DNSBL per-provider history (JWT)
GET/api/v1/monitors/dnsbl-providers— Default DNSBL provider list
GET/api/v1/monitors/:id/second-opinion— What checkers in other networks saw during the current failure (see Second opinion)

Alerts

Alert configuration.

GET/api/v1/alerts— List alerts
POST/api/v1/alerts— Create alert
PATCH/api/v1/alerts/:id— Update alert
DELETE/api/v1/alerts/:id— Delete alert
POST/api/v1/alerts/:id/test— Send test alert
POST/api/v1/alerts/:id/toggle— Toggle alert active/inactive
GET/api/v1/alerts/:id/history— Get alert delivery history
GET/api/v1/alerts/history— All alert delivery history (per workspace)
GET/api/v1/alerts/channels/availability— Available delivery channels (Telegram, Discord, Email, Slack, …)
POST/api/v1/alerts/test-send— Send a test message to an arbitrary channel (without saving an alert)

Incidents

Incident management.

GET/api/v1/incidents— List incidents
GET/api/v1/incidents/stats— Aggregate incident stats (total/ongoing/resolved/MTTR)
GET/api/v1/incidents/:id— Get incident details
PUT/api/v1/incidents/:id— Update incident
POST/api/v1/incidents/:id/updates— Add status update
POST/api/v1/incidents/:id/resolve— Resolve incident
DELETE/api/v1/incidents/:id— Delete incident

Status Pages

Public status pages.

GET/api/v1/status-pages— List status pages
POST/api/v1/status-pages— Create status page
GET/api/v1/status-pages/:id— Get status page
PUT/api/v1/status-pages/:id— Update status page
DELETE/api/v1/status-pages/:id— Delete status page
POST/api/v1/status-pages/:id/monitors— Add a monitor to the status page
DELETE/api/v1/status-pages/:id/monitors/:monitor_id— Remove a monitor from the status page
GET/api/v1/public/status/:slug— Public status (no auth)

Workspaces

Workspace management.

GET/api/v1/workspaces— List your workspaces
GET/api/v1/workspaces/default— Get your default workspace (fastest way to discover workspace_id)
GET/api/v1/workspaces/summary— Compact list (id, name) — handy for dropdowns
POST/api/v1/workspaces— Create workspace
PUT/api/v1/workspaces/:id— Update workspace
DELETE/api/v1/workspaces/:id— Delete workspace
POST/api/v1/workspaces/:id/set-default— Set default workspace
POST/api/v1/workspaces/:id/regenerate-ping-key— Rotate ping_key (existing heartbeat ping URLs stop working)
GET/api/v1/workspaces/:id/members— List workspace members (shared workspaces)
POST/api/v1/workspaces/:id/members— Invite a member by email (owner only)
PATCH/api/v1/workspaces/:id/members/:id— Change a member's role: editor or viewer (owner only)
DELETE/api/v1/workspaces/:id/members/:id— Remove a member (owner only)
POST/api/v1/workspaces/:id/invites— Create a one-time invite link, valid 14 days (owner only; works for users without an email)
POST/api/v1/workspaces/invites/accept— Accept an invite link and join the workspace
POST/api/v1/workspaces/:id/leave— Leave a shared workspace (members only; the owner cannot leave)

Heartbeats (Cron)

Cron job monitoring.

GET/api/v1/heartbeats— List heartbeat monitors
POST/api/v1/heartbeats— Create heartbeat monitor
GET/api/v1/heartbeats/:id— Get heartbeat monitor details
PATCH/api/v1/heartbeats/:id— Update heartbeat monitor
DELETE/api/v1/heartbeats/:id— Delete heartbeat monitor
POST/api/v1/heartbeats/:id/pause— Pause heartbeat monitor
POST/api/v1/heartbeats/:id/resume— Resume heartbeat monitor
POST/api/v1/heartbeats/:id/regenerate-secret— Regenerate authentication secret
GET/api/v1/heartbeats/:id/stats— Get heartbeat statistics (uptime, ping counts)
GET/api/v1/heartbeats/:id/pings— Get ping history (paginated)
GET/api/v1/ping/:ping_key/:slug— Record ping via GET (no auth, for simple cron jobs)
POST/api/v1/ping/:ping_key/:slug— Record ping via POST (no auth, with optional payload)
POST/api/v1/ping/:ping_key/:slug/start— Record job start signal (no auth)
POST/api/v1/ping/:ping_key/:slug/success— Record job success signal (no auth)
POST/api/v1/ping/:ping_key/:slug/fail— Record job failure signal (no auth). The body is the log; an error field is shown in the alert
POST/api/v1/ping/:ping_key/:slug/:exit_code— 0 leaves the monitor up, 1–255 marks it Down at once. The body is the log. Above 255 gets 400. POST only

API Keys

API key management.

GET/api/v1/api-keys— List API keys
POST/api/v1/api-keys— Create API key
DELETE/api/v1/api-keys/:id— Revoke API key

Maintenance

Maintenance windows.

GET/api/v1/maintenance— List maintenance windows
POST/api/v1/maintenance— Create maintenance window (optional workspace_id, a workspace you own; your default workspace without it)
GET/api/v1/maintenance/:id— Get maintenance window details
PUT/api/v1/maintenance/:id— Update maintenance window
DELETE/api/v1/maintenance/:id— Delete maintenance window
POST/api/v1/maintenance/:id/cancel— Cancel maintenance

Monitor Groups

Group management (12 endpoints, grouped by purpose).

Group CRUD

GET/api/v1/monitor-groups— List monitor groups
POST/api/v1/monitor-groups— Create monitor group
GET/api/v1/monitor-groups/:id— Get monitor group details
PUT/api/v1/monitor-groups/:id— Update group (name, description, paused flag)
DELETE/api/v1/monitor-groups/:id— Delete monitor group

Memberships (monitors & tags)

POST/api/v1/monitor-groups/:id/monitors— Add monitors to group
DELETE/api/v1/monitor-groups/:id/monitors— Remove monitors from group
POST/api/v1/monitor-groups/:id/tags— Add tags
DELETE/api/v1/monitor-groups/:id/tags— Remove tags

Status & stats

GET/api/v1/monitor-groups/stats— Aggregate stats across all groups
GET/api/v1/monitor-groups/:id/status— Get aggregate group status
PUT/api/v1/monitor-groups/:id/status— Update aggregate group status

Telegram Groups

Telegram group alerts.

GET/api/v1/telegram-groups— List linked Telegram groups
POST/api/v1/telegram-groups/link— Generate deep-link URL for Telegram group
DELETE/api/v1/telegram-groups/:id— Unlink Telegram group

Scheduled Reports

Automated email reports.

GET/api/v1/scheduled-reports— List scheduled reports
POST/api/v1/scheduled-reports— Create scheduled report
GET/api/v1/scheduled-reports/:id— Get report details
PUT/api/v1/scheduled-reports/:id— Update scheduled report
DELETE/api/v1/scheduled-reports/:id— Delete scheduled report
POST/api/v1/scheduled-reports/:id/pause— Pause report
POST/api/v1/scheduled-reports/:id/resume— Resume report
POST/api/v1/scheduled-reports/:id/run— Run report manually
POST/api/v1/scheduled-reports/:id/toggle— Toggle active flag (pause/resume in one call)
GET/api/v1/scheduled-reports/:id/runs— Report execution history

Alert Channel Configs

Channel credentials (SMTP, Twilio, etc.).

GET/api/v1/alert-channel-configs— List channel configurations
POST/api/v1/alert-channel-configs— Create channel config
PATCH/api/v1/alert-channel-configs/:id— Update channel config
DELETE/api/v1/alert-channel-configs/:id— Delete channel config
POST/api/v1/alert-channel-configs/:id/test— Send a test message via this config
POST/api/v1/alert-channel-configs/:id/activate— Activate (re-enable after auto-disable from a delivery error streak)
POST/api/v1/alert-channel-configs/:id/deactivate— Temporarily disable without deleting
GET/api/v1/alert-channel-configs/channels/:channel— Active config for a channel (telegram, discord, slack, …)

Dashboard

Aggregated statistics.

GET/api/v1/dashboard/stats— Aggregated dashboard statistics
GET/api/v1/dashboard/uptime-summary— Overall uptime summary across all monitors
GET/api/v1/dashboard/alerts-summary— Alerts summary
GET/api/v1/dashboard/incidents— Incidents summary
GET/api/v1/dashboard/combined— All dashboard data in one call

Webhooks (Outgoing)

Event webhook delivery (12 endpoints, grouped by purpose).

Webhook CRUD

GET/api/v1/webhooks— List webhooks
POST/api/v1/webhooks— Create webhook
GET/api/v1/webhooks/:id— Get webhook details
PATCH/api/v1/webhooks/:id— Update webhook
DELETE/api/v1/webhooks/:id— Delete webhook

Actions

POST/api/v1/webhooks/:id/test— Send a test payload
POST/api/v1/webhooks/:id/secret— Rotate HMAC signing secret (existing signatures stop being accepted on your side)

Deliveries & DLQ

GET/api/v1/webhooks/:id/deliveries— Delivery history
GET/api/v1/webhooks/:id/stats— Aggregate delivery statistics (success/error/p50/p95)
GET/api/v1/webhooks/:id/dlq— Dead Letter Queue: deliveries that failed all retries
POST/api/v1/webhooks/:id/dlq/:dlq_id/retry— Retry a DLQ entry
POST/api/v1/webhooks/:id/dlq/:dlq_id/resolve— Mark a DLQ entry resolved (without retrying)

Reference

GET/api/v1/webhooks/events— Available event types (used when creating a webhook)

Events

Each delivery is a POST with a JSON body. X-Pinger-Signature-256 holds sha256= and the HMAC-SHA256 of <timestamp>.<body>, the timestamp being the X-Pinger-Timestamp header; X-Pinger-Event repeats the event and X-Pinger-Delivery carries the delivery id. Events go to the webhooks of the workspace owner.

EventSent when
monitor.downA monitor goes down
monitor.recoveredA monitor is up again after being down or degraded
monitor.degradedA monitor becomes degraded
incident.createdAn incident opens: automatically when a monitor goes down, or by hand
incident.updatedThe title, description, severity or status changes, an update is posted, or the incident is acknowledged; changes lists what changed
incident.resolvedAn incident is resolved, or deleted while open ("deleted": true)
certificate.expiringA certificate enters the monitor’s critical window (ssl_critical_days, 7 days by default); once per certificate
certificate.expiredA certificate has expired; once per certificate, within 7 days of expiry
maintenance.scheduledA maintenance window is created, and again each time its schedule is edited; a window entered after it ended sends nothing
maintenance.startedA window begins
maintenance.endedA window completes, is cancelled, or is deleted before it ended ("deleted": true)

Besides event and timestamp, the body carries monitor, status and details for monitor events, incident (plus changes and message when they apply) for incident events, maintenance for maintenance events, and monitor with certificate for certificate events.

Webhook Checks (Incoming)

Accept incoming webhooks from external services (10 endpoints + 1 public receiver, grouped by purpose).

Check CRUD

GET/api/v1/webhook-checks— List incoming webhook checks
POST/api/v1/webhook-checks— Create incoming webhook check
GET/api/v1/webhook-checks/:id— Get webhook check details
PUT/api/v1/webhook-checks/:id— Update webhook check
DELETE/api/v1/webhook-checks/:id— Delete webhook check

Check operations

POST/api/v1/webhook-checks/:id/pause— Pause webhook check
POST/api/v1/webhook-checks/:id/resume— Resume webhook check
POST/api/v1/webhook-checks/:id/regenerate-secret— Rotate secret (the existing HMAC signature from the source stops being accepted)

Events & stats

GET/api/v1/webhook-checks/:id/events— Incoming webhook check events
GET/api/v1/webhook-checks/:id/stats— Aggregate stats for an incoming check

Public receiver (no auth)

POST/api/v1/webhook-check/:slug— Record a delivery (this URL is what you hand to the external service)

Feedback

User feedback and feature requests.

POST/api/v1/feedback— Submit feedback
GET/api/v1/feedback— List feedback
GET/api/v1/feedback/:id— Get feedback details
PUT/api/v1/feedback/:id/status— Update feedback status (admin)
DELETE/api/v1/feedback/:id— Delete feedback (admin)

Web Push

Browser push notifications.

GET/api/v1/web-push/vapid-public-key— Get VAPID public key
GET/api/v1/web-push/subscriptions— List push subscriptions for the current user
POST/api/v1/web-push/subscribe— Subscribe to push notifications
POST/api/v1/web-push/unsubscribe— Unsubscribe from push notifications

Probe

Probe identification and IP addresses.

GET/api/v1/probe/ips— Get probe IP addresses (public, no auth)

Failure categories

A failed or degraded check carries failure_category: on check results and the timeline, as last_failure_category on monitors and status ranges, and on incidents as cause.failure_category (the check that opened the incident) and current_cause.failure_category (the latest failed check, GET /incidents/open only). It names the kind of failure; status stays the verdict.

  • The set is open. New values may be added, including more specific ones that take over part of an existing value’s cases. Existing values are never renamed or removed. Treat a value you do not know as a generic failure.
  • null means the check passed or was not classified.
  • A block is read before the category: the internet provider’s filter (cdn_provider is ISP Filter), then a country ban (geo_blocked), then a bot wall (anti_bot with the vendor in bot_protection). Monitors name these fields last_cdn_provider and last_bot_protection; incident causes also give the answer in block; status ranges and the timeline keep neither, so an ISP block does not show there.
  • Monitors also carry isp_filter_seen_at: when the checker of the latest check last found the ISP filter in its current failure, null when it has not or that failure ended. last_isp_held is true when the latest check, unlabelled, failed at the step where the filter was found and within the hold time, so it reads as the same block (see ISP detection); last_cdn_provider stays as the check recorded it. A single monitor also lists isp_filters: one entry per public or private checker in such an episode within the hold time; the central checker’s value is not listed (see last_isp_held). The open incident’s current_cause carries the same pair as isp_filter_seen_at and isp_held, and the WebSocket check events as isp_filter_seen_at and isp_held.
ValueMeaning
anti_botBot protection refused the check; the site may be up
rate_limitedHTTP 429: the site throttles the checker, it is up
auth_requiredHTTP 401 or 403: authentication required or access forbidden; also a camera that rejected the RTSP login, or a server that rejected the SSH login
geo_blockedHTTP 451, or the site bans the checker’s country
timeoutNo answer in time; the error message names the step for HTTP(S)
dns_failureThe host name did not resolve
dns_mismatchDNS monitor: the answer differs from the expected values
dns_nxdomainDNS monitor: the domain does not exist
dns_no_recordDNS monitor: no record of the requested type
dns_dnssecDNS monitor: the DNSSEC signature check failed
dns_servfailDNS monitor: the domain’s DNS servers failed
dns_no_answerDNS monitor: public DNS did not answer
dns_server_no_answerDNS monitor: your own DNS server did not answer or refused
tls_failureThe TLS handshake failed or was cut, without an expired certificate
connection_refusedThe connection was refused, reset or could not be made, or the host is unreachable; also a ping without a reply, a connection closed before the response was complete, or a response cut off before its end
server_errorHTTP 5xx
status_mismatchThe site answered, but the response failed a check no other value names: an unexpected HTTP status code, too many redirects, invalid JSON, a JSON path or regex mismatch, or most API Check assertions
content_mismatchA keyword check of the body failed (text missing, or present when it must be absent), an API Check body regex did not match, or the camera’s video stream changed
ssl_expiredThe certificate has expired
ssl_expiringThe certificate expires within the monitor’s warning window; the site works
ssl_chain_incompleteThe server sends no intermediate certificate
dnsbl_listedThe address or domain is on a DNS blacklist
stub_pageA domain-parking or hosting stub page instead of the site
config_errorThe monitor’s own settings prevent the check

Second opinion

GET /api/v1/monitors/:id/second-opinion (X-API-Key or JWT) returns what checkers in other networks saw during the monitor’s current failure. When a check from Russia cannot open a TCP connection, the checker in Novosibirsk tries the same address and port; when it does not get through either, the checker in Minsk is asked too (see ISP detection). The response is null when nothing is kept for this failure, or the monitor now points at another host or port.

{
  "reading": "timeout",
  "reason": null,
  "target": "203.0.113.10:443",
  "by_name": false,
  "vantage": {"probe_id": null, "region": "Moscow, RU"},
  "opinion_probe": {"probe_id": 1, "region": "Novosibirsk, RU"},
  "checked_at": "2026-11-13T16:12:04Z",
  "cascade": {
    "reading": "reached",
    "reason": null,
    "target": "203.0.113.10:443",
    "by_name": false,
    "opinion_probe": {"probe_id": 6, "region": "Minsk, BY"},
    "checked_at": "2026-11-13T16:12:05Z"
  }
}
  • reading: reached (the connection opened), timeout (no answer within 5 seconds), refused, failed (another error; reason is no_route or no_name when the error says so), unavailable (the checker gave no answer). The set is open: treat a value you do not know as no reading.
  • vantage is the point whose check failed; its probe_id is null for PingZen’s central server. opinion_probe is the checker that was asked.
  • by_name: a TCP monitor set up by name; the checker looked the name up itself and may have reached another address.
  • cascade is the answer from Minsk. It is there only when Novosibirsk did not get through (timeout or failed) and Minsk has answered; otherwise null.
  • phase takes tcp (the default) or tls. pingzen.dev does not collect TLS-handshake readings, so tls returns null.

The answer states what each point saw, never why.

Request Examples

Detailed cURL examples.

List monitors

curl -H "X-API-Key: YOUR_API_KEY" \
  https://pingzen.dev/api/v1/monitors?workspace_id=1

How to find your workspace_id

The workspace_id field is required in the payload when creating monitors, alerts, reports, and status pages; a maintenance window takes it too and goes to your default workspace without it. There are two ways to get it.

Option 1: via UI (fastest). Open the workspaces page — each workspace card shows its ID. For most users it’s 1.

Option 2: via API (for CI/scripts). The /api/v1/workspaces* endpoints currently require JWT, not X-API-Key (see “Where X-API-Key works” above). Steps:

# 1. Log in — get an access_token
ACCESS=$(curl -sS -X POST https://pingzen.dev/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"email":"you@example.com","password":"…"}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["access_token"])')

# 2. Default workspace (the one pre-selected in the UI)
curl -sS -H "Authorization: Bearer $ACCESS" \
  https://pingzen.dev/api/v1/workspaces/default
# → {"id": 42, "name": "My Workspace", "is_default": true, ...}

# 3. Or a compact list of all (id, name) for dropdowns
curl -sS -H "Authorization: Bearer $ACCESS" \
  https://pingzen.dev/api/v1/workspaces/summary

One-liner “log in → fetch default id” for CI:

ACCESS=$(curl -sS -X POST https://pingzen.dev/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -d "{\"email\":\"$EMAIL\",\"password\":\"$PASS\"}" \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["access_token"])')

WORKSPACE_ID=$(curl -sS -H "Authorization: Bearer $ACCESS" \
  https://pingzen.dev/api/v1/workspaces/default \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')

echo "$WORKSPACE_ID"   # → 42

Then plug $WORKSPACE_ID into the POST /api/v1/monitors payload below (that one is an X-API-Key endpoint).

Create a monitor

curl -X POST https://pingzen.dev/api/v1/monitors \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "My Site", "url": "https://example.com", "protocol": "https", "workspace_id": 1, "interval_seconds": 60}'

Get monitor

curl -H "X-API-Key: YOUR_API_KEY" \
  https://pingzen.dev/api/v1/monitors/123

Update monitor

curl -X PATCH https://pingzen.dev/api/v1/monitors/123 \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"interval_seconds": 60, "name": "Updated Name"}'

Minimum interval_seconds depends on plan: FREE — 60s, paid — 30s. A value below the plan minimum returns 422 with a descriptive error.

Delete monitor

curl -X DELETE https://pingzen.dev/api/v1/monitors/123 \
  -H "X-API-Key: YOUR_API_KEY"

Create a heartbeat monitor

Create a heartbeat monitor for cron jobs and scheduled tasks. Returns a unique ping URL and secret. /heartbeats CRUD currently requires JWT (see “Where X-API-Key works”); workspace_id is passed as a query parameter, not in the body. run_timeout_seconds is optional: omit it or send 0 and “if the job does not finish” stays off; 60 to 604800 (7 days) turns it on. While it is off, /start is an ordinary alive ping.

curl -X POST "https://pingzen.dev/api/v1/heartbeats?workspace_id=$WORKSPACE_ID" \
  -H "Authorization: Bearer $ACCESS" \
  -H "Content-Type: application/json" \
  -d '{"name": "Daily Backup", "expected_interval_seconds": 86400, "grace_period_seconds": 600}'

Send heartbeat ping (GET)

Simplest integration — just add to crontab or end of script. No API key or token: the ping key in the URL is enough. If the monitor has a secret, every ping needs it, this one included: send it in the X-Secret header, or the ping gets 404.

# Simplest: chain with && so ping fires only on success
0 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 https://pingzen.dev/api/v1/ping/YOUR_PING_KEY/YOUR_SLUG

# Or just a standalone ping
curl https://pingzen.dev/api/v1/ping/aBcDeFgHiJkLmNoPqR/daily-backup

Heartbeat lifecycle signals

An exit code is simpler than separate URLs. POST to the same URL with /0 leaves the monitor up; /1…/255 marks it Down at once. The body is a plain log; JSON is not required. The end of that text is shown in the alert and in the list. The wrapper {"payload": {"error": "..."}} still works, and the error field is shown in the alert too. A missed ping does not quote the previous successful log.

# At the end of the script. Write the output to a file first: your-job > /tmp/job.log 2>&1
curl -fsS -m 10 --retry 3 --data-binary @/tmp/job.log "https://pingzen.dev/api/v1/ping/YOUR_PING_KEY/YOUR_SLUG/$?"

Report job lifecycle signals (start/success/fail) with optional payload and duration. These three URLs accept POST only: a GET gets 405 Method Not Allowed and records nothing. If the monitor has a secret, send it in the X-Secret header.

# Report success with payload and duration
curl -X POST https://pingzen.dev/api/v1/ping/aBcDeFgHiJkLmNoPqR/daily-backup/success \
  -H "X-Secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"duration_ms": 45000, "payload": {"rows": 500000}}'

# Report failure — triggers instant alert (no waiting for missed interval)
curl -X POST https://pingzen.dev/api/v1/ping/aBcDeFgHiJkLmNoPqR/daily-backup/fail \
  -H "X-Secret: YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"payload": {"error": "disk full"}}'

# Cron entry: success OR fail. `if` sends /fail only when the job failed,
# not when the /success request itself did. With a secret, add -H "X-Secret: ..." to both
0 3 * * * if /usr/local/bin/backup.sh; then curl -fsS -m 10 -X POST https://pingzen.dev/api/v1/ping/aBcDeFgHiJkLmNoPqR/daily-backup/success; else curl -fsS -m 10 -X POST https://pingzen.dev/api/v1/ping/aBcDeFgHiJkLmNoPqR/daily-backup/fail; fi

Code Examples

Python Example

import requests

# Get your API key from: Profile → API Keys → Create New Key
PINGZEN_API_KEY = "YOUR_API_KEY"
BASE_URL = "https://pingzen.dev/api/v1"

headers = {
    "X-API-Key": PINGZEN_API_KEY,
    "Content-Type": "application/json"
}

# Create a monitor
monitor_data = {
    "name": "My Website",
    "url": "https://example.com",
    "protocol": "https",
    "interval_seconds": 60,
    "workspace_id": 1
}

response = requests.post(
    f"{BASE_URL}/monitors",
    headers=headers,
    json=monitor_data
)

print(response.json())

# Get all monitors (response is {monitors: [...], total, page, page_size})
data = requests.get(
    f"{BASE_URL}/monitors",
    headers=headers,
    params={"workspace_id": 1},  # scope to your workspace
).json()

for monitor in data["monitors"]:
    print(f"{monitor['name']}: {monitor['status']}")

JavaScript Example

// Get your API key from: Profile → API Keys → Create New Key
const PINGZEN_API_KEY = 'pz_abc12345_...';
const BASE_URL = 'https://pingzen.dev/api/v1';

const headers = {
  'X-API-Key': PINGZEN_API_KEY,
  'Content-Type': 'application/json'
};

// Create a monitor
async function createMonitor() {
  const response = await fetch(`${BASE_URL}/monitors`, {
    method: 'POST',
    headers: headers,
    body: JSON.stringify({
      name: 'My Website',
      url: 'https://example.com',
      protocol: 'https',
      interval_seconds: 60,
      workspace_id: 1
    })
  });

  const data = await response.json();
  console.log(data);
}

// Get all monitors (response is {monitors: [...], total, page, page_size})
async function getMonitors() {
  const response = await fetch(
    `${BASE_URL}/monitors?workspace_id=1`,  // scope to your workspace
    { headers: headers },
  );

  const data = await response.json();
  data.monitors.forEach(monitor => {
    console.log(`${monitor.name}: ${monitor.status}`);
  });
}

createMonitor();
getMonitors();

Heartbeat / Cron Monitoring Examples

Monitor cron jobs, scheduled tasks, and background processes. Create a heartbeat monitor, then send pings from your scripts to confirm they ran.

Bash / Cron Job

#!/bin/bash
# === Pattern 1: Chain with && (recommended for cron) ===
# curl runs ONLY if backup succeeds (exit code 0)
# If backup fails — no ping — PingZen alerts after grace period
#
# 0 2 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 https://pingzen.dev/api/v1/ping/YOUR_PING_KEY/YOUR_SLUG

# === Pattern 2: Report both success AND failure ===
# /success on success, /fail on failure — instant alert, no waiting.
# Signals accept POST only; keep the entry on one line (cron has no line continuation)
#
# 0 2 * * * if /usr/local/bin/backup.sh; then curl -fsS -m 10 -X POST https://pingzen.dev/api/v1/ping/YOUR_PING_KEY/YOUR_SLUG/success; else curl -fsS -m 10 -X POST https://pingzen.dev/api/v1/ping/YOUR_PING_KEY/YOUR_SLUG/fail; fi

# === Pattern 3: Full script with duration and payload ===
PING_KEY="YOUR_PING_KEY"
SLUG="daily-backup"
SECRET="YOUR_SECRET"
PING_URL="https://pingzen.dev/api/v1/ping/$PING_KEY/$SLUG"
SECONDS=0  # Bash built-in timer

# Your backup logic
pg_dump mydb > /backups/mydb_$(date +%F).sql

if [ $? -eq 0 ]; then
  # Report success with duration
  curl -fsS -m 10 -X POST "$PING_URL/success" \
    -H "X-Secret: $SECRET" \
    -H "Content-Type: application/json" \
    -d "{\"duration_ms\": $((SECONDS * 1000))}"
else
  # Report failure — instant alert
  curl -fsS -m 10 -X POST "$PING_URL/fail" \
    -H "X-Secret: $SECRET" \
    -H "Content-Type: application/json" \
    -d "{\"payload\": {\"error\": \"pg_dump failed\"}}"
fi

Python Heartbeat

import requests

BASE_URL = "https://pingzen.dev/api/v1"

# /heartbeats CRUD currently requires JWT (X-API-Key not yet supported).
# Log in once and reuse the token; refresh via /auth/refresh after 15 minutes.
login = requests.post(
    f"{BASE_URL}/auth/login",
    json={"email": "you@example.com", "password": "..."},
).json()
ACCESS = login["access_token"]
WORKSPACE_ID = requests.get(
    f"{BASE_URL}/workspaces/default",
    headers={"Authorization": f"Bearer {ACCESS}"},
).json()["id"]

# Create a heartbeat monitor (workspace_id goes in the query, not the body)
heartbeat = requests.post(
    f"{BASE_URL}/heartbeats",
    params={"workspace_id": WORKSPACE_ID},
    headers={"Authorization": f"Bearer {ACCESS}", "Content-Type": "application/json"},
    json={
        "name": "Daily Backup",
        "expected_interval_seconds": 86400,
        "grace_period_seconds": 600,
    },
).json()

ping_key = heartbeat["ping_key"]  # Workspace secret key
slug = heartbeat["slug"]
secret = heartbeat["secret"]      # None until you create one with regenerate-secret
ping_url = f"{BASE_URL}/ping/{ping_key}/{slug}"
print(f"Ping URL: {ping_url}")

# Report success at the end of your script. X-Secret matters only once the
# monitor has a secret, and then every ping needs it (requests drops a None header)
requests.post(
    f"{ping_url}/success",
    headers={"X-Secret": secret, "Content-Type": "application/json"},
    json={"duration_ms": 12000, "payload": {"status": "ok"}},
)

JavaScript Heartbeat

const BASE_URL = 'https://pingzen.dev/api/v1';

// /heartbeats CRUD currently requires JWT (X-API-Key not yet supported).
// Login once, reuse the token; refresh via /auth/refresh after 15 minutes.
async function login(email, password) {
  const res = await fetch(`${BASE_URL}/auth/login`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ email, password }),
  });
  return (await res.json()).access_token;
}

async function defaultWorkspaceId(access) {
  const res = await fetch(`${BASE_URL}/workspaces/default`, {
    headers: { 'Authorization': `Bearer ${access}` },
  });
  return (await res.json()).id;
}

// Create a heartbeat monitor (workspace_id goes in the query, not the body)
async function createHeartbeat(access, workspaceId) {
  const response = await fetch(
    `${BASE_URL}/heartbeats?workspace_id=${workspaceId}`,
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${access}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        name: 'Nightly Report',
        expected_interval_seconds: 86400,
        grace_period_seconds: 600,
      }),
    },
  );

  const data = await response.json();
  console.log('Ping URL:', `${BASE_URL}/ping/${data.ping_key}/${data.slug}`);
  console.log('Secret:', data.secret); // null until you create one with regenerate-secret
  return data;
}

// Send heartbeat ping from your cron job (no JWT needed; X-Secret authenticates)
async function sendPing(pingKey, slug, secret) {
  await fetch(`${BASE_URL}/ping/${pingKey}/${slug}/success`, {
    method: 'POST',
    headers: {
      'X-Secret': secret,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      duration_ms: 5000,
      payload: { rows_processed: 1000 },
    }),
  });
}

OpenAPI & AI Agents

PingZen provides machine-readable specifications for AI agent integration and automation tools.

Rate Limits

PlanRequests/HourBurst Limit
Free100/hour10/minute