Best practices
These habits keep your IP geolocation API integration fast and reliable.
- Call from your server and keep the key in an environment variable, never in browser code or a public repository.
- Set a short timeout of about three seconds, so a slow network never holds up a signup or checkout.
- Cache each result for about an hour. Visitors keep the same address for hours, and cached answers save lookups.
- Fail open. If the API cannot be reached, let the visitor continue and rely on your other checks.
- Use the real client IP. Behind a load balancer or CDN, read it from a header such as
X-Forwarded-For, and trust that header only when it comes from your own proxy. - Accept every country you serve in the check endpoint, for example
country=IN,SG,AE, so neighbouring markets are not rejected by mistake.
Need a hand? Search the Help Center or open a support ticket. We usually reply within one business day.