BroadRouter
Get started

IP allow list

Updated

An IP allow list is a security control that accepts requests only from listed IP addresses or CIDR ranges and refuses all others. On an API, it limits the damage from a leaked key, because the key does not work from networks that are not on the list.

Also called: IP allowlist, IP whitelist, allowed IPs, IP restriction, allowed_ips

An API key works from anywhere by default. An allow list ties it to the places you actually run code.

How it works

The API’s edge checks each request’s source IP against a list. If the address is on the list, or inside a listed range, the request continues to the normal key check. If not, it is refused.

Ranges are written in CIDR notation: an address, a slash, and a prefix length. RFC 4632 explains that the prefix length is how many leading bits are fixed. For IPv4:

Entry Covers
203.0.113.7 one address
198.51.100.0/24 256 addresses, 198.51.100.0 to 198.51.100.255
10.0.0.0/16 65,536 addresses

IPv6 uses the same idea with 128-bit addresses, such as 2001:db8::/48.

The address that matters is your egress IP: the public address your server’s traffic leaves from. Behind NAT, a load balancer or a corporate proxy, that is often not the address the machine shows for itself.

Why it matters

API keys are bearer tokens: whoever holds one can use it. Keys leak through commits, logs, screenshots and laptops. With an allow list, a stolen key fails from the attacker’s network, which turns a leak from a spending incident into a non-event. GitHub, for example, applies its allow list to API calls and personal access tokens as well as web sign-ins.

The cost is some operations work. Each new server, region or CI runner needs its egress IP added, and dynamic IPs need a fixed egress path.

On BroadNet Inference

In the account page, add one IPv4 or IPv6 address or CIDR range per line, up to 32 entries. An empty list means no restriction. New keys inherit the account list. A per-key allowed_ips replaces it for that key:

curl -X POST https://inference.broadnet.ai/portal/keys \
  -H "Authorization: Bearer $BROADNET_PORTAL_CREDENTIAL" \
  -H "Content-Type: application/json" \
  -d '{"label":"worker-1","allowed_ips":["203.0.113.7","198.51.100.0/24"]}'

Requests from other addresses get a 403. After a change or a key revocation, new requests stop within five seconds. Full steps are in API keys and IP allow lists, and the error table is in errors and retries. For the wider data-protection picture, see the ZDR checklist.

Common mistakes

  • Listing a server’s private address, such as 10.x.x.x, instead of its public egress IP.
  • Using a very wide range to make errors go away. A /8 covers over 16 million addresses.

Questions

Is an IP allow list enough to protect an API key?

No. It is one layer. Still keep keys on servers, out of code and logs, give each app its own key, and revoke keys quickly when they leak.

My servers run on serverless or autoscaling infrastructure. Can I use an allow list?

Only if outbound traffic leaves from known addresses. Route it through a NAT gateway or egress proxy with fixed IPs, then list those.

What error do I get from an IP that is not on the list?

On BroadNet Inference, a 403. Other APIs typically return 403 as well.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity