Skip to content

Get a monitor's uptime and timings

GET
/servers/{id}/stats
curl --request GET \
--url 'https://app.tunnelhq.com/api/v1/servers/srv_42/stats?range=1h&from=2026-10-01&to=2026-10-31' \
--header 'X-API-Key: <X-API-Key>' \
--header 'X-Project-Id: prj_12'

What a tunnel’s or Uptime check’s page shows for a period: its uptime, downtime and incidents, its latency, a series over time, and each location’s own figures. Any role in the project can call it. Send range for one of the page’s periods, or from and to for any span.

  • uptime_percent is the share of the monitored time that wasn’t downtime: downtime against downtime plus the time its checks were seen passing. Time it was paused, or had no results, counts neither way. Downtime is the monitor’s down incidents, and also any five minutes (for 1h), hour (for 24h, and a span that starts in the last 30 days), or day (for longer periods) in which every check failed and no incident was open, for as long as its failed checks cover, one check interval each. So a monitor that has never been up, and so never opened an incident, reads its real figure, not 100%. Degraded incidents aren’t downtime, and neither is a partial outage: a tunnel that tests from several locations is down only when every location fails. For a monitor younger than the period, the period starts when it was created, as since shows. It’s null before the first check.
  • downtime_seconds adds up that downtime inside the period. incidents, longest_incident_seconds, and average_incident_seconds come from the down incidents only.
  • Latency comes from figures for each minute for 1h, hourly figures for 24h, 7d, 30d, and a span that starts in the last 30 days, and daily figures for 90d and older spans. series has one point for each minute, hour, or day.
  • connect_ms is for tunnels. For 1h and 24h it comes from the passing checks themselves. For longer periods it comes from figures kept per location since 11 Nov 2026, so it covers only the time since then, and it’s null when there’s none.
  • regions has one entry per location the monitor tested from: its checks, the share of them that passed, and its average latency and connect time. A location that fails while the others pass isn’t downtime for the tunnel, so its uptime_percent needn’t match the monitor’s.
  • A period longer than the plan’s history is refused with 403, and so is a span that starts before it.

Need an API key? See Getting an API key.

id
required
string

The monitor, as srv_42 or 42.

Example
srv_42
X-Project-Id
required
string

The project, as prj_12 or 12. A workspace key can only reach its own workspace’s projects.

Example
prj_12
range
string
default: 24h
Allowed values: 1h 24h 7d 30d 90d

The period: 1h is the last hour. Any other value is refused with 400 “range must be one of: 1h, 24h, 7d, 30d, 90d. For any other span send from and to.”

from
string

The start of a span, in place of range: a date such as 2026-10-01, which starts at 00:00 UTC, or a time such as 2026-10-01T09:30:00Z, read as UTC when it names no zone. It must be in the past, and inside the plan’s history. Sent alone, the span ends now. A span is at most 366 days.

to
string

The end of the span, not included. A date takes that whole day in, so from=2026-10-01&to=2026-10-31 is all of October. A time later than now is read as now. Needs a from.

The figures for the period.

Media typeapplication/json
object
server_id
required
string
server_name
required
string
type
required

vpn for a tunnel, or the Uptime check’s type.

string
range
required

null for a span sent as from and to.

string | null
Allowed values: 1h 24h 7d 30d 90d
since
required

The start of the period, in ISO 8601, UTC: the range back from now or the span’s from, or when the monitor was created if that’s later.

string
until
required

The end of the period, in ISO 8601, UTC: now, or the span’s to.

string
uptime_percent
required

The share of the monitored time that wasn’t downtime, to 2 decimals. null before the first check.

number | null
downtime_seconds
required

Time inside the period spent in down incidents, plus the hours or days in which every check failed and no incident was open.

integer
incidents
required

Down incidents in the period.

integer
longest_incident_seconds
required
integer | null
average_incident_seconds
required
integer | null
checks
required
object
total
integer
up
integer
down
integer
latency_ms
required

In milliseconds. Each is null when nothing was measured.

object
average
integer | null
fastest
integer | null
slowest
integer | null
connect_ms
required

Tunnels: how long the tunnel took to come up, in milliseconds. Past 24h, from the figures kept per location since 11 Nov 2026. null when none was kept for the period, and each value is null when no passing check measured it.

object
average
integer | null
fastest
integer | null
slowest
integer | null
series
required

