Limit an API key to your servers

If someone gets hold of a secret key, they can use it like you can, payouts included. You can stop that by limiting the key to the IP addresses of your own servers. A call with the key from anywhere else is refused before it does anything.

This works on secret keys only. Publishable keys are used from your customers' browsers, so they are never limited.

Only the workspace owner can change the list. Developers and other members can see it.

Add your servers

  1. Go to Settings > API keys.
  2. Click the secret key to open it.
  3. Under Allowed IP addresses, type your server's address, like 203.0.113.7, or a range, like 203.0.113.0/24.
  4. Click Add. The list saves right away.
  5. Add every server that uses this key. You can paste several addresses at once, separated by commas.

The key now shows IP limited in the list.

You can also add an address in one click:

  • Your current IP is the address of the computer you are on. Your server's address is often different.
  • Used from, last 14 days lists the addresses the key really worked from. Click Add next to one, or Add all.

Before you save

If the new list would refuse an address this key worked from in the last 14 days, Paysio asks first: Refuse these addresses? Check the addresses it lists. Click Save if you meant it, or Cancel and add the missing servers first.

What you can enter

  • A single IPv4 or IPv6 address, like 203.0.113.7 or 2001:db8::7.
  • A range in CIDR form, like 203.0.113.0/24 or 2001:db8:abcd::/48.

Paysio tidies ranges for you, so 203.0.113.77/24 is saved as 203.0.113.0/24.

You can't enter:

  • Domains. A call from one server to another carries no domain anyone can trust, so a domain can't protect a key. Use your server's IP address. Your hosting provider shows it, or run curl https://ifconfig.me on the server.
  • Private addresses, like 10.0.0.5 or 192.168.1.20. Paysio always sees your server's public address.
  • Shared network addresses. Code running on a large edge network calls from addresses shared by every site on that network, so they can't stand for your server.

Remove the limit

Click the X next to each address. When the list is empty, any address can use the key again.

When a call is refused

Your code gets a 403 error with the code ip_not_allowed. The message names the address the call came from. Nothing was created or charged.

The refusal also shows under History when you open the key. The people on your Fraud & risk email list in Settings > Notifications get an email about it, at most once an hour per key. If the address is not one of your servers, your key may have leaked: create a new key, move your server to it, then revoke the old one.