Skip to main content

Subdivision Lookup

Determine which province or subdivision a GPS coordinate falls in.

Endpoint

GET /geo/subdivision/fromGps/{latitude},{longitude}

Parameters

ParameterTypeLocationDescription
latitudenumberpathLatitude coordinate (-90 to 90)
longitudenumberpathLongitude coordinate (-180 to 180)

Response

Returns an ISO 3166-2 subdivision code as a plain string.

Examples

# New York, USA
curl "https://api.boxesnlines.com/geo/subdivision/fromGps/40.7128,-74.0060" \
-H "X-API-Key: YOUR_API_KEY"
# Response: "US-NY"

# São Paulo, Brazil
curl "https://api.boxesnlines.com/geo/subdivision/fromGps/-23.5505,-46.6333" \
-H "X-API-Key: YOUR_API_KEY"
# Response: "BR-SP"

# Bavaria, Germany
curl "https://api.boxesnlines.com/geo/subdivision/fromGps/48.1351,11.5820" \
-H "X-API-Key: YOUR_API_KEY"
# Response: "DE-BY"
const response = await fetch(
"https://api.boxesnlines.com/geo/subdivision/fromGps/40.7128,-74.0060",
{ headers: { "X-API-Key": "YOUR_API_KEY" } }
);

const subdivisionCode = await response.text();
console.log(subdivisionCode); // "US-NY"

Error Responses

StatusDescription
400Invalid coordinates (latitude outside -90 to 90, longitude outside -180 to 180)
404No subdivision found at the given coordinates (ocean, disputed territory, etc.)
429Rate limit exceeded

For detailed error handling patterns, see Error Handling.

Use Cases

  • Regional compliance: Enforce subdivision-level regulations (e.g., US state privacy laws like CCPA, regional data residency requirements)
  • Tax calculation: Determine the correct tax jurisdiction at the subdivision level
  • Shipping zones: Route orders to the correct regional warehouse or calculate zone-based shipping rates
  • Localized content: Serve region-specific content, promotions, or language variants within a country
  • Service availability: Check if a service operates in a particular subdivision before accepting orders

Try It

Use the interactive API reference to test this endpoint with your own API key.