Skip to content
Hoody.com

Manage ingress and egress firewall rules for containers. Use these endpoints to list the active rule set, add or remove rules, toggle rule state without deleting, or fully reset the firewall back to an open state. Each container is bounded by a maximum rule count and a maximum serialized rule size, both returned by the list endpoint.

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

Section titled “GET /api/v1/containers/{id}/firewall/rules”

Retrieve the full ingress and egress rule set for a container, plus advisory counters and limits.

NameInTypeRequiredDescription
idpathstringYesContainer ID
Terminal window
curl -X GET "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/rules" \
-H "Authorization: Bearer <token>"
{
"statusCode": 200,
"message": "Firewall rules retrieved successfully",
"data": {
"ingress": [],
"egress": [],
"rule_count": 0,
"byte_count": 0,
"max_rules": 500,
"max_bytes": 262144
}
}

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

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

Add a new ingress (inbound) firewall rule. Controls which traffic can reach the container.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
actionstringYesAction to take: allow (permit), reject (deny with response), drop (deny silently)
protocolstringYesNetwork protocol: tcp, udp, or 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: enabled or disabled (defaults to enabled)
icmp_typestringNoICMP type number (e.g., 8 for echo request/ping)
icmp_codestringNoICMP code number
Terminal window
curl -X POST "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/ingress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"action": "allow",
"protocol": "tcp",
"description": "Allow SSH from office",
"destination_port": "22",
"source": "203.0.113.5/32"
}'

Rule already exists. No changes made.

{
"statusCode": 200,
"message": "Rule already exists",
"data": {}
}

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

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

Add a new egress (outbound) firewall rule. Controls which traffic the container can send.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
actionstringYesAction to take: allow (permit), reject (deny with response), drop (deny silently)
protocolstringYesNetwork protocol: tcp, udp, or 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: enabled or disabled (defaults to enabled)
icmp_typestringNoICMP type number
icmp_codestringNoICMP code number
Terminal window
curl -X POST "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/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"
}'

Rule already exists. No changes made.

{
"statusCode": 200,
"message": "Rule already exists",
"data": {}
}

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

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

Delete the ACL and detach the container from its firewall bridge, returning it to an open state. This is destructive: all ingress and egress rules are removed at once.

NameInTypeRequiredDescription
idpathstringYesContainer ID
Terminal window
curl -X POST "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/reset" \
-H "Authorization: Bearer <token>"
{
"statusCode": 200,
"message": "Firewall reset successfully",
"data": {
"rules": {
"ingress": [],
"egress": []
}
}
}

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

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

Enable or disable an ingress rule without deleting it. Provide the same fields used to create the rule so the matching one can be identified.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
statestringYesNew state for the rule: enabled or disabled
actionstringNoAction for matching traffic: allow, reject, or drop
protocolstringNoProtocol type: tcp, udp, or icmp4
destination_portstringNoDestination port, range (80-90), or list (80,443)
source_portstringNoSource port, range, or list
sourcestringNoSource IPv4/CIDR address(es)
descriptionstringNoRule description
icmp_typestringNoICMP type number for icmp4 protocol
icmp_codestringNoICMP code number for icmp4 protocol

The SDK has one method per state. Each sets state itself, so leave it out of the data object:

  • client.api.firewall.enableIngressRule(id, data) sets state to enabled.
  • client.api.firewall.disableIngressRule(id, data) sets state to disabled.
Terminal window
curl -X PATCH "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/ingress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"state": "disabled",
"protocol": "tcp",
"destination_port": "443"
}'
{
"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"
}
}
}

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

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

Enable or disable an egress rule without deleting it. Provide the same fields used to create the rule so the matching one can be identified.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
statestringYesNew state for the rule: enabled or disabled
actionstringNoAction for matching traffic: allow, reject, or drop
protocolstringNoProtocol type: tcp, udp, or icmp4
destination_portstringNoDestination port, range (80-90), or list (80,443)
source_portstringNoSource port, range, or list
destinationstringNoDestination IPv4/CIDR address(es)
descriptionstringNoRule description
icmp_typestringNoICMP type number for icmp4 protocol
icmp_codestringNoICMP code number for icmp4 protocol

The SDK has one method per state. Each sets state itself, so leave it out of the data object:

  • client.api.firewall.enableEgressRule(id, data) sets state to enabled.
  • client.api.firewall.disableEgressRule(id, data) sets state to disabled.
Terminal window
curl -X PATCH "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/egress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"state": "enabled",
"protocol": "tcp",
"destination_port": "443"
}'
{
"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"
}
}
}

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

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

Remove one or more ingress rules. Provide filters to match a specific rule, or set all: true to remove every ingress rule on the container. The firewall ACL remains attached. A body with no filter and no all: true is refused with 422 FIREWALL_FILTER_REQUIRED, and a body carrying a filter name this direction does not have (for example destination on ingress) is refused with 400 FIREWALL_UNKNOWN_FILTER. An omitted state matches rules in either state.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
allbooleanNoRemove all matching rules (default: first match only). Set to true with no other filters to remove all ingress rules.
actionstringNoAction for matching traffic: allow, reject, or drop
protocolstringNoProtocol type: tcp, udp, or icmp4
destination_portstringNoDestination port, range (80-90), or list (80,443)
sourcestringNoSource IPv4/CIDR address(es)
source_portstringNoSource port, range, or list
descriptionstringNoRule description
statestringNoMatch only rules in this state: enabled or disabled. Omit to match rules in either state.
icmp_typestringNoICMP type number for icmp4 protocol
icmp_codestringNoICMP code number for icmp4 protocol
Terminal window
curl -X DELETE "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/ingress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"destination_port": "22",
"source": "192.168.1.0/24"
}'
{
"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"
}
]
}
}

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

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

Remove one or more egress rules. Provide filters to match a specific rule, or set all: true to remove every egress rule on the container. The firewall ACL remains attached. A body with no filter and no all: true is refused with 422 FIREWALL_FILTER_REQUIRED, and a body carrying a filter name this direction does not have (for example source on egress) is refused with 400 FIREWALL_UNKNOWN_FILTER. An omitted state matches rules in either state.

NameInTypeRequiredDescription
idpathstringYesContainer ID
FieldTypeRequiredDescription
allbooleanNoRemove all matching rules (default: first match only). Set to true with no other filters to remove all egress rules.
actionstringNoAction for matching traffic: allow, reject, or drop
protocolstringNoProtocol type: tcp, udp, or icmp4
destination_portstringNoDestination port, range (80-90), or list (80,443)
destinationstringNoDestination IPv4/CIDR address(es)
source_portstringNoSource port, range, or list
descriptionstringNoRule description
statestringNoMatch only rules in this state: enabled or disabled. Omit to match rules in either state.
icmp_typestringNoICMP type number for icmp4 protocol
icmp_codestringNoICMP code number for icmp4 protocol
Terminal window
curl -X DELETE "https://api.hoody.com/api/v1/containers/67e89abc123def456789abcd-890abcdef12345678901cdef/firewall/egress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"all": true
}'
{
"statusCode": 200,
"message": "Egress rules removed successfully",
"data": {
"direction": "egress",
"removed_count": 1,
"removed": [
{
"action": "drop",
"protocol": "tcp",
"description": "Block outbound SMTP",
"destination_port": "25",
"destination": "0.0.0.0/0",
"state": "enabled"
}
]
}
}