API 文档

使用 API 密钥,在脚本和 CI 中创建、暂停和删除监控项,并读取检测结果。

以下参考文档仅提供英文版。

Base URL
https://fastping.app/api/v1
Authentication
Bearer API key
Format
JSON
Rate limit
120 requests per minute per key

Authentication

Every request needs an API key, sent as a bearer token. Create keys under API keys in the dashboard. The API is part of the REST API access add-on ($5 a month), which the Pro and Business presets include.

Shell
export FASTPING_KEY=fp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
curl -s -H "Authorization: Bearer $FASTPING_KEY" \
  https://fastping.app/api/v1/monitors

The examples on this page read the key from the FASTPING_KEY environment variable, as above.

  • A key is shown once, when you create it. FastPing stores only a hash of it.
  • A key has full access to the monitors of its organisation. Use one key per integration, so a leaked key can be deleted without breaking the others.
  • Requests and responses are JSON. Send Content-Type: application/json with a body.

A walkthrough with scripts for bulk imports and deployments is in REST API quick start.

Rate limits

Each key may make 120 requests per minute. Above that, the API answers 429 with a Retry-After header that gives the number of seconds to wait.

Errors

Errors use the HTTP status code and a JSON body with an error message:

JSON
{
  "error": "Invalid or missing API key"
}
StatusMessageWhen
401Invalid or missing API keyNo Authorization header, or the key was deleted.
403Your plan does not include API accessThe REST API access add-on is not active.
403Plan limit of 22 monitors reachedCreating a monitor would exceed the plan (paused monitors count).
403Your plan does not include this monitor typeThe type needs an add-on the plan does not include.
403Plan limit reachedResuming a monitor would exceed the plan.
400Invalid or unsupported typeUnknown type, or a type that cannot be created through the API.
400port is requiredThe type needs a port and none was sent.
400Invalid hostname.The url or host failed validation; the message says why, as in the dashboard.
400Invalid JSON bodyThe request body is not valid JSON.
404Not foundNo monitor with that ID in your organisation.
404Unknown endpointThe path or method does not exist.
429Rate limit exceededMore than 120 requests in a minute with this key.

Monitors

Monitor IDs are the numbers in the dashboard URLs. Every endpoint only sees the monitors of the key's organisation.

List monitors

GET/api/v1/monitors

Every monitor of the organisation, oldest first, as monitor objects.

Request
curl -s -H "Authorization: Bearer $FASTPING_KEY" \
  https://fastping.app/api/v1/monitors
Response 200
{
  "monitors": [
    {
      "id": 12,
      "name": "Shop",
      "type": "http",
      "target": "https://shop.example.com",
      "port": null,
      "interval": 60,
      "enabled": true,
      "status": "up",
      "last_checked_at": "2026-10-17T09:30:00.000Z",
      "last_response_ms": 184,
      "last_message": "HTTP 200",
      "data": null,
      "options": {
        "maxMs": 1500
      },
      "uptime_24h": 100,
      "public_id": "x7Kp2QmR9"
    }
  ]
}

Get a monitor

GET/api/v1/monitors/:id

One monitor with its uptime, latest checks and incidents:

  • uptime: percentages for today (1d) and the last 7, 30 and 90 days, counted in UTC days; null without checks.
  • checks: the latest 100 checks, newest first. ok is up, warn or down; value is the number some types record (players online, days left, email security score), else null.
  • incidents: the last 20 incidents. started_at and resolved_at are milliseconds since the Unix epoch; resolved_at is null while the incident is open.
Request
curl -s -H "Authorization: Bearer $FASTPING_KEY" \
  https://fastping.app/api/v1/monitors/12
Response 200
{
  "monitor": {
    "id": 12,
    "name": "Shop",
    "type": "http",
    "target": "https://shop.example.com",
    "port": null,
    "interval": 60,
    "enabled": true,
    "status": "up",
    "last_checked_at": "2026-10-17T09:30:00.000Z",
    "last_response_ms": 184,
    "last_message": "HTTP 200",
    "data": null,
    "options": {
      "maxMs": 1500
    },
    "uptime_24h": 100,
    "public_id": "x7Kp2QmR9"
  },
  "uptime": {
    "1d": 100,
    "7d": 99.97,
    "30d": 99.99,
    "90d": 99.98
  },
  "checks": [
    {
      "ts": "2026-10-17T09:30:00.000Z",
      "ok": "up",
      "response_ms": 184,
      "value": null,
      "message": "HTTP 200"
    }
  ],
  "incidents": [
    {
      "started_at": 1792185240000,
      "resolved_at": 1792185520000,
      "cause": "HTTP 503"
    }
  ]
}

Create a monitor

POST/api/v1/monitors

Creates a monitor and runs its first check straight away. It is attached to every alert channel of the organisation.

FieldDescription
typeRequired. One of the monitor type keys. Security scans cannot be created through the API.
nameUp to 100 characters. Defaults to the target.
urlFor types whose target is a URL.
hostFor types whose target is a host name or IP address.
portFor types with a port. Required for TCP and UDP; the others use their default port.
intervalSeconds between checks. Raised to your plan's minimum; some types have their own minimum.
optionsObject with the type's options, named as in the API option column of each type's settings table in the help centre.

The response holds the new monitor; heartbeat monitors also get their heartbeat_url.

Request
curl -s -X POST https://fastping.app/api/v1/monitors \
  -H "Authorization: Bearer $FASTPING_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"http","name":"Shop","url":"https://shop.example.com","interval":60,"options":{"maxMs":1500}}'