One point for each minute (1h), hour (24h, 7d, 30d, and a span that starts in the last 30 days), or day (90d and older spans), oldest first. A point counts when its minute, hour, or day starts in the period.

Array<object>
object
time

The start of the minute, hour, or day, in ISO 8601, UTC.

string
up
integer
down
integer
latency_ms
integer | null
fastest_ms
integer | null
slowest_ms
integer | null
connect_ms

Tunnels: the average connect time in that minute, hour, or day. null when none was measured or kept.

integer | null
regions
required

One entry per location the monitor tested from in the period, by location code, A to Z. Empty when none was kept.

Array<object>
object
region

any or a lowercase country code.

string
checks
object
total
integer
up
integer
down
integer
uptime_percent

The share of this location’s own checks that passed, to 2 decimals. null with no checks.

number | null
latency_ms

Average latency from this location.

integer | null
connect_ms

Tunnels: average connect time from this location.

integer | null
Example
{
"server_id": "srv_42",
"server_name": "fra-wg-01",
"type": "vpn",
"range": "24h",
"since": "2026-11-10T09:00:00.000Z",
"until": "2026-11-11T09:00:00.000Z",
"uptime_percent": 99.65,
"downtime_seconds": 302,
"incidents": 1,
"longest_incident_seconds": 302,
"average_incident_seconds": 302,
"checks": {
"total": 480,
"up": 478,
"down": 2
},
"latency_ms": {
"average": 157,
"fastest": 141,
"slowest": 233
},
"connect_ms": {
"average": 364,
"fastest": 310,
"slowest": 512
},
"series": [
{
"time": "2026-11-10T09:00:00.000Z",
"up": 20,
"down": 0,
"latency_ms": 155,
"fastest_ms": 143,
"slowest_ms": 171,
"connect_ms": 352
},
{
"time": "2026-11-10T10:00:00.000Z",
"up": 18,
"down": 2,
"latency_ms": 162,
"fastest_ms": 141,
"slowest_ms": 233,
"connect_ms": 371
}
],
"regions": [
{
"region": "any",
"checks": {
"total": 480,
"up": 478,
"down": 2
},
"uptime_percent": 99.58,
"latency_ms": 157,
"connect_ms": 364
}
]
}
X-RateLimit-Limit
integer

Requests the workspace’s plan allows per minute.

X-RateLimit-Remaining
integer

Requests left in the current minute.

X-RateLimit-Reset
integer

Unix time, in seconds, when the current minute ends.

The monitor ID, range, from, or to isn’t valid, or the X-Project-Id header is missing or malformed.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 400,
"message": "Invalid server ID"
}

The API key is missing, wrong, expired, switched off, or no longer valid.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 401,
"message": "API key is required. Provide X-API-Key header or Authorization: Bearer <key>"
}

The key can’t reach this project, or the period is longer than, or starts before, the plan’s history.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 403,
"message": "Your plan includes 7 days of history. Upgrade to read 30d."
}

The project has no such monitor, or the project doesn’t exist.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Examples
{
"error": true,
"code": 404,
"message": "Server not found"
}

A usage limit was reached, or this IP address made too many requests with a wrong key.

Usage limits are per workspace and plan: per minute (Retry-After: 60), per day (Retry-After: 3600), and per month (no Retry-After). They use their own body shape. An IP address may send 10 wrong keys a minute; one more is allowed every 6 seconds. While that allowance is used up, every request from the address is refused, even one with a valid key.

Media typeapplication/json
One of:
object
error
required
string
Allowed values: Rate limit exceeded Daily limit exceeded Monthly limit exceeded
message
required
string
retry_after

Seconds to wait. Absent for the monthly limit.

integer
Examples
{
"error": "Rate limit exceeded",
"message": "Per-minute limit of 60 requests exceeded",
"retry_after": 60
}
Retry-After
integer

Seconds to wait. 60 for the per-minute limit, 3600 for the daily limit, 6 after wrong keys. Absent for the monthly limit.

Something failed on TunnelHQ’s side.

Media typeapplication/json
object
error
required
boolean
code
required

The HTTP status, repeated.

integer
message
required

What went wrong.

string
details

More detail, on some errors.

retry_after

Seconds to wait, on the 429 for wrong keys.

integer
Example
{
"error": true,
"code": 500,
"message": "Internal server error"
}