Skip to content

The Container Firewall API controls ingress (inbound) and egress (outbound) network traffic for a container. Use these endpoints to list, add, toggle, remove, and reset firewall rules. Each container has independent rule sets for inbound and outbound traffic, and rules default to state: "enabled" when created.

Rules share a common shape across all endpoints:

FieldTypeDescription
actionstringOne of "allow", "reject", or "drop"
protocolstringOne of "tcp", "udp", or "icmp4"
descriptionstringHuman-readable rule description
destination_portstringPort number, range (80-90), or comma-separated list (80,443). Required for TCP/UDP.
sourcestringSource IPv4 address or CIDR range (ingress only)
destinationstringDestination IPv4 address or CIDR range (egress only)
source_portstringSource port filter (rarely used)
statestring"enabled" or "disabled". Defaults to "enabled".
icmp_typestringICMP type number (icmp4 protocol only)
icmp_codestringICMP code number (icmp4 protocol only)

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

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

Get all ingress and egress firewall rules for a container.

NameInTypeRequiredDescription
idpathstringYesContainer ID
const { data } = await client.api.firewall.listIterator({
id: "c_abc123def456"
});
Terminal window
curl -X GET "https://api.hoody.com/api/v1/containers/c_abc123def456/firewall/rules" \
-H "Authorization: Bearer <token>"
{
"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"
}
]
}
}

The addEgressRule and addIngressRule endpoints append a single rule to the specified direction. If an equivalent rule already exists, the API returns 200 with a duplicate flag in the data; otherwise it returns 201.

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

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

Add a new ingress (inbound) firewall rule to a container. Use this endpoint to control which traffic can reach your container. All rules default to state: "enabled" if not specified.

NameInTypeRequiredDescription
idpathstringYesContainer ID
NameTypeRequiredDescription
actionstringYesOne of "allow", "reject", or "drop"
protocolstringYesOne of "tcp", "udp", or "icmp4"
descriptionstringYesHuman-readable rule description
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)
statestringNo"enabled" or "disabled". Defaults to "enabled".
icmp_typestringNoICMP type number (e.g., 8 for echo request/ping)
icmp_codestringNoICMP code number
await client.api.firewall.addIngressRule({
id: "c_abc123def456",
data: {
action: "allow",
protocol: "tcp",
description: "Allow HTTPS",
destination_port: "443",
source: "0.0.0.0/0"
}
});
Terminal window
curl -X POST "https://api.hoody.com/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"
}'
{
"statusCode": 201,
"message": "Ingress rule added successfully",
"data": {}
}

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

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

Add a new egress (outbound) firewall rule to a container. Use this endpoint to control which traffic your container can send. All rules default to state: "enabled" if not specified.

NameInTypeRequiredDescription
idpathstringYesContainer ID
NameTypeRequiredDescription
actionstringYesOne of "allow", "reject", or "drop"
protocolstringYesOne of "tcp", "udp", or "icmp4"
descriptionstringYesHuman-readable rule description
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)
statestringNo"enabled" or "disabled". Defaults to "enabled".
icmp_typestringNoICMP type number
icmp_codestringNoICMP code number
await client.api.firewall.addEgressRule({
id: "c_abc123def456",
data: {
action: "allow",
protocol: "tcp",
description: "Allow outbound HTTPS",
destination_port: "443",
destination: "0.0.0.0/0"
}
});
Terminal window
curl -X POST "https://api.hoody.com/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"
}'
{
"statusCode": 201,
"message": "Egress rule added successfully",
"data": {}
}

The toggleIngressRule and toggleEgressRule endpoints change the state of an existing rule without deleting it. The body identifies the rule by matching fields and supplies the new state.

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

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

Enable or disable an ingress (inbound) firewall rule without deleting it. Provide filters to identify which rule to toggle. Useful for temporarily disabling rules.

NameInTypeRequiredDescription
idpathstringYesContainer ID
NameTypeRequiredDescription
statestringYesNew state: "enabled" or "disabled"
actionstringNoFilter by action: "allow", "reject", or "drop"
protocolstringNoFilter by protocol: "tcp", "udp", or "icmp4"
destination_portstringNoFilter by destination port, range, or list
source_portstringNoFilter by source port
sourcestringNoFilter by source IPv4/CIDR
descriptionstringNoFilter by rule description
icmp_typestringNoFilter by ICMP type number
icmp_codestringNoFilter by ICMP code number
await client.api.firewall.toggleIngressRule({
id: "c_abc123def456",
data: {
state: "disabled",
protocol: "tcp",
destination_port: "443"
}
});
Terminal window
curl -X PATCH "https://api.hoody.com/api/v1/containers/c_abc123def456/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 (outbound) firewall rule without deleting it. Provide filters to identify which rule to toggle. Useful for temporarily disabling rules.

