Zum Inhalt springen
DeutschlandGPT

IP restrictions

Decide which IP addresses may use an API key, check refused requests and allow addresses.

With an IP restriction the API accepts a key only from addresses you allowed. A key that ends up in the wrong hands is then of no use outside your servers.

You set the restriction on a key's page: open API keys, click the key and then IP restrictions. It can be changed by the person who created the key, administrators with full rights and roles with Manage all Platform API keys.

Allow addresses

  1. Under Allowed addresses, enter an address and click Add.
  2. Switch on IP restriction.

Possible entries:

EntryExample
IPv4 address203.0.113.7
IPv4 range (CIDR)203.0.113.0/24, prefix 0 to 32
IPv6 address2001:db8::1
IPv6 range (CIDR)2001:db8::/48, prefix 0 to 128

The page stores every entry in its short form: 203.0.113.77/24 becomes 203.0.113.0/24, and an IPv4 address written as IPv6 (::ffff:203.0.113.7) becomes the IPv4 address. If an address is already in the list, the page says so instead of adding it twice.

Each entry can have a label, for example the name of the server or location. It only helps you find the entry again and plays no part in the check. A key can have at most 100 entries; if you need more, combine addresses into a CIDR range.

Private and internal addresses

The page does not accept addresses from private and internal ranges such as 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.1 or fd00::/8. The API never sees the address of a machine inside your network, always the public address your server uses on the internet. Enter that one. Your network team can tell you which it is, or you can find it in the list of refused requests below.

When the restriction applies

SwitchListResult
offanyRequests from every address are allowed.
onemptyRequests from every address are allowed.
onwith entriesOnly requests from the listed addresses are allowed.

An empty list restricts nothing, even with the switch on. That is why the page asks before you remove the last entry. The sentence above the list always says which case applies.

The restriction applies to every endpoint that accepts the key, the Anthropic-compatible ones included. If the API cannot determine the address of a request, it refuses the request as soon as the list has entries.

Refused requests

The API answers a request from an address that is not in the list with status 403 and the code api_key_ip_not_allowed. The error message names the refused address, so you can see which one you would have to allow.

Refused requests (7 days) shows the addresses requests were refused from in the last 7 days, when the last one came and how many there were. If one of them is your own server, Allow adds it to the list with the label Allowed from refused requests. DeutschlandGPT keeps these records for 90 days and deletes them afterwards.

Your own address

The page detects the address you opened it from. If the restriction is on and that address is not in the list, the page warns you: from this computer the API would refuse the key. Allow my IP … adds it. An entry that covers your address is marked Your address.

Who may loosen a restriction

Loosening means allowing an address while the restriction applies, removing the last entry or switching the restriction off. Tightening means removing entries while at least one remains, or switching the restriction on.

If an administrator or a person with Manage all Platform API keys set the restriction on someone else's key, the person who created the key can only tighten it. The page then shows who set it. Only an administrator or a person with that right can loosen it again.

Was this page helpful?