Authentication
Send your API key in the x-api-key header, or call without a key for testing.
There are two ways to call the API.
| How | Limit | |
|---|---|---|
| With a key | x-api-key header | Your plan's daily quota, 1,500 lookups a day on Free |
| Without a key | No header | 30 lookups a minute per IP address |
Both get the same complete response. Use a key for anything in production.
Sending the key
Put the key in the x-api-key header:
curl https://api.geoiphub.com/v1/lookup/8.8.8.8 \
-H "x-api-key: $GEOIPHUB_API_KEY"Getting a key
Open API keys in the dashboard and click Create key. Give it a name that says where it's used, like Production server. The key is shown once: copy it into your server's secrets straight away. If you lose it, revoke it and create a new one. See API keys.
Keeping it safe
- Keep the key on your server, in an environment variable or a secrets manager.
- Never put it in front-end code, a mobile app or a public repository. Anyone who has it can spend your quota.
- If a key leaks, revoke it in the dashboard. It stops working right away.
Calling without a key
Requests without a key are allowed at 30 lookups a minute per calling IP address. They're meant for trying the API and small scripts. If you go over, that address is blocked for two hours. See Rate limits.