IP Allowlist
Restrict API access to specific IP addresses.
Overview
IP allowlists restrict which IP addresses can use your gateway API keys. Only requests from allowed IPs will be accepted.
Enabling IP Allowlist
- Navigate to AI Gateway Settings
- Go to the Security tab
- Toggle Enable IP Allowlist on
- Add IP addresses or CIDR ranges
- Click Save
Warning: Enabling IP allowlist immediately blocks requests from non-listed IPs.
Adding IP Addresses
Single IP
203.0.113.50
CIDR Range
203.0.113.0/24 # 256 IPs: 203.0.113.0 - 203.0.113.255
10.0.0.0/8 # Private network range
IPv6
2001:db8::1
2001:db8::/32
Common Use Cases
Production Servers
Allow only your production server IPs:
# Production servers
203.0.113.10
203.0.113.11
203.0.113.12
# Load balancer
203.0.113.1/32
Vercel Deployments
Vercel uses dynamic IPs. Options:
- Use Vercel's OIDC (recommended) - Coming soon
- Disable IP allowlist for Vercel deployments
- Use Edge Functions with known egress IPs
AWS Lambda
Allow AWS Lambda NAT Gateway IPs:
# Your VPC NAT Gateway IPs
52.1.2.3
52.1.2.4
Office Network
Allow your office IP range:
# Office network
198.51.100.0/24
CI/CD Pipeline
Allow GitHub Actions IPs:
# GitHub Actions (check current list)
# https://api.github.com/meta
140.82.112.0/20
143.55.64.0/20
Per-Key IP Restrictions
Restrict specific keys to specific IPs:
- Go to Settings > Gateway API Keys
- Click on a key
- Under Allowed IPs, add addresses
- Click Save
This allows different keys for different environments:
| Key | Allowed IPs |
|---|---|
production-api | 203.0.113.10/32 |
staging-api | 10.0.0.0/8 |
development | (no restriction) |
Testing IP Allowlist
Before Enabling
Test from your expected IP:
# Check your current IP
curl https://api.transactional.dev/ip
# Test API access
curl https://api.transactional.dev/ai/v1/models \
-H "Authorization: Bearer gw_sk_your_key"After Enabling
Requests from non-allowed IPs receive:
{
"error": {
"code": "ip_not_allowed",
"message": "Request IP 203.0.113.99 is not in the allowlist",
"type": "authorization_error"
}
}HTTP Status: 403 Forbidden
Dynamic IP Handling
If your servers have dynamic IPs:
Option 1: CIDR Range
Allow a range that covers your dynamic IPs:
# Your ISP's range (may be broad)
198.51.100.0/16
Option 2: VPN or Proxy
Route API traffic through a fixed IP:
# VPN egress IP
203.0.113.100/32
Option 3: Disable Allowlist
For truly dynamic environments, rely on API key security alone.
Monitoring Blocked Requests
View blocked requests in the dashboard:
- Go to AI Gateway > Requests
- Filter by Status: Blocked
- See source IPs that were rejected
Set up alerts for blocked requests:
- Go to Settings > Alerts
- Create alert for "Blocked IP Requests > 10/hour"
- Configure notification channel
Troubleshooting
Locked Out
If you've locked yourself out:
- Contact support with your organization ID
- We can temporarily disable the allowlist
- Add correct IPs and re-enable
IP Not Showing Correctly
Check for proxies/load balancers:
# Check what IP we see
curl https://api.transactional.dev/ipIf behind a proxy, ensure X-Forwarded-For is set correctly.
CIDR Notation Help
| CIDR | Addresses | Range |
|---|---|---|
| /32 | 1 | Single IP |
| /24 | 256 | Last octet varies |
| /16 | 65,536 | Last two octets vary |
| /8 | 16,777,216 | Last three octets vary |
Best Practices
- Start permissive - Add broader ranges initially
- Monitor before restricting - Check which IPs are making requests
- Document allowed IPs - Keep a record of why each IP is allowed
- Review regularly - Remove IPs that are no longer needed
- Have a backup plan - Know how to disable in emergencies
Next Steps
On This Page
- Overview
- Enabling IP Allowlist
- Adding IP Addresses
- Single IP
- CIDR Range
- IPv6
- Common Use Cases
- Production Servers
- Vercel Deployments
- AWS Lambda
- Office Network
- CI/CD Pipeline
- Per-Key IP Restrictions
- Testing IP Allowlist
- Before Enabling
- After Enabling
- Dynamic IP Handling
- Option 1: CIDR Range
- Option 2: VPN or Proxy
- Option 3: Disable Allowlist
- Monitoring Blocked Requests
- Troubleshooting
- Locked Out
- IP Not Showing Correctly
- CIDR Notation Help
- Best Practices
- Next Steps