unlocode_lookup
Look up UN/LOCODE transport locations by exact code or name query, filtered by country and function, and retrieve comprehensive location details.
Instructions
Search 116,129 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 2024-2) — 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 — 5 characters. Examples: "GBLHR", "NLRTM". | |
| limit | No | Maximum results. Default: 20, max: 100. | |
| query | No | Location name search (min 2 chars). Examples: "rotterdam", "heathrow". | |
| country | No | Filter by 2-letter ISO country code. Examples: "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 |