NameInTypeRequiredDescription
idpathstringYesContainer ID
NameTypeRequiredDescription
statestringYesNew state: "enabled" or "disabled"
actionstringNoFilter by action: "allow", "reject", or "drop"
protocolstringNoFilter by protocol: "tcp", "udp", or "icmp4"
destination_portstringNoFilter by destination port, range, or list
source_portstringNoFilter by source port
destinationstringNoFilter by destination IPv4/CIDR
descriptionstringNoFilter by rule description
icmp_typestringNoFilter by ICMP type number
icmp_codestringNoFilter by ICMP code number
await client.api.firewall.toggleEgressRule({
id: "c_abc123def456",
data: {
state: "disabled",
protocol: "tcp",
destination_port: "25"
}
});
Terminal window
curl -X PATCH "https://api.hoody.com/api/v1/containers/c_abc123def456/firewall/egress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"state": "disabled",
"protocol": "tcp",
"destination_port": "25"
}'
{
"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"
}
}
}

The removeIngressRule and removeEgressRule endpoints delete one or more rules. By default, only the first matching rule is removed; pass all: true to remove every rule that matches the supplied filters, or pass all: true alone to remove all rules in that direction.

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

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

Remove one or more ingress (inbound) firewall rules. Provide filters to match specific rules, or use all: true to remove all ingress rules. Not equivalent to reset - this only deletes rules and leaves the firewall/ACL attached.

NameInTypeRequiredDescription
idpathstringYesContainer ID
NameTypeRequiredDescription
allbooleanNoRemove all matching rules (default: first match only). Set to true with no other filters to remove all ingress rules.
actionstringNoFilter by action: "allow", "reject", or "drop"
protocolstringNoFilter by protocol: "tcp", "udp", or "icmp4"
destination_portstringNoFilter by destination port, range, or list
sourcestringNoFilter by source IPv4/CIDR
source_portstringNoFilter by source port
descriptionstringNoFilter by rule description
statestringNoFilter by state. Defaults to "enabled".
icmp_typestringNoFilter by ICMP type number
icmp_codestringNoFilter by ICMP code number
// Remove a specific rule
await client.api.firewall.removeIngressRule({
id: "c_abc123def456",
data: {
protocol: "tcp",
destination_port: "22",
source: "192.168.1.0/24"
}
});
// Remove all ingress rules
await client.api.firewall.removeIngressRule({
id: "c_abc123def456",
data: { all: true }
});
Terminal window
curl -X DELETE "https://api.hoody.com/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"
}'
{
"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 (outbound) firewall rules. Provide filters to match specific rules, or use all: true to remove all egress rules. Not equivalent to reset - this only deletes rules and leaves the firewall/ACL attached.

NameInTypeRequiredDescription
idpathstringYesContainer ID
NameTypeRequiredDescription
allbooleanNoRemove all matching rules (default: first match only). Set to true with no other filters to remove all egress rules.
actionstringNoFilter by action: "allow", "reject", or "drop"
protocolstringNoFilter by protocol: "tcp", "udp", or "icmp4"
destination_portstringNoFilter by destination port, range, or list
destinationstringNoFilter by destination IPv4/CIDR
source_portstringNoFilter by source port
descriptionstringNoFilter by rule description
statestringNoFilter by state. Defaults to "enabled".
icmp_typestringNoFilter by ICMP type number
icmp_codestringNoFilter by ICMP code number
// Remove a specific rule
await client.api.firewall.removeEgressRule({
id: "c_abc123def456",
data: {
protocol: "tcp",
destination_port: "25"
}
});
// Remove all egress rules
await client.api.firewall.removeEgressRule({
id: "c_abc123def456",
data: { all: true }
});
Terminal window
curl -X DELETE "https://api.hoody.com/api/v1/containers/c_abc123def456/firewall/egress" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"protocol": "tcp",
"destination_port": "25"
}'
{
"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"
}
]
}
}

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

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

Delete the ACL and detach the container from the firewall bridge, returning the container to an open network state. Use this when you want to fully disable the firewall rather than remove individual rules.

NameInTypeRequiredDescription
idpathstringYesContainer ID
await client.api.firewall.reset({
id: "c_abc123def456"
});
Terminal window
curl -X POST "https://api.hoody.com/api/v1/containers/c_abc123def456/firewall/reset" \
-H "Authorization: Bearer <token>"
{
"statusCode": 200,
"message": "Firewall reset successfully",
"data": {
"rules": {
"ingress": [],
"egress": []
}
}
}