Container, AWB & UN/LOCODE API
Check ISO 6346 container numbers and size-type codes, air waybill (AWB) check digits and airline prefixes, and search UN/LOCODE ports and airports.
One endpoint for the codes of freight paperwork. container checks an ISO 6346 container number (CSQU3054383): owner code, equipment category (U freight container, J detachable equipment, Z trailer / chassis), serial number and the check digit, or computes the check digit when you give 10 characters. size_type decodes an ISO 6346 size and type code (22G1, 45G1, 22R1): length, height and width, type group and detailed type.
awb checks an air waybill number (738-1234 5675): 3-digit airline prefix, serial and the mod-7 check digit, with the carrier name for about 50 major airlines (the full IATA directory is a paid product, so unknown prefixes are reported as such). locode returns a UN/LOCODE entry (VNSGN, VNHPH, VNCLI): name with and without diacritics, country, subdivision, functions (port, rail, road, airport, inland depot, border crossing…), status, IATA code and coordinates. q searches names without accents; without country it searches the ports, airports, inland depots and border crossings of every country, with country every location of that country. code detects the kind of code by itself.
UN/LOCODE data: the official UNECE / UN/CEFACT release (CC BY 4.0, attribution in each response), checked weekly for a new release. Container owner codes are not looked up (the BIC register is paid) and no tracking status is given.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
code | query|body | string | no | Any code, its kind is detected: container number, AWB, UN/LOCODE or size-type. Also in the path: /v1/freight-codes/CSQU3054383. | |
container | query|body | string | no | ISO 6346 container number (11 characters, or 10 to compute the check digit). | |
size_type | query|body | string | no | ISO 6346 size and type code, e.g. 22G1, 45G1, 42R1. | |
awb | query|body | string | no | Air waybill number, 11 digits (738-1234 5675). | |
locode | query|body | string | no | UN/LOCODE, 5 characters (VNSGN). | |
q | query|body | string | no | Search UN/LOCODE by name (accents optional) or IATA code. | |
country | query|body | string | no | With q: ISO country code to search all locations of one country. | |
function | query|body | string | no | With q: port, rail, road, airport, postal, icd, fixed, inland-port or border. | |
limit | query|body | number | no | 20 | With q: results returned (1-100). |
Example
curl "https://apibox.io.vn/v1/freight-codes?locode=VNHPH" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/freight-codes?locode=VNHPH', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/freight-codes?locode=VNHPH",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/freight-codes?locode=VNHPH');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"locode": {
"code": "VNHPH",
"formatted": "VN HPH",
"name": "Haiphong",
"name_ascii": "Haiphong",
"country": "VN",
"country_name": "VIET NAM",
"subdivision": "HP",
"subdivision_name": "Hải Phòng",
"functions": [
"port",
"rail terminal",
"road terminal",
"airport"
],
"function_code": "1234----",
"status": "AI",
"status_name": "code adopted by international organisation (IATA or ECLAC)",
"iata": null,
"coordinates": {
"lat": 20.85,
"lng": 106.6833
},
"date": "2024-07"
},
"data_version": "UN/LOCODE 2025-1",
"source": "UN/LOCODE, UNECE / UN/CEFACT",
"licence": "CC BY 4.0",
"attribution": "UN/LOCODE © United Nations Economic Commission for Europe (UNECE), CC BY 4.0"
}
Use cases
- Validate container numbers typed in customs declarations, bookings and gate-in forms
- Decode container size-type codes on EDI messages and packing lists
- Check air waybill numbers before tracking or declaring a shipment
- Look up or autocomplete ports and airports (UN/LOCODE) in logistics software
FAQ
How is the container check digit computed?
ISO 6346: letters get values 10-38 (skipping multiples of 11), each of the first 10 characters is multiplied by 2^position, the sum mod 11 (10 counts as 0) is the check digit.
Which UN/LOCODE release is used?
The latest official release published by UNECE (data_version in the response, e.g. 2025-1); the data is checked weekly for a new release.
Can it track a container or flight?
No. It validates and decodes codes only; tracking needs the carrier or terminal systems.
Related APIs
JSON Validator
Check JSON syntax with exact line and column of errors, and validate data against a JSON Schema (draft 4, 7, 2019-09 or 2020-12).
{ }JSON Formatter
Pretty print JSON with 0-8 spaces or tabs, minify it, or sort object keys recursively. Syntax errors are reported with line and column.
CSVCSV to JSON
Convert CSV into an array of JSON objects using the header row, with delimiter auto-detection, number and boolean typing, and row-level errors.