UN/LOCODE Lookup
unlocode_lookupSearch 116,232 UN/LOCODE transport locations worldwide — ports, airports, rail and road terminals, inland container depots and border crossings. Codes are 5 characters: a 2-letter ISO country code + a 3-character location code (GBLHR = London Heathrow, NLRTM = Rotterdam).
Provide code for an exact record, or query (name search, min 2 chars) optionally narrowed by country and function_type; limit caps results (default 20, max 100).
Behavior: read-only; exact code hits are provenance-based while fuzzy name hits report match quality via the envelope's confidence (basis match_quality); an unknown code errors with a not-found message. Rate-limited (anonymous use: 25 requests/day per IP): a 429 error body carries retry_after_seconds and a Retry-After header — back off and retry, or call get_subscribe_link for higher limits.
Returns: the location record(s) — code, name and name_ascii, country, subdivision, functions[], status, coordinates {lat, lon} and iata_code where assigned — under result, plus confidence, _source and citation (the FreightUtils v1 response envelope).
Limitations: an administrative code list (UNECE UN/LOCODE 2025-1) — confirm operational status and coordinates with the port or authority before critical use.
Related: airport_lookup (airport-specific records including ICAO codes), nearest_airport (find airports by coordinates).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Exact UN/LOCODE lookup (e.g. "GBLHR", "NLRTM") | |
| limit | No | Max results (default 20) | |
| query | No | Search by name or code (e.g. "Rotterdam", "GBLHR", "LHR") | |
| country | No | ISO 2-letter country code filter (e.g. "GB", "NL") | |
| function_type | No | Filter by location function |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| result | Yes | ||
| _source | Yes | ||
| citation | Yes | ||
| validity | No | ||
| warnings | No | ||
| confidence | Yes | ||
| blocking_errors | No | ||
| envelope_version | Yes | ||
| normalized_input | No |