Distance Calculator API
Distance between any two places: coordinates, cities ("Paris, FR") or airport codes (MAD, JFK). Ellipsoidal (Vincenty) km, miles and nautical miles, bearing, compass, midpoint, flight time estimate and distance matrices.
Authentication & base URL
Subscribe through one of our marketplace listings; your marketplace API key and base URL are shown there. All endpoints return JSON over HTTPS, served from a global edge network (typically 20–150 ms).
Endpoints
GET /v1/distance
Distance between two places
| Parameter | In | Description | Example |
|---|---|---|---|
from * | query | Coordinates (40.4168,-3.7038), city (Madrid, ES) or airport code (MAD) | MAD |
to * | query | Same formats as from | JFK |
GET /v1/distance/matrix
Distance matrix
| Parameter | In | Description | Example |
|---|---|---|---|
points * | query | 2-10 places separated by | | Paris, FR|London, GB|New York|40.4168,-3.7038 |
unit | query | km (default), mi or nmi | km |
Example
GET /v1/distance?from=MAD&to=JFK
{
"from": {
"type": "airport",
"name": "Adolfo Suárez Madrid–Barajas Airport",
"iata": "MAD",
"icao": "LEMD",
"city": "Madrid",
"country": "ES",
"lat": 40.49341,
"lon": -3.57225
},
"to": {
"type": "airport",
"name": "John F. Kennedy International Airport",
"iata": "JFK",
"icao": "KJFK",
"city": "New York",
"country": "US",
"lat": 40.63945,
"lon": -73.77932
},
"distance": {
"km": 5775.071,
"miles": 3588.463,
"nauticalMiles": 3118.289,
"initialBearing": 294.7,
"compass": "WNW",
"midpoint": {
"lat": 46.299329,
"lon": -38.631845
},
"estimatedFlightTime": "7h 43m"
},
"method": "Vincenty on the WGS-84 ellipsoid (straight line / great-circle, not road distance)",
"attribution": "Places: GeoNames (CC BY 4.0). Airports: OurAirports (public domain)."
}Distance between any two places: coordinates, cities ("Paris, FR") or airport codes (MAD, JFK). Ellipsoidal (Vincenty) km, miles and nautical miles, bearing, compass, midpoint, flight time estimate and distance matrices.
Why this API
- Accepts what your users type: city names with optional country code, IATA/ICAO airport codes or coordinates.
- Survey-grade accuracy: Vincenty's formula on the WGS-84 ellipsoid (not a sphere).
- 170,000+ cities and 9,500 airports built in, no extra geocoding calls.
Use cases
Travel and flight apps, CO2 calculators, logistics quotes, delivery radius checks, dating and social apps, sports and fitness, education.
Straight-line (great-circle) distance, not road distance. Places: GeoNames (CC BY 4.0); airports: OurAirports (public domain).
Pricing
Free plan 500 requests/month, Pro 25,000 for $4.99, Ultra 150,000 for $14.99.
Pricing
Free plan with 500 calls per month, then Pro (25,000 calls for $4.99/month) and Ultra (150,000 calls for $14.99/month). See all plans.