Skip to content

Move a monitor in the list

POST
/servers/{id}/move
curl --request POST \
--url https://app.tunnelhq.com/api/v1/servers/srv_42/move \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--header 'X-Project-Id: prj_12' \
--data '{ "before": "srv_7" }'

Moves a tunnel, an Uptime check, or a group in the dashboard’s list, as a row’s Move up and Move down, or Alt with an arrow key, do in Manual order. That order is the project’s, the same for everyone. It doesn’t move a monitor into another group or project: for a group, send group_id to Update monitor.

Send exactly one of:

  • before: put it just above this row.
  • after: put it just below this row.
  • to: top or bottom of its list.

The row named in before or after must be in the same list: on the same page (Tunnels or Uptime), and in the same group, or in none. The answer is that list’s IDs in their new order, and List monitors with sort=manual reads it. Open dashboards follow the move at once.

A row already at the place you ask for answers 200 with changed: false, so the same move sent again is safe.

You can also send from: where you saw the row, in the same words, such as {"after": "srv_9"}. If someone has moved it since, nothing changes, and the answer is 409 naming who. The dashboard sends from with each move, so a page that’s out of date can’t undo someone else’s move.

Needs a role that can edit monitors (Owner, Admin, and Manager 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
Media typeapplication/json
object
before

A row’s ID, such as srv_7.

string
after

A row’s ID, such as srv_7.

string
to
string
Allowed values: top bottom
from

Where you saw the row, with exactly one of before, after, or to. Left out, the move goes ahead wherever the row is now.

object
before

The row that was just below it.

string
after

The row that was just above it.

string
to
string
Allowed values: top bottom
Examples

Just above srv_7

{
"before": "srv_7"
}

Moved, or already there.

Media typeapplication/json
object
id
required
string
order
required

The IDs of the row’s list, in their new order, that you can see.

Array<string>
changed
required

false when the row was already there, and nothing changed.

boolean
Examples

Moved

{
"id": "srv_12",
"order": [
"srv_12",
"srv_7",
"srv_9"
],
"changed": true
}
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 ID isn’t a valid ID, or the body doesn’t name one place in the row’s own list.

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 role can’t edit monitors, or the key can’t reach this project.

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
Examplerole
{
"error": true,
"code": 403,
"message": "You do not have permission to edit this monitor"
}

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

The row isn’t where from says you saw it: someone moved it, or the row beside it, since. Nothing changed. The message names who, when it can.

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": 409,
"message": "Already moved by Sara"
}

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