← Blog

Claude API IP Whitelisting Security Setup Guide

2026-10-01 · 5 min read · SubToAPI Team

If you searched for "Claude API IP whitelisting," you're probably trying to restrict which servers can call Claude with your credentials. The direct answer: Anthropic's Claude API does not currently offer a built-in IP allowlist setting for API keys. There's no dashboard toggle where you enter a list of approved IPs and have Anthropic reject requests from anywhere else. That surprises a lot of teams migrating from infrastructure like AWS or internal APIs where IP restrictions are standard.

That doesn't mean you're stuck. You can still build equivalent — often stronger — protection by controlling the network path your requests take and how your keys are scoped. This guide covers the practical setup: static egress IPs, deny-by-default firewall rules, per-application keys, and where a layer like SubToAPI fits into that stack.

Why Claude's API skips native IP whitelisting

Anthropic's API is designed to be called from a huge range of environments — serverless functions, CI pipelines, mobile backends, edge workers — many of which don't have stable, predictable IP addresses. An allowlist model works well for a handful of static corporate servers; it breaks down fast for autoscaling infrastructure or multi-region deployments. So instead of IP-based access control at the provider level, security has to be enforced at two points you do control: your network egress and your key management.

The real setup: control egress, not the provider's firewall

Since Anthropic can't restrict by source IP, your job is to make sure only approved systems can ever reach api.anthropic.com (or your API gateway) with a valid key in the first place.

1. Route all Claude traffic through a single egress point

Don't let every microservice or Lambda call Claude directly. Put one authenticated backend service in front of the model, and route all outbound Claude requests through it. This gives you exactly one place to:

2. Use a NAT gateway or static-IP proxy for genuinely fixed infrastructure

If your workloads run in a VPC (ECS, EKS, GKE, etc.), route outbound traffic through a NAT gateway or forward proxy with a static IP. This doesn't restrict inbound access to Claude, but it does two useful things: it gives you one predictable IP to monitor in your own logs, and it lets you enforce egress firewall rules so only that NAT gateway can reach the internet at all.

# Example: deny-by-default egress, allow only the NAT gateway subnet
iptables -P OUTPUT DROP
iptables -A OUTPUT -d 10.0.1.0/24 -j ACCEPT   # internal NAT gateway subnet
iptables -A OUTPUT -o lo -j ACCEPT

Combine this with cloud-provider security groups so application servers can't make arbitrary outbound HTTPS calls — only through the controlled path.

3. Never ship Claude keys to client-side code

This is the most common real-world leak vector, and it has nothing to do with IPs. If a Claude API key ends up in a mobile app, browser bundle, or Electron app, IP whitelisting wouldn't have saved you anyway — anyone can extract the key and call from any IP. Keys belong only in server-side environments behind your own auth layer.

4. Segment keys per application, not one shared key for everything

A single shared Claude API key used across every internal service is a single point of failure: one leak compromises everything, and you can't tell which system caused unexpected usage. Issue separate credentials per application, service, or team, so a compromised or misbehaving key can be revoked without taking down everything else.

This is exactly the layer SubToAPI adds on top of raw Claude access. Instead of handing every internal app the same underlying Claude credential, you generate scoped application keys (sub_live_...) from one dashboard, each with its own usage metadata:

curl https://api.subtoapi.app/v1/messages \
  -H "Authorization: Bearer $SUBTOAPI_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Summarize this ticket."}]
  }'

If the sub_live_ key tied to your reporting service ever leaks, you revoke that one key from the dashboard — your checkout bot, your internal tooling, and every other application keep working. That's a more actionable security boundary than an IP list that a single compromised server inside your allowlisted range would bypass anyway. See /docs/quickstart for setup and /docs/messages for the request format.

5. Watch usage, not just access

Even with egress control and scoped keys, you want visibility into what's actually being called. Track request volume, token usage, and error rates per key so an anomaly — a sudden spike from one application, repeated failures, calls at unusual hours — gets flagged before it becomes a budget or security incident. SubToAPI's dashboard surfaces this per application key, which is useful even if your infrastructure is otherwise locked down tight. Compare plans at /pricing, or start a trial at /signup.

Putting it together

A realistic Claude API security setup looks like this, layered rather than relying on one control:

  1. All outbound Claude traffic routes through a single internal proxy or backend service.
  2. That proxy sits in a VPC with deny-by-default egress and a static NAT IP, logged and monitored.
  3. Credentials are issued per application via scoped keys, never shared, never client-side.
  4. Usage and spend are monitored per key so anomalies are caught fast.
  5. Keys are rotated on a schedule and immediately on any suspected leak.

None of this requires Anthropic to support IP allowlisting — it builds equivalent protection using tools you already control.

questions

Does Anthropic support IP whitelisting for Claude API keys? No. There's no native setting to restrict a Claude API key to specific source IPs. Access control has to be implemented at your network and key-management layer instead.

What's the best alternative to IP whitelisting for securing Claude API access? Route all Claude calls through a single controlled egress point (NAT gateway or internal proxy), use deny-by-default firewall rules, and issue separate scoped API keys per application so you can revoke individually without an IP-based system.

Can SubToAPI restrict API keys by IP address? SubToAPI doesn't currently offer IP-based key restrictions. It provides per-application scoped keys, usage metadata, and team seat management, which you combine with your own network egress controls to build the layered setup described above.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →