How to look up an airport and the flight distance between two airports with an API

Two POST routes: /v1/aviation/airport turns an IATA or ICAO code (or a name search) into an airport record, and /v1/aviation/distance returns the great-circle distance and bearings between two airports or points.

When to use it

Use it to turn an IATA, ICAO or ident code into an airport record (name, position, elevation, country, runways, radio frequencies), to search airports by name or city, or to get the great-circle distance between two airports or two coordinates. Typical jobs: validating a code in a form, filling in a booking or logistics screen, or a quick distance for a rough estimate.

Airport lookup

POST {"code": "RPLL"} (ICAO, IATA such as MNL, or ident) to /v1/aviation/airport. To search instead, send query (a name or city), optionally country (ISO 3166-1 alpha-2) and limit (1 to 20, default 5).

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/aviation/airport \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"code": "RPLL"}'
Response (example from the API spec, trimmed)
{
  "count": 1,
  "airports": [{
    "ident": "RPLL", "type": "large_airport",
    "name": "Ninoy Aquino International Airport",
    "icao": "RPLL", "iata": "MNL",
    "lat": 14.5086, "lon": 121.019997, "elevation_ft": 75.0,
    "country": "PH", "municipality": "Manila (Pasay)",
    "runways": [{"ends": ["06", "24"], "length_ft": 12261.0, "surface": "CON", "lighted": true}],
    "frequencies": [{"type": "TWR", "description": "MANILA TWR", "mhz": 118.1}]
  }]
}

A code with no airport is a 404 airport_not_found and is not charged.

Flight distance

POST {"from": "RPLL", "to": "KSFO"} to /v1/aviation/distance. Each end is an airport code or {"lat": ..., "lon": ...}. You get kilometres, nautical miles and statute miles, the initial and final true bearings and the midpoint.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/aviation/distance \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"from": "RPLL", "to": "KSFO"}'
Response (example from the API spec, trimmed)
{
  "from": {"icao": "RPLL", "iata": "MNL", "name": "Ninoy Aquino International Airport"},
  "to":   {"icao": "KSFO", "iata": "SFO", "name": "San Francisco International Airport"},
  "distance_km": 11228.61,
  "distance_nm": 6062.97,
  "distance_mi": 6977.14,
  "initial_bearing_deg": 46.17,
  "final_bearing_deg": 118.15,
  "method": "spherical great circle (haversine), ... within ~0.5 % of the WGS-84 geodesic"
}

The distance is a spherical great-circle figure, within about 0.5 percent of the WGS-84 geodesic. It is not a flown or routed distance. An unknown code is a 422 unknown_airport, not charged.

Paying: the 402 flow

Leave out the X-Tanod-Free header (or use up the free calls) and the same request gets HTTP 402 with the price (USD 0.001) and how to pay in the accepts list. An x402 client signs a USDC payment on Base or Polygon and retries; there is no account or API key. The full flow is in Pay-per-call APIs for AI agents with x402.

curl, no free header: the 402
curl -s -i -X POST https://tanod.dev/v1/aviation/distance \
  -H 'content-type: application/json' \
  -d '{"from": "RPLL", "to": "KSFO"}'

Limits and attribution

Not for navigation. Everything here is informational only and not for flight planning, navigation or any operational use. The data may contain errors and there is no accuracy guarantee.

Airports, runways and frequencies: OurAirports (public domain), answered from a bundled copy with no upstream call. No endorsement by OurAirports is implied.

Price and free allowance

USD 0.001 per call, paid in USDC on Base or Polygon with x402. 5 free skypeek calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared by every skypeek route (METAR, TAF, airports, distance, space weather, aurora, asteroids, sun and moon, satellite passes). MCP tool: lookup_airport and airport_distance at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Related guides: Decode a METAR or TAF report with an API, Reverse geocoding API, Timezone converter API, Pay-per-call APIs for AI agents with x402. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.