Skip to content
Hoody.com

The Container Firewall API manages ingress (inbound) and egress (outbound) firewall rules for individual containers. Use these endpoints to list, add, toggle, or remove rules, or to reset the firewall back to an open state. All rule changes are subject to per-container limits on rule count and serialized size, surfaced in the list response as rule_count, byte_count, max_rules, and max_bytes.

Every ingress or egress rule shares the same field shape:

  • actionallow, reject, or drop
  • protocoltcp, udp, or icmp4
  • description — Human-readable label, up to 255 characters
  • destination_port / source_port — A single port (443), a range (80-90), or a comma-separated list (80,443)
  • source / destination — IPv4 address or CIDR range. Use 0.0.0.0/0 for any.
  • stateenabled or disabled. Defaults to enabled.
  • icmp_type / icmp_code — Required when protocol is icmp4.

Ingress and egress rule quotas are shared — the container’s max_rules and max_bytes count both directions.

Returns every ingress and egress rule currently attached to a container, along with the rule-count and serialized-size budgets.

GET /api/v1/containers/{id}/firewall/rules

Section titled “GET /api/v1/containers/{id}/firewall/rules”
NameInTypeRequiredDescription
idpathstringYesContainer ID
{
"statusCode": 200,
"message": "Firewall rules retrieved successfully",
"data": {
"ingress": [
{
"action": "allow",
"protocol": "tcp",
"description": "Allow HTTPS traffic",
"destination_port": "443",
"source": "0.0.0.0/0",
"state": "enabled"
},
{
"action": "allow",
"protocol": "icmp4",
"description": "Allow ping from any source",
"source": "0.0.0.0/0",
"state": "enabled",
"icmp_type": "8",
"icmp_code": "0"
}
],
"egress": [
{
"action": "allow",
"protocol": "tcp",
"description": "Allow outbound HTTPS",
"destination_port": "443",
"destination": "0.0.0.0/0",
"state": "enabled"
},
{
"action": "drop",
"protocol": "tcp",
"description": "Block outbound SMTP",
"destination_port": "25",
"destination": "0.0.0.0/0",
"state": "enabled"
}
],
"rule_count": 4,
"byte_count": 612,
"max_rules": 500,
"max_bytes": 262144
}
}
Terminal window
curl -X GET https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/rules \
-H "Authorization: Bearer <token>"

POST /api/v1/containers/{id}/firewall/egress

Section titled “POST /api/v1/containers/{id}/firewall/egress”

Add a new egress (outbound) rule to control traffic leaving the container.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
actionstringYesAction for matching traffic. One of allow, reject, drop.
protocolstringYesNetwork protocol. One of tcp, udp, icmp4.
descriptionstringYesHuman-readable rule description (max 255 characters).
destination_portstringNoPort number, range (80-90), or comma-separated list (80,443). Required for TCP/UDP.
destinationstringNoDestination IPv4 address or CIDR range. Use 0.0.0.0/0 for any destination.
source_portstringNoSource port filter (rarely used).
statestringNoRule state. One of enabled, disabled. Defaults to enabled.
icmp_typestringNoICMP type number (for icmp4 protocol).
icmp_codestringNoICMP code number (for icmp4 protocol).
{
"statusCode": 200,
"message": "Rule already exists",
"data": {}
}
Terminal window
curl -X POST https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/egress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"action": "allow",
"protocol": "tcp",
"description": "Allow outbound HTTPS",
"destination_port": "443",
"destination": "0.0.0.0/0"
}'

POST /api/v1/containers/{id}/firewall/ingress

Section titled “POST /api/v1/containers/{id}/firewall/ingress”

Add a new ingress (inbound) rule to control traffic that can reach the container.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
actionstringYesAction for matching traffic. One of allow, reject, drop.
protocolstringYesNetwork protocol. One of tcp, udp, icmp4.
descriptionstringYesHuman-readable rule description (max 255 characters).
destination_portstringNoPort number, range (80-90), or comma-separated list (80,443). Required for TCP/UDP.
sourcestringNoSource IPv4 address or CIDR range. Use 0.0.0.0/0 for any source.
source_portstringNoSource port filter (rarely used).
statestringNoRule state. One of enabled, disabled. Defaults to enabled.
icmp_typestringNoICMP type number (for icmp4 protocol).
icmp_codestringNoICMP code number (for icmp4 protocol).
{
"statusCode": 200,
"message": "Rule already exists",
"data": {}
}
Terminal window
curl -X POST https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/ingress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"action": "allow",
"protocol": "tcp",
"description": "Allow HTTPS",
"destination_port": "443",
"source": "0.0.0.0/0"
}'

Flip a rule’s state between enabled and disabled without deleting it. Provide filter fields to identify which rule to toggle. The matching rule is then updated in place.

PATCH /api/v1/containers/{id}/firewall/egress

Section titled “PATCH /api/v1/containers/{id}/firewall/egress”
NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
statestringYesNew state for the rule. One of enabled, disabled.
actionstringNoMatch the rule’s action to disambiguate. One of allow, reject, drop.
protocolstringNoMatch the rule’s protocol. One of tcp, udp, icmp4.
destination_portstringNoMatch the rule’s destination port, range, or list.
destinationstringNoMatch the rule’s destination IPv4/CIDR.
source_portstringNoMatch the rule’s source port.
descriptionstringNoMatch the rule’s description.
icmp_typestringNoMatch the rule’s ICMP type.
icmp_codestringNoMatch the rule’s ICMP code.
{
"statusCode": 200,
"message": "Egress rule state toggled successfully",
"data": {
"direction": "egress",
"new_state": "enabled",
"updated": {
"action": "allow",
"protocol": "tcp",
"description": "Allow outbound HTTPS",
"destination_port": "443",
"destination": "0.0.0.0/0",
"state": "enabled"
}
}
}
Terminal window
curl -X PATCH https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/egress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"state": "disabled",
"protocol": "tcp",
"destination_port": "25"
}'

