Both API versions are available over gRPC and HTTP. Locations contain
country (an ISO 3166-1 alpha-2 code such as US or DE) and
continent (a two-letter code such as NA or EU). See the
v1 schema and
v2 schema for request and response fields.
Start the development server to try the gRPC examples or HTTP examples. See the README quickstart.
GetLocationByIP and GetLocationByLatLng perform separate IP and point
lookups. Both methods return gRPC NotFound or HTTP 404 for invalid or
unresolved lookups.
GetLocation resolves an IP address and a latitude and longitude point
independently. The response populates ip for a successful IP lookup and
geo for a successful point lookup. If both lookups succeed, both fields
are populated. On partial success, the response includes the successful
field and omits diagnostics for the failed lookup.
An explicit ip or point takes precedence for that lookup. When ip
is empty, Standort uses transport IP metadata, commonly derived from
X-Forwarded-For. When point is omitted, Standort looks for a
Geolocation header containing a geo: URI (RFC 5870). This fallback
applies independently to both inputs in GetLocation and to each
LookupLocations entry.
[!WARNING] Normalize forwarded IP metadata at a trusted proxy or gateway before relying on it. Standort uses the IP metadata supplied by the transport.
LookupLocations accepts up to 100 entries and preserves their order in
the response. Each entry returns one outcome. Successful entries populate
locations.ip, locations.geo, or both. An entry that resolves neither
input returns a google.rpc.Status with code NOT_FOUND (5) inside the
successful batch response. More than 100 entries fail the whole call with
gRPC InvalidArgument or HTTP 400.
For HTTP batch requests, use Content-Type: application/pbjson to send
protobuf JSON and Accept: application/pbjson to receive it. Each entry in
the JSON response has either locations or status.
When neither input resolves in GetLocation, the server returns gRPC
NotFound or HTTP 404. Code-only diagnostics, when available, appear
in gRPC trailing metadata or HTTP response headers.
For failed batch entries with diagnostics, status.details contains one
google.rpc.ErrorInfo with reason LOCATION_LOOKUP_FAILED and domain
standort.v2. Its metadata uses the same keys and codes as the terminal
GetLocation response. Clients must ignore unknown keys and codes. The
metadata contains only diagnostic keys and codes.
| Diagnostic key | Meaning | Current codes |
|---|---|---|
location-ip-error |
IP parsing or lookup failed | invalid_ip, not_found |
location-lat-lng-error |
Point validation or lookup failed | invalid_point, not_found |
location-point-error |
Geolocation metadata could not be parsed |
invalid_geo_uri |
GetLookupAssets reports the name, size in bytes, checksum algorithm, and
checksum of each embedded lookup asset. Use these values to identify the
data in a running build. See Lookup assets for
accuracy limits, dataset provenance, and refresh instructions.
Use grpcurl -plaintext against the development gRPC address
(localhost:12000). If you configure TLS, use the corresponding TLS flags.
grpcurl -plaintext \
-d '{"ip":"8.8.8.8"}' \
localhost:12000 \
standort.v1.Service/GetLocationByIP
grpcurl -plaintext \
-d '{"lat":52.5200,"lng":13.4050}' \
localhost:12000 \
standort.v1.Service/GetLocationByLatLng
grpcurl -plaintext \
-d '{"ip":"8.8.8.8"}' \
localhost:12000 \
standort.v2.Service/GetLocation
grpcurl -plaintext \
-d '{"point":{"lat":52.5200,"lng":13.4050}}' \
localhost:12000 \
standort.v2.Service/GetLocation
grpcurl -plaintext \
-H 'Geolocation: geo:52.5200,13.4050' \
-d '{}' \
localhost:12000 \
standort.v2.Service/GetLocation
The same request can use a forwarded IP address.
grpcurl -plaintext \
-H 'X-Forwarded-For: 8.8.8.8' \
-d '{}' \
localhost:12000 \
standort.v2.Service/GetLocation
grpcurl -plaintext \
-d '{"lookups":[{"ip":"8.8.8.8"},{"point":{"lat":52.5200,"lng":13.4050}},{"ip":"192.0.2.1"}]}' \
localhost:12000 \
standort.v2.Service/LookupLocations
grpcurl -plaintext \
-d '{}' \
localhost:12000 \
standort.v2.Service/GetLookupAssets
HTTP runs on localhost:11000 with the development config. Send RPCs as
POST requests using the full gRPC method name as the path.
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-d '{"ip":"8.8.8.8"}' \
http://localhost:11000/standort.v1.Service/GetLocationByIP
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-d '{"lat":52.5200,"lng":13.4050}' \
http://localhost:11000/standort.v1.Service/GetLocationByLatLng
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-d '{"ip":"8.8.8.8"}' \
http://localhost:11000/standort.v2.Service/GetLocation
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-d '{"point":{"lat":52.5200,"lng":13.4050}}' \
http://localhost:11000/standort.v2.Service/GetLocation
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-H 'Geolocation: geo:52.5200,13.4050' \
-d '{}' \
http://localhost:11000/standort.v2.Service/GetLocation
The same request can use a forwarded IP address.
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-H 'X-Forwarded-For: 8.8.8.8' \
-d '{}' \
http://localhost:11000/standort.v2.Service/GetLocation
curl -sS \
-X POST \
-H 'Content-Type: application/pbjson' \
-H 'Accept: application/pbjson' \
-d '{"lookups":[{"ip":"8.8.8.8"},{"point":{"lat":52.5200,"lng":13.4050}},{"ip":"192.0.2.1"}]}' \
http://localhost:11000/standort.v2.Service/LookupLocations
curl -sS \
-X POST \
-H 'Content-Type: application/json' \
-d '{}' \
http://localhost:11000/standort.v2.Service/GetLookupAssets