Routers
Routers connect multiple private networks, allowing servers on different networks to communicate with each other. Static routes can be configured to control traffic flow between networks.
List routers
Returns a list of all routers in the account.
Query parameters
- Name
label- Type
- string
- Description
Filter by label (e.g.,
?label=env=prod).
Request
curl -X GET https://api.upcloud.com/1.3/router \
-u your_username:your_password
Get router details
Returns detailed information about a specific router.
Request
curl -X GET https://api.upcloud.com/1.3/router/04c0df35-2658-4b0c-8ac7-962090f4e92a \
-u your_username:your_password
Create router
Creates a new router. Routers connect multiple private networks, allowing servers on any attached network to communicate directly.
Attributes
- Name
name- Type
- string
- Description
Router name. Required.
- Name
static_routes- Type
- array
- Description
Static route configurations (0-50 routes).
- Name
labels- Type
- array
- Description
Labels for classification.
Static route attributes
- Name
name- Type
- string
- Description
Route name for identification.
- Name
route- Type
- string
- Description
Destination network in CIDR notation. Required.
- Name
nexthop- Type
- string
- Description
Next hop IP address. Required.
Request
curl -X POST https://api.upcloud.com/1.3/router \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"router": {
"name": "Production Router",
"static_routes": [
{
"name": "default_route",
"route": "0.0.0.0/0",
"nexthop": "10.0.0.100"
}
],
"labels": [
{"key": "env", "value": "prod"}
]
}
}'
Modify router
Modifies an existing router. Static routes of type service cannot be modified.
Request
curl -X PATCH https://api.upcloud.com/1.3/router/04c0df35-2658-4b0c-8ac7-962090f4e92a \
-u your_username:your_password \
-H "Content-Type: application/json" \
-d '{
"router": {
"name": "Updated Router Name",
"static_routes": [
{
"name": "new_route",
"route": "192.168.0.0/24",
"nexthop": "10.0.0.50"
}
],
"labels": [
{"key": "service", "value": "database"}
]
}
}'
Delete router
Deletes a router. All networks must be detached before the router can be deleted.
Request
curl -X DELETE https://api.upcloud.com/1.3/router/04c0df35-2658-4b0c-8ac7-962090f4e92a \
-u your_username:your_password