oneapi
Sign in
Locations v1 / GeoIP

GeoIP — a given IP

Like the parameterless variant, but for an IP given in the path (/geoip/{ip}). Useful for checking any IP address, not just the caller's.

GET
https://oneapi.ro/api/locations/v1/geoip/{ip}

Path parameters

NameTypeDescriptionExample
iprequired string The IP address looked up, IPv4 or IPv6.

Query parameters

This route accepts no query parameters.

How it behaves

  • Like /geoip, but for an IP given in the path — checks any address, not just the caller's.
  • An IP in Romania → region/county/unit/locality from our data; outside Romania or private → in_romania: false; an invalid IP → 422.

What it is for

  • Enriching logs or leads with the approximate county of a collected IP.
  • Geographic verification of an IP from a webhook or order before regional routing.
  • Server-side filtering on an IP given in the path, not just the caller's.

Response structure

FieldTypeDescription
data.ip string The IP requested.
data.in_romania boolean Whether the IP falls inside Romania's borders. false → no other field.
data.regiune[] mixed The region the IP falls in; present only when the precision allowed administrative resolution.opțional
data.judet[] mixed The county the IP falls in; present only when the precision allowed resolution.opțional
data.uat[] mixed The administrative unit the IP falls in; present only when the precision allowed resolution.opțional
data.localitate[] object[] The locality the IP falls in; can be null even when the county is known.opțional
data.localitate.distanta_m integer Distance from the IP point to the returned locality (metres).
meta.distanta object How the distances in the response are measured. Present on every response that carries a distance.
meta.distanta.metoda string Always linie_dreapta (straight line): the geodesic distance over the Earth's surface, not by road.
meta.distanta.detaliu string The same information, in words.

Response examples

Resolved to Cluj-Napoca plus county/unit/locality.

GEThttps://oneapi.ro/api/locations/v1/geoip/188.27.0.1
{
    "data": {
        "ip": "188.27.0.1",
        "in_romania": true,
        "regiune": {
            "cod": "RO11",
            "nume": "Nord-Vest"
        },
        "judet": {
            "cod": "CJ",
            "nume": "Cluj"
        },
        "uat": {
            "cod_siruta": 54975,
            "nume": "Cluj-Napoca",
            "tip": "municipiu"
        },
        "localitate": {
            "cod_siruta": 54984,
            "nume": "Cluj-Napoca",
            "tip": "resedinta_municipiu",
            "distanta_m": 3120
        }
    },
    "meta": {
        "sursa": "MaxMind GeoLite2",
        "precizie": "aproximativa",
        "atribuire": "This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.",
        "distanta": {
            "metoda": "linie_dreapta",
            "detaliu": "Distanţele sunt geodezice, în linie dreaptă pe suprafaţa Pământului (WGS84) — nu pe drum."
        }
    }
}

Error codes

CodeSlugWhen it occurs
401neautentificatToken missing, invalid, expired or revoked.
403feature_indisponibilThe current plan does not include the feature the route depends on.
404negasitNothing exists for the ip in the path.
422ip_invalidThe IP address in the path is not valid.
429cota_depasitaThe plan's monthly quota has been exceeded (see Retry-After).

All errors share the same shape. eroare.cod is stable and is the value you should branch on in code — not the text in mesaj, which may change.

{
    "eroare": {
        "cod": "ip_invalid",
        "mesaj": "The IP address in the path is not valid.",
        "detalii": {
            "ip": [
                "The value sent does not satisfy the parameter rule."
            ]
        }
    }
}