Use cases

Detecting data residency for GDPR compliance

GDPR compliance touches more of a product's technical architecture than most teams expect going in, and one of the more concrete requirements a SaaS company ran into was needing to know, reliably and at the start of every session, whether a visitor was connecting from inside the European Union, since that answer decided which data storage region a new account's data should be routed to and which consent flow needed to be shown before any non-essential data collection started.

Self-reported location was not reliable enough for this. Asking a visitor to declare their own country during signup produces answers people sometimes skip, mistype, or simply get wrong when signing up quickly, and the company needed a signal that did not depend on a form field being filled in correctly to make a compliance-relevant decision.

/v1/ip gave the company an independent, server-side signal for this. Resolving a visitor's IP address into a country field, checked automatically at the start of a new session, told the company's application server whether to apply EU-specific consent and data handling rules before the visitor had interacted with anything on the page at all, rather than after the fact once some data collection had already happened.

The company treated the detected country as a strong operational signal for this purpose specifically because GDPR's own protections are generally understood to apply based on where a person is located when their data is processed, not based on their nationality or where a company is headquartered, which made an IP-based location check a genuinely relevant signal for this particular compliance question in a way it would not necessarily be for, say, determining which country's tax law applied to a transaction. The company's own legal counsel reviewed this approach specifically and treated it as one reasonable input into a broader compliance program, not a complete solution by itself.

Edge cases were handled conservatively rather than optimistically. A visitor whose IP resolved ambiguously, or where a VPN or proxy was detected using the extras field available with mg_extras=1 or the X-MG-Extras header, defaulted to the stricter EU-consistent handling rather than the lighter default, on the reasoning that applying stronger privacy protections to a visitor who did not need them was a far smaller problem than applying weaker protections to one who did. This conservative default was a deliberate policy decision made with legal guidance, not something the location lookup itself determined.

The company logged which country signal had driven each session's data handling decision, alongside a timestamp, as part of its own compliance documentation, giving it a concrete, auditable record of how these decisions were made if a regulator or auditor ever asked, rather than an unverifiable claim about how the system generally behaved.

None of this replaces broader GDPR compliance work around consent language, data subject rights, or a company's underlying data processing agreements, and the company was explicit internally that IP-based country detection solved one specific, narrow piece of a much larger compliance picture, the piece about routing a session to the right handling rules at the moment it started.

Volume matched session volume, comfortably inside the free daily allowance for moderate traffic and moving into prepaid credit predictably as the product grew. Documentation for the endpoint is at /docs/ipv4-lookup/ and /docs/ipv6-lookup/.