Application network access

Use this route to define which IP addresses can reach a public HTTP application. The configuration fully replaces the current lists.

Authentication and permissions

Accepts an organization API Key (x-api-key: znf_... or Authorization: Bearer znf_...) or a user token with x-organization-id. Requires project.network.update on project:<project-id>; owner has full access.

Project requirements:

  • be an HTTP application;
  • have public exposure (see Project information);
  • be on a plan with capabilities.network_access: true in the GET /v1/project/plans catalog.

Limit: 10 requests per minute.

Update the lists

PATCH /v1/project/:id/network-access
FieldTypeRequiredDescription
network_access.ingress_white_listarrayYesAllowed ranges, 1 to 10 items for public projects; to not restrict, send [{ "cidr": "0.0.0.0/0", "description": "Any IP" }] ([] is only valid for private projects)
network_access.ingress_black_listarrayYesBlocked ranges, up to 200 items; use [] for none
*.cidrstringYesIPv4 or IPv6 range in CIDR notation, such as 203.0.113.0/24, 198.51.100.7/32 or 2001:db8::/32. An IP without a prefix becomes /32 or /128
*.descriptionstringYesRule label, from 1 to 256 characters
{
  "network_access": {
    "ingress_white_list": [
      { "cidr": "203.0.113.0/24", "description": "Office" },
      { "cidr": "198.51.100.7/32", "description": "CI server" }
    ],
    "ingress_black_list": []
  }
}
{
  "status": "success",
  "message": "updated the network access with success"
}

How rules are evaluated

  • ingress_white_list defines who can access: only the listed IPs and ranges get in. To keep the application open to everyone, use 0.0.0.0/0.
  • ingress_black_list blocks specific IPs and ranges, even when they are inside an allowed range, such as 0.0.0.0/0.
  • For public projects, ingress_white_list needs at least one item; [] is only accepted for private projects. To not restrict, send 0.0.0.0/0 in the allow list and use ingress_black_list to block what you want.

IPv4 and IPv6 are accepted: ranges such as 999.1.1.1/32 or 10.0.0.0/33 are rejected with 400. See usage examples in Network access.

Errors

CodeSituation
400Invalid body (missing list, invalid CIDR, or empty description)
400 NETWORK_RULES_LIMIT_EXCEEDEDMore than 10 items in the allow list or more than 200 in the block list
403 PROTECTION_NOT_AVAILABLE_ON_PLANPlan without the feature
404Project not found
409Project with private exposure (project is not publicly exposed) or PROJECT_STATE_CONFLICT, when the application does not have a running version yet (for example, a Git project before its first build)
422PROJECT_OPERATION_NOT_SUPPORTED: the project is not an HTTP application
429Rate limit exceeded
500Failure applying the rules; try again

Example

curl -X PATCH "https://api.zenifra.com/v1/project/6650f1a2b3c4d5e6f7a8b9c0/network-access" \
  -H "x-api-key: znf_..." \
  -H "Content-Type: application/json" \
  -d '{"network_access": {"ingress_white_list": [{"cidr": "0.0.0.0/0", "description": "Public access"}], "ingress_black_list": []}}'

Next steps

Last updated on

On this page