Point-in-Area Check
Check whether GPS coordinates fall within a specific country or subdivision. Returns a simple boolean (true or false).
Check Country
GET /geo/country/{countryCode}/isInCountry?latitude={lat}&longitude={lon}
Parameters
| Parameter | Type | Location | Description |
|---|---|---|---|
countryCode | string | path | ISO 3166-1 alpha-3 code (e.g., USA for United States, BRA for Brazil) |
latitude | number | query | Latitude coordinate (-90 to 90) |
longitude | number | query | Longitude coordinate (-180 to 180) |
Examples
# Is New York in the USA (USA)?
curl "https://api.boxesnlines.com/geo/country/USA/isInCountry?latitude=40.7128&longitude=-74.0060" \
-H "X-API-Key: YOUR_API_KEY"
# Response: true
# Is New York in Brazil (BRA)?
curl "https://api.boxesnlines.com/geo/country/BRA/isInCountry?latitude=40.7128&longitude=-74.0060" \
-H "X-API-Key: YOUR_API_KEY"
# Response: false
const response = await fetch(
"https://api.boxesnlines.com/geo/country/USA/isInCountry?latitude=40.7128&longitude=-74.0060",
{ headers: { "X-API-Key": "YOUR_API_KEY" } }
);
const isInCountry = await response.text();
console.log(isInCountry); // "true"
Check Subdivision
GET /geo/subdivision/{subdivisionCode}/isInSubdivision?latitude={lat}&longitude={lon}
Parameters
| Parameter | Type | Location | Description |
|---|---|---|---|
subdivisionCode | string | path | ISO 3166-2 code (e.g., US-NY, BR-SP) |
latitude | number | query | Latitude coordinate (-90 to 90) |
longitude | number | query | Longitude coordinate (-180 to 180) |
Examples
# Is this point in New York?
curl "https://api.boxesnlines.com/geo/subdivision/US-NY/isInSubdivision?latitude=40.7128&longitude=-74.0060" \
-H "X-API-Key: YOUR_API_KEY"
# Response: true
# Is this point in California?
curl "https://api.boxesnlines.com/geo/subdivision/US-CA/isInSubdivision?latitude=40.7128&longitude=-74.0060" \
-H "X-API-Key: YOUR_API_KEY"
# Response: false
Use Cases
- Geo-fencing: Verify a user is within a specific region before granting access
- Regulatory compliance: Confirm users are in permitted jurisdictions
- Content restrictions: Enforce geographic content licensing
- Delivery zones: Check if a location is within a service area
Related
- Country Lookup -resolve coordinates to a country code when you don't know which country to check against
- Subdivision Lookup -resolve coordinates to a subdivision code
- Error Handling -understand all error response formats
- Rate Limits -understand rate limit headers and quotas
Try It
Use the interactive API reference to test these endpoints with your own API key.