standort

๐Ÿ”Œ Standort API

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.

๐Ÿ”น v1

GetLocationByIP and GetLocationByLatLng perform separate IP and point lookups. Both methods return gRPC NotFound or HTTP 404 for invalid or unresolved lookups.

๐Ÿ”ธ v2

๐Ÿงญ Single location lookup

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.

๐Ÿ“จ Metadata fallback

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.

๐Ÿ“ฆ Batch lookups

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.

โš ๏ธ Lookup errors

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

๐Ÿ’พ Lookup asset metadata

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.

๐Ÿงช gRPC examples

Use grpcurl -plaintext against the development gRPC address (localhost:12000). If you configure TLS, use the corresponding TLS flags.

๐ŸŒ v1 IP lookup

grpcurl -plaintext \
  -d '{"ip":"8.8.8.8"}' \
  localhost:12000 \
  standort.v1.Service/GetLocationByIP

๐Ÿ“ v1 latitude and longitude lookup

grpcurl -plaintext \
  -d '{"lat":52.5200,"lng":13.4050}' \
  localhost:12000 \
  standort.v1.Service/GetLocationByLatLng

๐ŸŒ v2 lookup with an explicit IP

grpcurl -plaintext \
  -d '{"ip":"8.8.8.8"}' \
  localhost:12000 \
  standort.v2.Service/GetLocation

๐Ÿ“ v2 lookup with an explicit point

grpcurl -plaintext \
  -d '{"point":{"lat":52.5200,"lng":13.4050}}' \
  localhost:12000 \
  standort.v2.Service/GetLocation

๐Ÿ“จ v2 lookup with metadata

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

๐Ÿ“ฆ v2 batch lookup

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

๐Ÿ’พ v2 embedded lookup assets

grpcurl -plaintext \
  -d '{}' \
  localhost:12000 \
  standort.v2.Service/GetLookupAssets

๐ŸŒ HTTP examples

HTTP runs on localhost:11000 with the development config. Send RPCs as POST requests using the full gRPC method name as the path.

๐ŸŒ v1 IP lookup

curl -sS \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"ip":"8.8.8.8"}' \
  http://localhost:11000/standort.v1.Service/GetLocationByIP

๐Ÿ“ v1 latitude and longitude lookup

curl -sS \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"lat":52.5200,"lng":13.4050}' \
  http://localhost:11000/standort.v1.Service/GetLocationByLatLng

๐ŸŒ v2 lookup with an explicit IP

curl -sS \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"ip":"8.8.8.8"}' \
  http://localhost:11000/standort.v2.Service/GetLocation

๐Ÿ“ v2 lookup with an explicit point

curl -sS \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"point":{"lat":52.5200,"lng":13.4050}}' \
  http://localhost:11000/standort.v2.Service/GetLocation

๐Ÿ“จ v2 lookup with metadata

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

๐Ÿ“ฆ v2 batch lookup

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

๐Ÿ’พ v2 embedded lookup assets

curl -sS \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{}' \
  http://localhost:11000/standort.v2.Service/GetLookupAssets