PATCH /api/v1/containers/{id}/firewall/ingress

Section titled “PATCH /api/v1/containers/{id}/firewall/ingress”
NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
statestringYesNew state for the rule. One of enabled, disabled.
actionstringNoMatch the rule’s action to disambiguate. One of allow, reject, drop.
protocolstringNoMatch the rule’s protocol. One of tcp, udp, icmp4.
destination_portstringNoMatch the rule’s destination port, range, or list.
sourcestringNoMatch the rule’s source IPv4/CIDR.
source_portstringNoMatch the rule’s source port.
descriptionstringNoMatch the rule’s description.
icmp_typestringNoMatch the rule’s ICMP type.
icmp_codestringNoMatch the rule’s ICMP code.
{
"statusCode": 200,
"message": "Ingress rule state toggled successfully",
"data": {
"direction": "ingress",
"new_state": "disabled",
"updated": {
"action": "allow",
"protocol": "tcp",
"description": "Allow HTTPS traffic",
"destination_port": "443",
"source": "0.0.0.0/0",
"state": "disabled"
}
}
}
Terminal window
curl -X PATCH https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/ingress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"state": "enabled",
"protocol": "tcp",
"destination_port": "22",
"source": "203.0.113.5/32"
}'

Delete rules from a container’s firewall. Unlike reset, this only removes matching rules and leaves the firewall ACL attached to the container’s bridge. Set all: true to remove every matching rule; omit all to remove only the first match.

DELETE /api/v1/containers/{id}/firewall/egress

Section titled “DELETE /api/v1/containers/{id}/firewall/egress”
NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
allbooleanNoRemove all matching rules (default: first match only). Set to true with no other filters to remove every egress rule.
actionstringNoMatch the rule’s action. One of allow, reject, drop.
protocolstringNoMatch the rule’s protocol. One of tcp, udp, icmp4.
destination_portstringNoMatch the rule’s destination port, range, or list.
destinationstringNoMatch the rule’s destination IPv4/CIDR.
source_portstringNoMatch the rule’s source port.
descriptionstringNoMatch the rule’s description.
statestringNoMatch the rule’s state. One of enabled, disabled. Defaults to enabled.
icmp_typestringNoMatch the rule’s ICMP type.
icmp_codestringNoMatch the rule’s ICMP code.
{
"statusCode": 200,
"message": "Egress rules removed successfully",
"data": {
"direction": "egress",
"removed_count": 2,
"removed": [
{
"action": "allow",
"protocol": "tcp",
"description": "Allow outbound HTTPS",
"destination_port": "443",
"destination": "0.0.0.0/0",
"state": "enabled"
},
{
"action": "allow",
"protocol": "tcp",
"description": "Allow outbound DNS",
"destination_port": "53",
"destination": "8.8.8.8",
"state": "enabled"
}
]
}
}
Terminal window
# Remove all egress rules
curl -X DELETE https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/egress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{ "all": true }'
# Remove a specific SMTP block
curl -X DELETE https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/egress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"destination_port": "25"
}'

DELETE /api/v1/containers/{id}/firewall/ingress

Section titled “DELETE /api/v1/containers/{id}/firewall/ingress”
NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
allbooleanNoRemove all matching rules (default: first match only). Set to true with no other filters to remove every ingress rule.
actionstringNoMatch the rule’s action. One of allow, reject, drop.
protocolstringNoMatch the rule’s protocol. One of tcp, udp, icmp4.
destination_portstringNoMatch the rule’s destination port, range, or list.
sourcestringNoMatch the rule’s source IPv4/CIDR.
source_portstringNoMatch the rule’s source port.
descriptionstringNoMatch the rule’s description.
statestringNoMatch the rule’s state. One of enabled, disabled. Defaults to enabled.
icmp_typestringNoMatch the rule’s ICMP type.
icmp_codestringNoMatch the rule’s ICMP code.
{
"statusCode": 200,
"message": "Ingress rule removed successfully",
"data": {
"direction": "ingress",
"removed_count": 1,
"removed": [
{
"action": "allow",
"protocol": "tcp",
"description": "Allow SSH from office",
"destination_port": "22",
"source": "192.168.1.0/24",
"state": "enabled"
}
]
}
}
Terminal window
# Remove a specific SSH rule
curl -X DELETE https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/ingress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"destination_port": "22",
"source": "192.168.1.0/24"
}'
# Remove every ingress rule
curl -X DELETE https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/ingress \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{ "all": true }'

Detach the firewall ACL from the container’s bridge, returning the container to an open state. Use this for a full firewall reset; for targeted rule removal, use the DELETE endpoints above instead.

POST /api/v1/containers/{id}/firewall/reset

Section titled “POST /api/v1/containers/{id}/firewall/reset”
NameInTypeRequiredDescription
idpathstringYesContainer ID

This endpoint accepts no request body.

{
"statusCode": 200,
"message": "Firewall reset successfully",
"data": {
"rules": {
"ingress": [],
"egress": []
}
}
}
Terminal window
curl -X POST https://api.hoody.icu/api/v1/containers/c_abc123def456/firewall/reset \
-H "Authorization: Bearer <token>"