Skip to content

Send a test alert

POST
/servers/{id}/test-alert
curl --request POST \
--url https://dev.tunnelhq.com/api/v1/servers/srv_42/test-alert \
--header 'X-API-Key: <X-API-Key>' \
--header 'X-Project-Id: prj_12'

Sends one test message through each active channel a check’s or tunnel’s alerts go to, the same as Send test alert on its page, and says which channels took it. The message reads, for example, “[Shop website] Test alert from TunnelHQ. When this check goes down, its alert arrives here.” It carries no outage, so a paging service doesn’t treat it as one.

  • A test reaches at most 10 channels.
  • You can send 10 test messages an hour, counted per person and shared with the dashboard’s test buttons. Each channel a test reaches counts as one message.
  • A channel that fails gives a short reason: unreachable, rejected (HTTP 404), blocked: its address is not allowed, or failed. The service’s own reply is never passed on, since it can quote the channel’s address.

With no active channel, nothing is sent: sent is 0, results is empty, and message says so.

It needs a role that can edit monitors (Owner, Admin and Manager have it by default).

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

What each channel did.

Media typeapplication/json
object
id
required
string
sent
required

How many channels took the test.

integer
results
required
Array<object>
object
channel
required

The channel’s name.

string
ok
required
boolean
error

Only when ok is false: unreachable, rejected (HTTP 404), blocked: its address is not allowed, or failed.

string
message

Only when nothing was sent because no channel is active.

string
Examples
{
"id": "srv_42",
"sent": 1,
"results": [
{
"channel": "Ops Slack",
"ok": true
},
{
"channel": "Incident webhook",
"ok": false,
"error": "rejected (HTTP 404)"
}
]
}
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.

It has more than 10 active channels, or it’s a group.

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": "A test alert goes to at most 10 channels; this one has 12. Test from its page, or test a channel on the Integrations page."
}

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>"
}

Your role can’t edit monitors.

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": 403,
"message": "Sending a test alert needs a role that can edit monitors."
}

The project has no check or tunnel with this ID, 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": "Check or tunnel not found"
}

You sent 10 test messages in the last hour, or a usage limit was reached (see the other operations’ 429).

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": 429,
"message": "Too many test alerts: at most 10 messages an hour. Try again later."
}

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"
}