S2Coder Address
Features Pricing Documentation FAQ

Endpoints

Reverse Geocoding API

Find known addresses near a coordinate pair, nearest first.

GET /api/v1/reverse-geocode

Parameters

NameTypeRequiredDescription
latitudefloatYesAlso accepted as lat.
longitudefloatYesAlso accepted as lng or lon.
radiusfloatNoSearch radius in kilometres, 0.05–50. Defaults to 2.
limitintegerNo1–50. Defaults to 10.

Request

curl "https://address.s2coder.com/api/v1/reverse-geocode?latitude=26.8535&longitude=81.0065&radius=3" \ -H "X-API-Key: YOUR_API_KEY"

Response

{ "success": true, "data": [ { "id": 123, "address": "3/216 Vibhuti Khand, Gomti Nagar", "locality": "Vibhuti Khand", "city": "Lucknow", "district": "Lucknow", "state": "Uttar Pradesh", "pincode": "226010", "latitude": 26.8535, "longitude": 81.0065, "distance_km": 0.042 } ], "meta": { "count": 1, "radius_km": 3 } }

Results are sorted by distance_km ascending. An empty data array means nothing known lies within the radius.

Performance note

The query first narrows candidates with a bounding box on the indexed latitude/longitude pair, then applies the haversine distance only to that small set. That keeps the cost roughly constant regardless of how many rows the table holds — but it also means a very large radius is genuinely more expensive. Ask for the smallest radius that answers your question.