Navigation
POST geo

coordinate_distance

1 credit

Calculate the distance between two lat/lng points using the Haversine formula

Endpoint

POST /api/v1/tools/geo/coordinate_distance

Body Parameters

lat1 number required
lat2 number required
lng1 number required
lng2 number required
unit string optional default: "km"
Options: km mi m nm

Example

input Request
{
    "lat1": 48.8566,
    "lat2": 51.5074,
    "lng1": 2.3522,
    "lng2": -0.1278
}
output Response
{
    "unit": "km",
    "distance": 343.56
}

Response Format

HTTP/1.1 200 OK SUCCESS
{
  "success": true,
  "data": {
    "unit": "km",
    "distance": 343.56
},
  "meta": {
    "tool": "coordinate_distance",
    "credits_consumed": 1
  }
}
HTTP/1.1 422 Unprocessable Entity ERROR
{
  "success": false,
  "data": null,
  "error": {
    "code": "validation_error",
    "message": "The given data was invalid."
  }
}

Sign in to try this tool directly from the docs.

Code Examples
Request Example
lightbulb Developer Tip

Credits are deducted before execution. If the upstream tool fails, credits are automatically refunded to your account.