API Access
Access dataset files directly from scripts, code, or AI agents.
Browse dataset files
API Access
Access dataset files directly from scripts, code, or AI agents.
Each file has a stable URL (r-link) that you can use directly in scripts, apps, or AI agents. These URLs are permanent and safe to hardcode.
Start with these files — they give you everything you need to understand and access the dataset.
- 1. Fetch datapackage.json to inspect schema and resources
- 2. Download data resources listed in datapackage.json
- 3. Read README.md for full context
Data Files
Explore with AIcode-list
| Field | Type | Description | Pattern |
|---|---|---|---|
| Change | string | + (newly added); X (to be removed); | (changed); # (name changed); = (reference entry); ! (US location with duplicate IATA code) | |
| Country | string | ISO 3166 alpha-2 country code. Defined in country-codes.csv. | [A-Z]{2} |
| Location | string | 3-character location code (letters and digits 2–9). Combined with Country it forms the full 5-character UN/LOCODE. | [A-Z2-9]{3} |
| Name | string | Official name of the location, may include diacritics. | |
| NameWoDiacritics | string | Name of the location with diacritics replaced by their ASCII equivalents. | |
| Subdivision | string | ISO 3166-2 subdivision code for the location. Defined in subdivision-codes.csv. May be empty. | |
| Status | string | Approval/verification status of the entry. Defined in status-indicators.csv. | |
| Function | string | 8-character function classifier string indicating which transport functions the location serves. Each position corresponds to a function code defined in function-classifiers.csv; a digit means the function is present, a dash means absent. | [01-][2-][3-][4-][5-][6-][7-][B-] |
| Date | string | Edition date in YYMM format (2-digit year + 2-digit month, e.g. 0601 = June 2006, 1407 = July 2014). May be empty for some entries. | [0-9]{4} |
| IATA | string | IATA airport code, present only when it differs from the UN/LOCODE location code. May be empty. | |
| Coordinates | string | Geographic coordinates in DDMM[N/S] DDDMM[W/E] format (degrees and minutes). May be empty. | [0-9]{4}[NS] [0-9]{5}[WE] |
| Remarks | string | Free-text remarks or notes about the location entry. May be empty. |
Download
Download CSVAbout
- Main UN/LOCODE codelist. Each row is a location entry identified by a 2-letter country code and a 3-character location code. Rows with an empty Location field are country-name header rows or alias rows and are excluded from this file.
- Last updated
- 12 May 2026
- Total rows
- ...
- Format
- CSV
- File size
- 7.29 MB
country-codes
| Field | Type | Description |
|---|---|---|
| CountryCode | string | ISO 3166 alpha-2 country code (2 uppercase letters). |
| CountryName | string | Official English name of the country. |
Download
Download CSVAbout
- Lookup table mapping ISO 3166 alpha-2 country codes to country names, as used in the UN/LOCODE codelist.
- Last updated
- 12 May 2026
- Total rows
- ...
- Format
- CSV
- File size
- 3.94 kB
function-classifiers
| Field | Type | Description |
|---|---|---|
| FunctionCode | string | Single-character function code (0–8 or B) used in the Function field of code-list.csv. |
| FunctionDescription | string | Human-readable description of the transport or logistics function. |
Download
Download CSVAbout
- Lookup table defining the meaning of each position in the Function field of the code-list. Each code corresponds to a transport or logistics function.
- Last updated
- 12 May 2026
- Total rows
- ...
- Format
- CSV
- File size
- 562 B
status-indicators
| Field | Type | Description |
|---|---|---|
| STStatus | string | 2-letter status code used in the Status field of code-list.csv. |
| STDescription | string | Human-readable description of the approval or verification status. |
Download
Download CSVAbout
- Lookup table defining the meaning of the Status field in the code-list. Status codes indicate the approval or verification level of each location entry.
- Last updated
- 12 May 2026
- Total rows
- ...
- Format
- CSV
- File size
- 794 B
subdivision-codes
| Field | Type | Description |
|---|---|---|
| SUCountry | string | ISO 3166 alpha-2 country code for the subdivision. |
| SUCode | string | ISO 3166-2 subdivision code (without the country prefix). |
| SUName | string | Name of the subdivision (state, province, region, etc.). |
| SUType | string | Type of the administrative subdivision (e.g. Province, State, Region, Emirate). May be empty for some entries. |
Download
Download CSVAbout
- Lookup table of ISO 3166-2 subdivision codes (states, provinces, regions, etc.) referenced by the Subdivision field of the code-list.
- Last updated
- 12 May 2026
- Total rows
- ...
- Format
- CSV
- File size
- 133 kB
alias
| Field | Type | Description |
|---|---|---|
| Country | string | ISO 3166 alpha-2 country code the alias applies to. |
| Name | string | Alternative country or region name, may include diacritics. |
| NameWoDiacritics | string | Alternative name with diacritics replaced by ASCII equivalents. |
Download
Download CSVAbout
- Alternative names (aliases) for countries, extracted from UN/LOCODE source files. These are rows in the source data with Change code '=' and no location code.
- Last updated
- 12 May 2026
- Total rows
- ...
- Format
- CSV
- File size
- 2.73 kB
About this dataset
The United Nations Code for Trade and Transport Locations is a code list maintained by UNECE, United Nations agency, to facilitate trade.
Data
Data comes from the UNECE UN/LOCODE Download page, released at least once a year.
Updating the data
When UNECE publishes a new edition, update the data by running the pipeline locally and committing the result.
Install the required tools (macOS):
brew install mdbtools csvkit gawk
pip install -r scripts/requirements.txt
Download the latest edition from https://unece.org/trade/cefact/UNLOCODE-Download — click the Download link on the new release row. Extract the zip into a release/ folder in the repo root so it has this structure:
release/
UNLOCODE CodeList.mdb
csv/
SubdivisionCodes.csv
UNLOCODE CodeListPart1.csv
UNLOCODE CodeListPart2.csv
UNLOCODE CodeListPart3.csv
Note: the scripts assume this folder structure and file naming. If UNECE changes the release packaging in a future edition, the scripts may need to be adjusted before running.
Then run:
make
Then commit the updated files:
git add data/
git commit -m "Update to edition YYYY-N"
git push
License
All data is licensed under the ODC Public Domain Dedication and Licence (PDDL).