Response 201
{
  "monitor": {
    "id": 12,
    "name": "Shop",
    "type": "http",
    "target": "https://shop.example.com",
    "port": null,
    "interval": 60,
    "enabled": true,
    "status": "pending",
    "last_checked_at": null,
    "last_response_ms": null,
    "last_message": null,
    "data": null,
    "options": {
      "maxMs": 1500
    },
    "uptime_24h": null,
    "public_id": "x7Kp2QmR9"
  }
}

Pause a monitor

POST/api/v1/monitors/:id/pause

Stops the checks and alerts of a monitor until it is resumed. Its history is kept.

Request
curl -s -X POST -H "Authorization: Bearer $FASTPING_KEY" \
  https://fastping.app/api/v1/monitors/12/pause
Response 200
{
  "ok": true
}

Resume a monitor

POST/api/v1/monitors/:id/resume

Starts the checks again and runs one immediately. Answers 403 when the plan has no room for another active monitor.

Request
curl -s -X POST -H "Authorization: Bearer $FASTPING_KEY" \
  https://fastping.app/api/v1/monitors/12/resume
Response 200
{
  "ok": true
}

Delete a monitor

DELETE/api/v1/monitors/:id

Deletes the monitor with its checks, uptime history and incidents. This cannot be undone.

Request
curl -s -X DELETE -H "Authorization: Bearer $FASTPING_KEY" \
  https://fastping.app/api/v1/monitors/12
Response 200
{
  "ok": true
}

The monitor object

FieldTypeDescription
idnumberMonitor ID.
namestringName shown in alerts and on status pages.
typestringA monitor type key.
targetstringThe URL or host; an empty string for heartbeat monitors.
portnumber or nullPort, for types that use one.
intervalnumberSeconds between checks.
enabledbooleanfalse while the monitor is paused.
statusstringup, down, warn, pending or paused.
last_checked_atstring or nullTime of the latest check, ISO 8601 in UTC.
last_response_msnumber or nullResponse time of the latest check in milliseconds.
last_messagestring or nullMessage of the latest check, for example HTTP 200.
dataobject or nullDetails some types record, such as certificate dates or players online.
optionsobjectThe type's options.
uptime_24hnumber or nullUptime of the current UTC day in percent.
public_idstringRandom ID used in the monitor's badge and widget URLs.

Monitor types

19 types. The settings table in each guide lists the options of that type.

KeyNameTargetDefault portRuns at most everyNotes
httpWebsite (HTTP)urln/aPlan minimumNone
keywordKeywordurln/aPlan minimumNone
apiAPI (JSON)urln/aPlan minimumNone
pingPinghostn/aPlan minimumNone
tcpTCP porthostRequiredPlan minimumNone
dnsDNS recordshostn/aPlan minimumNone
sslSSL certificatehost4431 hourNone
domainDomain expiryhostn/a12 hoursNone
emailEmail securityhostn/a6 hoursNone
blacklistBlacklisthostn/a6 hoursNone
securitySecurity scanhostn/a1 dayNeeds: Security exposure scans add-on, Domain verification. Not available through the API.
gameGame serverhostGame defaultPlan minimumNone
heartbeatHeartbeat (cron)Nonen/aPlan minimumNone
smtpSMTP serverhost255 minutesNone
imapIMAP serverhost9935 minutesNone
pop3POP3 serverhost9955 minutesNone
udpUDP porthostRequired1 minuteNone
websocketWebSocketurln/aPlan minimumNone
http2HTTP/2 & HTTP/3urln/aPlan minimumNone

Webhook alerts

Webhook alert channels receive an HTTP POST with Content-Type: application/json and the User-Agent FastPing-Monitor/1.0 (+https://fastping.app) for every alert:

JSON
{
  "event": "down",
  "monitor": {
    "id": 12,
    "name": "Shop",
    "type": "http",
    "target": "https://shop.example.com"
  },
  "detail": "HTTP 503",
  "status": "down",
  "timestamp": "2026-10-17T09:30:00.000Z",
  "url": "https://fastping.app/app/monitors/12"
}
FieldDescription
eventdown, up (recovery, or a warning that cleared), warn or event (a change, such as DNS records or a game server's map).
monitorid, name, type and target of the monitor.
detailThe message of the check that caused the alert.
statusThe monitor's status after the alert: up, down or warn.
timestampWhen the alert was sent, ISO 8601 in UTC.
urlThe monitor in the dashboard (login required).
  • The URL must use HTTPS and resolve to a public IP address.
  • Answer with a 2xx status within 10 seconds. Redirects are not followed and count as failures.
  • Each alert is sent once, without retries. Requests are not signed: keep a long random secret in the URL path.

The webhook alerts guide has a receiver example.

Heartbeat URLs

A heartbeat monitor has its own secret URL. Your job calls it with GET, POST or HEAD each time it finishes successfully. No API key is needed: the URL is the credential.

Shell
curl -fsS -m 10 --retry 3 -o /dev/null https://fastping.app/hb/<token>
ResponseMeaning
200 okThe heartbeat was recorded.
404 unknown or paused heartbeatThe token does not exist, or the monitor is paused or deleted.
405Another method than GET, POST or HEAD.

Examples for cron, systemd timers, Windows Task Scheduler and GitHub Actions are in Heartbeat monitors for cron jobs and scheduled tasks.

还需要帮助?

给我们写信,会有真人回复,通常在一个工作日内。