Query the live driver location index to discover drivers currently near a specific coordinate. Results reflect each driver’s most recently reported position.
No authentication required — this is a public endpoint.
Request
GET /rides/drivers/nearby
Latitude of the center point to search from.
Longitude of the center point to search from.
Search radius in kilometers. Defaults to 5 if not specified.
Maximum number of drivers to return. Defaults to 10 if not specified.
Response
An array of driver location objects. Returns an empty array if no drivers are found within the radius.
Unique identifier of the driver.
Current latitude of the driver.
Current longitude of the driver.
Distance in kilometers from the queried coordinate to the driver’s current location.
Example
curl -X GET "http://localhost:8080/rides/drivers/nearby?lat=12.9757&lon=77.6011&radiusKm=3&limit=5"
[
{
"driverId": 7,
"lat": 12.9740,
"lon": 77.5998,
"distanceKm": 0.21
},
{
"driverId": 15,
"lat": 12.9781,
"lon": 77.6055,
"distanceKm": 0.58
},
{
"driverId": 23,
"lat": 12.9712,
"lon": 77.5974,
"distanceKm": 1.34
}
]
Driver locations are updated in real time as drivers report their positions. Results may be a few seconds behind each driver’s actual location.
When no drivers are available in the search area, the endpoint returns an empty array ([]) with a 200 OK status. Your client should handle an empty result gracefully.
Use a smaller radiusKm value in dense urban areas to keep the result set relevant. In low-density areas, increase the radius or omit it to use the default of 5 km.