Using the API
REST API
TunnelHQ REST API: create and manage monitors, run on-demand connectivity tests, and read incidents over HTTP with API-key auth and curl examples.
The REST API lets you create and manage VPN monitors and their groups, run tests, read results, uptime, and incidents, mute a monitor’s alerts, acknowledge and resolve incidents, add notes to them, post their public updates, and mute their alerts until they’re resolved, manage subscription URLs, run your status pages, plan maintenance, manage servers, choose which alert channels a monitor’s alerts go to, read the monthly availability report, and ask AI SRE. The channels themselves, outbound webhooks, team members, billing, and approving a change AI SRE suggests are done in the dashboard.
All endpoints are under https://app.tunnelhq.com/api/v1.
The API reference has a page for every endpoint. To generate a client, or to import the API into Postman or Insomnia, download the OpenAPI file (OpenAPI 3.1). It’s always at https://docs.tunnelhq.com/openapi.yaml.
Authentication
Section titled “Authentication”Send your API key in the X-API-Key header, or as Authorization: Bearer <key>. Endpoints that act on a project also need an X-Project-Id header, which accepts either 42 or prj_42. Without it, those endpoints return 400.
Don’t have a key yet? See Getting an API key. API access needs the Starter plan or above.
Example requests
Section titled “Example requests”Monitors are exposed as the /servers resource, with prefixed IDs such as srv_916.
List monitors
Section titled “List monitors”curl https://app.tunnelhq.com/api/v1/servers \ -H "X-API-Key: $TUNNELHQ_API_KEY" \ -H "X-Project-Id: 42"Create a monitor
Section titled “Create a monitor”name and protocol are required. Config-file protocols such as WireGuard take the full config in a config field, and the endpoint host and port are read from it.
curl -X POST https://app.tunnelhq.com/api/v1/servers \ -H "X-API-Key: $TUNNELHQ_API_KEY" \ -H "X-Project-Id: 42" \ -H "Content-Type: application/json" \ -d '{ "name": "Helsinki-I", "protocol": "wireguard", "config": "[Interface]\nPrivateKey = ...\nAddress = 10.0.0.2/32\n\n[Peer]\nPublicKey = ...\nEndpoint = vpn.example.com:51820\nAllowedIPs = 0.0.0.0/0" }'You can also set timeout, maxretries, and interval in seconds. The interval can be anything from your plan’s fastest interval up to 86400 (24 hours); a shorter one returns 403. If you leave it out, it’s 3 minutes or your plan’s fastest interval, whichever is longer.
Run an on-demand test
Section titled “Run an on-demand test”POST /test runs a check against an existing monitor and waits up to 75 seconds for the result.
curl -X POST https://app.tunnelhq.com/api/v1/test \ -H "X-API-Key: $TUNNELHQ_API_KEY" \ -H "X-Project-Id: 42" \ -H "Content-Type: application/json" \ -d '{"server_id": "srv_916"}'If the test finishes in time, the response is 200 with the result:
{ "test_id": "…", "server_id": "srv_916", "status": "healthy", "latency_ms": 157, "connect_ms": 364, "error_message": null, "tested_at": "…"}status is healthy, down, or degraded. connect_ms is how long the tunnel took to come up, and latency_ms is one round trip through it, both in milliseconds. If the test is still running after 75 seconds, the response is 202 with "status": "pending" and the same test_id, server_id, and tested_at.
To test several monitors at once, send POST /test/batch with {"server_ids": ["srv_916", "srv_917"]}.
Both endpoints accept two optional fields:
| Field | Description |
|---|---|
region |
The two-letter region code of the location to test from. Needs the Pro or Business plan; other plans get 402. |
region_fallback |
What happens if the location has no checker of its own and no residential route. any (the default) runs the test from the general pool instead, so the result isn’t from that location. fail doesn’t test from anywhere else and reports the location as unavailable. Scheduled checks from a chosen location always use fail. |
On-demand tests need a role that can edit monitors, and so does checking a config with POST /check. Each monitor tested counts as one test against your plan’s monthly on-demand quota.
Endpoints
Section titled “Endpoints”Each endpoint links to its page in the API reference, with every parameter, response, and error message. Endpoints marked Project need the X-Project-Id header. Key only endpoints need just the API key.
| Method and path | Scope | Description |
|---|---|---|
GET /servers |
Project | List monitors, with a period’s figures, an order, and filters, as the dashboard’s lists take them. |
POST /servers |
Project | Create a monitor. |
GET /servers/:id |
Project | Get a monitor. |
PUT /servers/:id |
Project | Update a monitor. |
DELETE /servers/:id |
Project | Delete a monitor. |
GET /servers/:id/stats |
Project | A monitor’s uptime, downtime, incidents, and latency for the last 24 hours, or 7, 30, or 90 days. |
GET /servers/:id/certificate |
Project | A website or keyword check’s SSL certificate: its state, days left, issuer, the names it covers, its checks, and the domain’s registration when watched. |
POST /servers/:id/mute |
Project | Mute a monitor’s alerts for 15 minutes, 1 hour, 4 hours, or until unmuted. Its checks keep running. |
POST /servers/:id/unmute |
Project | Turn a monitor’s alerts back on. |
POST /servers/:id/move |
Project | Move a monitor or a group in the list’s manual order, before or after another, or to the top or bottom. |
POST /servers/:id/duplicate |
Project | Copy a tunnel or an Uptime check, with its settings, tags, and alert channels. |
GET /servers/search?q= |
Key only | Search monitors across every project the key can reach. |
GET /groups |
Project | List groups, in the lists’ order. |
POST /groups |
Project | Create a group, empty or with monitors already in it. |
POST /groups/reorder |
Project | Put groups in an order. |
PUT /groups/:id |
Project | Rename a group. |
DELETE /groups/:id |
Project | Delete a group. Its monitors stay. |
POST /test |
Project | Run an on-demand test of one monitor. |
POST /test/batch |
Project | Run on-demand tests of several monitors. |
POST /check |
Key only | Check a config without saving a monitor. Needs a role that can edit monitors. |
GET /results |
Project | Recent check results. |
GET /results/failures |
Project | Recent failed checks. |
GET /results/server/:id |
Project | Check history for one monitor. |
GET /incidents |
Project | List incidents: outages, and certificate or domain expiries. kind=test_failing lists only those whose reason is Test fails. |
GET /incidents/:id |
Project | Get an incident, with what failed, its activity, its status pages, and its mute. |
GET /incidents/:id/events |
Project | An incident’s activity log. |
POST /incidents/:id/acknowledge |
Project | Acknowledge an incident. |
POST /incidents/:id/resolve |
Project | Resolve an open incident by hand. |
POST /incidents/:id/notes |
Project | Add a note for the team to an incident. |
GET /incidents/:id/status-pages |
Project | The status pages that show an incident’s tunnel or check, and what customers read there. |
POST /incidents/:id/status-update |
Project | Post a public update about an incident on those status pages. |
POST /incidents/:id/mute |
Project | Mute an incident’s alerts until it’s resolved. |
POST /incidents/:id/unmute |
Project | Turn an incident’s alerts back on. |
POST /incidents/:id/retest |
Project | Retest the monitor behind an incident. |
GET /subscriptions |
Project | List subscription URLs. |
POST /subscriptions |
Project | Add a subscription URL. |
GET /subscriptions/:id |
Project | Get a subscription. |
PUT /subscriptions/:id |
Project | Update a subscription. |
DELETE /subscriptions/:id |
Project | Remove a subscription. |
POST /subscriptions/:id/sync |
Project | Sync a subscription now. |
GET /status-pages |
Project | List status pages. |
POST /status-pages |
Project | Create a status page with the services you choose. |
GET /status-pages/:id |
Project | Get a status page. |
PATCH /status-pages/:id |
Project | Update a status page’s settings. |
DELETE /status-pages/:id |
Project | Delete a status page. |
PUT /status-pages/:id/services |
Project | Set the sections and services a page shows. |
PATCH /status-pages/:id/services |
Project | Add, remove, hide, or show many services at once. |
POST /status-pages/:id/publish |
Project | Publish or unpublish a page. |
PUT /status-pages/:id/domain |
Project | Set or remove a page’s own domain. |
POST /status-pages/:id/domain/check |
Project | Check the domain’s record and switch on HTTPS. |
POST /status-pages/:id/brand-from-website |
Project | Take the logo, favicon, and share image from the page’s website. |
GET /status-pages/:id/incidents |
Project | List a page’s incidents. |
POST /status-pages/:id/incidents |
Project | Post an incident on a page. |
POST /status-pages/:id/incidents/:incidentId/updates |
Project | Post an update to an incident. |
GET /maintenance |
Project | List maintenance windows. |
POST /maintenance |
Project | Plan a maintenance window. |
GET /maintenance/:id |
Project | Get a maintenance window. |
PATCH /maintenance/:id |
Project | Change, pause, or resume a window. |
POST /maintenance/:id/end |
Project | End a running one-time window now. |
DELETE /maintenance/:id |
Project | Cancel a window. |
GET /channels |
Project | List alert channels, without their settings. |
GET /servers/:id/channels |
Project | The channels a monitor’s alerts go to. |
PUT /servers/:id/channels |
Project | Set the channels a monitor’s alerts go to. |
POST /servers/:id/test-alert |
Project | Send a test alert through a monitor’s channels. |
GET /hosts |
Project | List servers that run the agent, with counts by status. |
GET /hosts/incidents |
Project | Server incidents of the last 30 days, open first. |
GET /hosts/incidents/:id |
Project | Get a server incident, with its servers and timeline. |
POST /hosts/incidents/:id/acknowledge |
Project | Acknowledge a server incident. |
POST /hosts/incidents/:id/notes |
Project | Add a note for the team to a server incident. |
POST /hosts/incidents/:id/resolve |
Project | Resolve an incident about a country’s users by hand. |
GET /hosts/install |
Project | The command that installs the agent. |
POST /hosts/install/token |
Project | A one-hour install command for up to 50 servers, the one an AI assistant gets. |
POST /hosts/install/rotate |
Project | Make a new install key. |
GET /hosts/:id |
Project | Get a server in full. |
GET /hosts/:id/history |
Project | A server’s readings over time, or one country’s users. |
GET /hosts/:id/blocks |
Project | A VPN server’s blocks by country, the last 90 days. |
PUT /hosts/:id |
Project | Rename a server, or set its group or tags. |
POST /hosts/:id/link |
Project | Link a tunnel or check to a server. |
POST /hosts/:id/unlink |
Project | Keep a tunnel or check away from a server. |
PATCH /hosts/:id/alerts |
Project | Change a server’s alerts. |
DELETE /hosts/:id |
Project | Remove a server. Its agent stays installed. |
POST /hosts/:id/update |
Project | Update a server’s agent to the latest release. |
GET /hosts/defaults |
Project | The project’s default for new servers’ agent updates. |
PUT /hosts/defaults |
Project | Change that default. |
GET /hosts/settings |
Project | The project’s Count online users. |
PUT /hosts/settings |
Project | Switch counting online users off for a no-log policy, or back on. |
GET /hosts/suggestions |
Project | What looks linked or added twice. |
POST /hosts/suggestions/:id/accept |
Project | Accept a suggestion: link, remove an old copy, or delete a copy. |
POST /hosts/suggestions/:id/dismiss |
Project | Turn a suggestion down for good. |
POST /hosts/suggestions/:id/undo |
Project | Undo a decision of the last hour, a removal aside. |
POST /hosts/suggestions/accept-many |
Project | Accept up to 100 suggestions at once. |
GET /reports/availability |
Project | A month’s availability against the target, by tunnel, group, or hosting provider, as on the Reports page. As CSV with Accept: text/csv. |
GET /reports/settings |
Project | The availability target and whether the monthly email is on. |
PUT /reports/settings |
Project | Change the target, or turn the monthly email on or off (Owners only). |
POST /ai-sre/ask |
Project | Ask AI SRE a question. It answers in the background. |
GET /ai-sre/conversations |
Project | List AI SRE conversations. |
GET /ai-sre/conversations/:id |
Project | Read a conversation and its answers. |
POST /ai-sre/conversations/:id/messages |
Project | Ask a follow-up. |
POST /ai-sre/conversations/:id/stop |
Project | Stop the answer being written. |
GET /ai-sre/usage |
Project | This month’s AI SRE answers and the limit. |
POST /ai-sre/attachments |
Project | Add a file for your next question. |
DELETE /ai-sre/attachments/:id |
Project | Delete a file now. |
GET /ai-sre/attachments/:id/content |
Project | Download a sent file. |
GET /whoami |
Key only | Who the key belongs to, the workspaces (with your role) and projects it can reach, and the default workspace and project. |
GET /organizations |
Key only | Workspaces the key can reach, with your role in each. |
GET /projects |
Key only | Projects the key can reach. Filter with ?organization_id=. |
GET /usage |
Key only | API request usage and limits for this minute, today, and this month, with daily history and a per-endpoint breakdown. |
GET /keys |
Key only | List API keys. |
POST /keys |
Key only | Create a workspace API key. Needs a workspace key and a role that can edit monitors in its workspace; otherwise 403. |
DELETE /keys/:id |
Key only | Disable an API key. Add ?hard=1 to delete it for good. |
These endpoints don’t need a key:
| Method and path | Description |
|---|---|
GET /health |
Whether the API is up, with its version and uptime. |
GET /health/deep |
Also checks the database and the job queue. Returns 503 if either fails. |
GET /regions |
The locations you can test from, with the number of healthy checkers in each. |
POST /check/public |
A one-off config check, limited to 5 per IP address per 24 hours. Nothing is saved. The free tester on this site uses it. |
Monitor status in the API
Section titled “Monitor status in the API”A monitor’s status is one of eight values, the same in every response, the MCP server, and the CLI:
API status |
Dashboard shows | Meaning |
|---|---|---|
healthy |
Healthy | Its checks pass. |
degraded |
Degraded | It answers, but the server refused the monitor’s login or credentials (status_reason.code login_rejected or credentials_rejected); or a tunnel’s test fails while its server’s own users stay connected (test_fails, shown with Test fails as the reason under Degraded). See When our test fails, not the server. |
partial_outage |
Partial outage | Down from some of its locations, not all of them. |
down |
Down | Its checks fail. For a heartbeat, no request arrived in time. |
paused |
Paused | The monitor is paused. |
maintenance |
Maintenance | A running maintenance window covers it. |
pending |
Not checked yet | It hasn’t been checked yet. |
no_data |
No data | No result for longer than two of its own intervals, or a tunnel or check that isn’t checked until its settings change. See below. |
When more than one could apply, paused comes first, then maintenance, then a tunnel or check that isn’t checked, then pending, then no_data, and then the newest results. Values are only ever added, never renamed or removed, so treat a value you don’t know as no_data.
Retrying a first failure isn’t a state. The monitor keeps its last confirmed status, and confirming_failure is true until the retry decides.
Beside status, every monitor carries:
previous_status: the status before this one, ornullwhen it isn’t known.status_since: when this status began, ornullwhen it isn’t known.status_reason:{ code, message }. Thecode, such aschecks_failorcredentials_rejected, is fixed, so match on it. Themessageis a sentence for a person and may be reworded.confirming_failure:truewhile a first failure is being checked again.last_checked_at: its newest result, in ISO 8601 UTC.
A tunnel or check that isn’t checked is no_data, or stays down if it was down before, and its status_reason.code says why:
code |
Why it isn’t checked | To fix it |
|---|---|---|
login_missing |
The tunnel has no login, or its login is missing something its protocol needs. | Send its whole config in PUT /servers/:id. |
login_unreadable |
The tunnel’s saved login can’t be read on this TunnelHQ server. | Send its whole config, every field its protocol needs. A change to only part of it answers 409. |
request_unreadable |
A website or keyword check’s saved login, request headers, or body can’t be read on this TunnelHQ server. | Enter them again in the check’s settings. Its login can also be sent again as basic_auth_user and basic_auth_pass. |
address_refused |
The tunnel’s server address is private or reserved, so the checkers refuse it. | Send a public address. |
A heartbeat also has last_call_at: when its job last called its address, whatever the call reported. It isn’t last_checked_at, which for a down heartbeat is TunnelHQ’s own look that found no call. It’s null when no call is on record.
A heartbeat’s recent_calls lists its last 24 expected calls, as the dashboard’s pills: each on_time, late, failed, or missed, with when it was due and when it came. call_in_grace is a call that’s due and still inside its grace.
Each location in regional_status takes the same eight values, plus unavailable when no working checker is there, so the location is left out of the monitor’s status.
To filter List monitors by status, send one of the eight values as status. Three older words still work: partial for partial_outage, unknown for pending or no_data, and up for healthy. pending now means never checked; before 13 Nov 2026 it was another name for degraded. To list the worst first, sort by severity.
See the API reference for every field.
Errors
Section titled “Errors”Errors return a JSON body with the HTTP status repeated in code:
{ "error": true, "code": 404, "message": "Server not found" }Usage-limit errors (429 when you exceed your plan’s request limits) use a different shape, with error naming the limit you hit:
| Limit | error |
retry_after |
|---|---|---|
| Per minute | Rate limit exceeded |
60 |
| Per day | Daily limit exceeded |
3600 |
| Per month | Monthly limit exceeded |
Not sent |
{ "error": "Rate limit exceeded", "message": "Per-minute limit of 60 requests exceeded", "retry_after": 60 }Too many failed key attempts from one IP address also return 429, in the standard shape:
{ "error": true, "code": 429, "message": "Too many failed API key attempts from this address. Wait a few seconds and try again.", "retry_after": 6 }Rate limits and usage
Section titled “Rate limits and usage”Requests are limited per workspace, according to its plan, in fixed per-minute, per-day, and per-month windows.
| Plan | Per minute | Per day | Per month | On-demand tests per month |
|---|---|---|---|---|
| Free | 10 | 500 | 5,000 | 5 |
| Starter | 30 | 5,000 | 50,000 | 50 |
| Pro | 60 | 25,000 | 250,000 | 500 |
| Business | 120 | 100,000 | 1,000,000 | Unlimited |
Workspaces on the old Free plan, from before 23 November 2026, have no API access.
The on-demand test quota counts one test per monitor tested, whether from the dashboard, POST /test, POST /test/batch, or an incident retest. It resets at the start of each calendar month (UTC). POST /check doesn’t count against it.
Authenticated responses report the per-minute window in three headers:
| Header | Meaning |
|---|---|
X-RateLimit-Limit |
Requests allowed per minute on your plan. |
X-RateLimit-Remaining |
Requests left in the current minute. |
X-RateLimit-Reset |
Unix time when the current minute ends. |
When you hit the per-minute limit, the 429 response includes Retry-After: 60. For the per-day limit it’s Retry-After: 3600. The monthly limit has no Retry-After.
The API Keys page shows usage for each key and for the whole workspace.