Add a firewall rule
POST
Adds an inbound firewall rule to the VPS.
Access: API key: vm:write · Session: developer, admin or owner.
- A VPS can have up to 100 rules. An identical rule returns
409 conflict. The rule ID is derived from its protocol, port, CIDR and action.
header
AuthorizationBearer <token>Send Authorization: Bearer <token>. A token is an API key (lb_live_…, scoped, for programs) or a session (lb_sess_…, from signup or login, for people). See Authentication above.
id*stringThe resource id.
X-Org-ID?stringSessions only: act on this organization (you must be a member). Default: your first organization.
application/json- body
protocol*stringValue in
"tcp""udp""icmp""all"port?stringALL, a port like 443, or a range like 8000-8100. Ignored for icmp and all.
cidr?stringDefault 0.0.0.0/0.
action?stringDefault accept.
Value in
"accept""drop"description?stringLength
length <= 64Rule added
application/json- response
id*stringStable id derived from protocol, port, cidr and action.
protocol*stringValue in
"tcp""udp""icmp""all"port*stringALL, a port like 443, or a range like 8000-8100.
cidr*stringIPv4 or IPv6 address or block.
action*stringValue in
"accept""drop"description*stringcurl -X POST 'https://layerbeat.com/v1/vms/string/firewall-rules' \ -H 'Content-Type: application/json' \ -d '{ "protocol": "tcp", "port": "443", "description": "HTTPS"}'{ "id": "fw_0c9e71aac8634b64", "protocol": "tcp", "port": "443", "cidr": "0.0.0.0/0", "action": "accept", "description": "HTTPS"}