Docs /
API tokens and the API
Pull your services, their live status and the attack log into your own bot, dashboard or script with a read-only token. Three worked examples with curl.
Early access
What a token can do
A token is read-only. It reads services, analytics and attack events. It cannot change anything and it cannot see billing. Tokens belong to the account, not to you: they keep working if you leave the team. Owners and admins create and revoke them.
Create a token
In the panel open Account, then API tokens, and choose Create token.
Give it a name that says where it is used, for example
Discord botorGrafana.Choose when it expires: after 7, 30, 90 or 365 days.
Choose Create token and copy the secret. It starts with
zp_ro_and is shown this one time only.
The list shows each token's first characters, when it was last used and when it expires, so you can tell them apart without the secret.
Authenticate
Send the token in the Authorization header after the word Bearer. All paths start with /api/v1. The examples read both values from the environment:
$ export ZP_API="https://zeroping.hk/api/v1"
$ export ZP_TOKEN="zp_ro_…" Responses are JSON with snake_case fields and times in UTC. Every response carries an X-Request-Id header; quote it if you contact support.
Example 1: list your game servers
$ curl -s "$ZP_API/properties?kind=game&limit=25" \
-H "Authorization: Bearer $ZP_TOKEN" {
"items": [
{
"id": "01937f61-0000-7000-8000-000000000001",
"kind": "game",
"name": "Survival SMP",
"status": "active",
"location": "hkg",
"created_at": "2026-11-02T09:00:00Z",
"game": {
"profile": "minecraft-java",
"protocol": "tcp",
"origin_host": "•••.•••.•••.•••",
"origin_port": 25565,
"proxy_protocol": true,
"edge_address": "203.0.113.24",
"edge_port": 25565,
"edge_hostname": "survival-smp.play.zeroping.hk"
},
"website": null
}
],
"next_cursor": null
} Leave out kind to get websites as well (kind=web for websites only). The origin address comes back masked; only a signed-in owner or admin can reveal it, in the panel. Copy the id for the next two examples.
Example 2: is the server up?
$ curl -s "$ZP_API/properties/01937f61-0000-7000-8000-000000000001/status" \
-H "Authorization: Bearer $ZP_TOKEN" {
"status": "active",
"origin_up": true,
"cert_status": null,
"verified": null,
"checked_at": "2026-11-29T19:00:00Z",
"simulated": false
} origin_up is whether the edge can reach your server right now; checked_at is when it last looked. status is one of pending, provisioning, active, degraded, paused, deleting or error. cert_status and verified apply to websites and are null for game servers. A bot can poll this once a minute and post when origin_up changes, though alert channels already do that for you.
Example 3: page through the attack log
$ curl -s "$ZP_API/attacks?property_id=01937f61-0000-7000-8000-000000000001&limit=10" \
-H "Authorization: Bearer $ZP_TOKEN" Each item has started_at, ended_at (null while it is still running), vector (udp_flood, syn_flood, http_flood or amplification), peak_bps, peak_pps, location and action. Leave out property_id to get every service of the account.
Lists are paged. When next_cursor is not null, pass it back as cursor to get the next page. This loop prints every attack using jq:
cursor=""
while :; do
page=$(curl -s "$ZP_API/attacks?limit=100${cursor:+&cursor=$cursor}" \
-H "Authorization: Bearer $ZP_TOKEN")
echo "$page" | jq -r '.items[] | [.started_at, .property_name, .vector, .action] | @tsv'
cursor=$(echo "$page" | jq -r '.next_cursor // empty')
[ -z "$cursor" ] && break
done limit is 1 to 100 and defaults to 25.
Errors
Errors always have the same shape, with a stable code your script can check and a readable message:
{ "error": { "code": "not_found", "message": "…" } } A service of another account answers 404, never 403, so a token cannot be used to probe ids. Anything that would change something answers with an error: tokens are read-only.
Revoke a token
In Account, then API tokens, choose Revoke next to the token. Scripts using it stop working straight away. Revoke and replace tokens when staff with access leave, and pick an expiry so forgotten tokens end by themselves.
Was this helpful?