Get a monitor's uptime and timings
const url = 'https://app.tunnelhq.com/api/v1/servers/srv_42/stats?range=1h&from=2026-10-01&to=2026-10-31';const options = {method: 'GET', headers: {'X-Project-Id': 'prj_12', 'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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_percentis 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 (for1h), hour (for24h, 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, assinceshows. It’snullbefore the first check.downtime_secondsadds up that downtime inside the period.incidents,longest_incident_seconds, andaverage_incident_secondscome from the down incidents only.- Latency comes from figures for each minute for
1h, hourly figures for24h,7d,30d, and a span that starts in the last 30 days, and daily figures for90dand older spans.serieshas one point for each minute, hour, or day. connect_msis for tunnels. For1hand24hit 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’snullwhen there’s none.regionshas 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 itsuptime_percentneedn’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.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”The monitor, as srv_42 or 42.
Example
srv_42Header Parameters
Section titled “Header Parameters”The project, as prj_12 or 12. A workspace key can only reach its own workspace’s projects.
Example
prj_12Query Parameters
Section titled “Query Parameters”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.”
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.
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.
Responses
Section titled “ Responses ”The figures for the period.
object
vpn for a tunnel, or the Uptime check’s type.
null for a span sent as from and to.
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.
The end of the period, in ISO 8601, UTC: now, or the span’s to.
The share of the monitored time that wasn’t downtime, to 2 decimals. null before the first check.
Time inside the period spent in down incidents, plus the hours or days in which every check failed and no incident was open.
Down incidents in the period.
object
In milliseconds. Each is null when nothing was measured.
object
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
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.
object
The start of the minute, hour, or day, in ISO 8601, UTC.
Tunnels: the average connect time in that minute, hour, or day. null when none was measured or kept.
One entry per location the monitor tested from in the period, by location code, A to Z. Empty when none was kept.
object
any or a lowercase country code.
object
The share of this location’s own checks that passed, to 2 decimals. null with no checks.
Average latency from this location.
Tunnels: average connect time from this location.
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 } ]}Headers
Section titled “Headers”Requests the workspace’s plan allows per minute.
Requests left in the current minute.
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.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 400, "message": "Invalid server ID"}{ "error": true, "code": 400, "message": "range must be one of: 1h, 24h, 7d, 30d, 90d. For any other span send from and to."}{ "error": true, "code": 400, "message": "Send range, or from and to, not both."}{ "error": true, "code": 400, "message": "from must be a date (2026-11-01) or a UTC time (2026-11-01T09:30:00Z)."}{ "error": true, "code": 400, "message": "to needs a from. Send from and to, or from alone for a span that ends now."}{ "error": true, "code": 400, "message": "to must be after from."}{ "error": true, "code": 400, "message": "from and to can be at most 366 days apart. Ask for a longer span in parts."}{ "error": true, "code": 400, "message": "X-Project-Id header is required (e.g. prj_1 or numeric id)"}The API key is missing, wrong, expired, switched off, or no longer valid.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 401, "message": "API key is required. Provide X-API-Key header or Authorization: Bearer <key>"}{ "error": true, "code": 401, "message": "Invalid or expired API key"}{ "error": true, "code": 401, "message": "API key has expired"}{ "error": true, "code": 401, "message": "API key owner account is inactive"}{ "error": true, "code": 401, "message": "This API key's workspace access has been removed"}The key can’t reach this project, or the period is longer than, or starts before, the plan’s history.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 403, "message": "Your plan includes 7 days of history. Upgrade to read 30d."}{ "error": true, "code": 403, "message": "Your plan includes 7 days of history, from 2026-11-04. Upgrade to read from 2026-10-01."}{ "error": true, "code": 403, "message": "You do not have access to this project"}The project has no such monitor, or the project doesn’t exist.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": true, "code": 404, "message": "Server not found"}{ "error": true, "code": 404, "message": "Project not found or inactive"}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.
object
Seconds to wait. Absent for the monthly limit.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Examples
{ "error": "Rate limit exceeded", "message": "Per-minute limit of 60 requests exceeded", "retry_after": 60}{ "error": "Daily limit exceeded", "message": "Daily limit of 25000 requests exceeded", "retry_after": 3600}{ "error": "Monthly limit exceeded", "message": "Monthly limit of 250000 requests exceeded"}{ "error": true, "code": 429, "message": "Too many failed API key attempts from this address. Wait a few seconds and try again.", "retry_after": 6}Headers
Section titled “Headers”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.
object
The HTTP status, repeated.
What went wrong.
More detail, on some errors.
Seconds to wait, on the 429 for wrong keys.
Example
{ "error": true, "code": 500, "message": "Internal server error"}