Add Firewall Rule
Add a new firewall rule to a VPS.
Request
POST /api/v1/vps/{id}/firewall
Required scope: vps:manage
Path Parameters
| Parameter |
Type |
Description |
id |
string |
The VPS ID |
Headers
| Header |
Required |
Value |
Authorization |
Yes |
Bearer YOUR_API_KEY |
Content-Type |
Yes |
application/json |
Request Body
| Field |
Type |
Required |
Description |
port |
string |
Yes |
Port or port range (e.g. 80, 8000:8100) |
proto |
string |
Yes |
Protocol: tcp, udp, or both |
action |
string |
Yes |
allow or deny |
source |
string |
No |
Source IP address (default: any) |
comment |
string |
No |
Optional comment for the rule |
{
"port": "8080",
"proto": "tcp",
"action": "allow",
"source": "any",
"comment": "Web app"
}
Response
{
"data": {
"port": "8080",
"proto": "tcp",
"action": "allow",
"source": "any",
"success": true
}
}
Errors
| Status |
Code |
Description |
| 400 |
INVALID_PORT |
Port must be a non-empty string |
| 400 |
INVALID_PROTO |
Protocol must be tcp, udp, or both |
| 400 |
INVALID_ACTION |
Action must be allow or deny |
| 400 |
INVALID_BODY |
Request body is not valid JSON |
| 404 |
NOT_FOUND |
VPS not found or not accessible |
| 502 |
FIREWALL_ERROR |
Firewall operation failed on the server |
Example
curl -X POST "https://site.quest/api/v1/vps/699cdea2ab57a244bb5273fd/firewall" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"port": "8080", "proto": "tcp", "action": "allow"}'
MCP
Firewall management is also available via the manage_firewall MCP tool.