Manage API keys
Use an API key to make IP lookups and download databases included in your account. You start with a default key and can have up to five active keys. All keys share your account's quota and credit balance.
Create or edit a key
- Open API Keys in your account.
- Select Create API key and name the key for the application that will use it.
- Add any restrictions you need, then select Create API key. In the table, select Reveal to see the full key.
To rename a key or change its restrictions, select Edit beside it, then Save changes. Changes should take effect within a few minutes.
Regenerate a key
Select Edit → Regenerate key and confirm. Copy the replacement key shown in the table and update your applications and download jobs. The replacement keeps the saved name, IP restrictions and allowed websites. The old key stops working within a few minutes.
You can regenerate a key even if all five slots are in use. If you regenerate the default, the oldest active key becomes the default. If this is your only key, its replacement becomes the default.
For a changeover without downtime, create a separate key first, switch your applications to it, then revoke the old one.
Revoke a key
Before revoking a key, replace it in any application or download job that still uses it. On the API Keys page, select Edit beside the key, select Revoke key, then confirm. Revocation is permanent.
If you have only one key, create its replacement first. If you revoke the default key, your oldest remaining key becomes the default.
IP restrictions
Select Add IP restriction to allow lookups from your servers' public IP addresses. Enter one IPv4 address, IPv6 address, or CIDR range per line, up to 20 entries per key.
| Entry | Allows |
|---|---|
203.0.113.7 or 203.0.113.7/32 | One IPv4 address |
2001:db8::7 or 2001:db8::7/128 | One IPv6 address |
203.0.113.0/24 | IPv4 addresses from 203.0.113.0 through 203.0.113.255 |
Allowed websites
If a browser calls the API directly from your site, select Add website restriction. Enter one hostname per line, up to 20 per key. Omit the scheme, port and path.
| Entry | Allows |
|---|---|
app.example.com | Only that hostname |
*.example.com | Any subdomain, including app.example.com and maps.app.example.com |
example.com | The root domain. Add this alongside *.example.com to allow both. |
IPLocate reads the calling hostname from the browser's Origin header. If Origin is missing or empty, it checks Referer. The HTTP Host header identifies the API server. A website-restricted key receives a 403 Forbidden if the request supplies no matching website.
Anyone who can view your website can copy a key used in its JavaScript. An allowed website limits reuse in other people's browsers, but clients outside a browser can supply those headers themselves. To keep a key secret, make the lookup from your server and restrict the key to your server's public IP addresses.