Country Codes in International Shipping and Logistics
How ISO country codes are used in international shipping, customs declarations, and logistics systems. Covers Incoterms, HS codes, and carrier APIs.
Detailed Explanation
Country Codes in Logistics
International shipping relies heavily on standardized country codes for routing, customs clearance, and regulatory compliance. Multiple code formats are used across the logistics chain.
Which Code Format Is Used Where
| System | Code Format | Example |
|---|---|---|
| Customs declarations | Alpha-2 or Alpha-3 | GB or GBR |
| UN/LOCODE (port codes) | Alpha-2 prefix | US NYC (New York), DE HAM (Hamburg) |
| Carrier APIs (FedEx, UPS, DHL) | Alpha-2 | US, GB, JP |
| Harmonized System (HS) | Numeric (for origin) | 840 (US origin) |
| Incoterms | Alpha-2 | FOB US, CIF JP |
| Shipping labels | Alpha-2 | Printed on labels as "US", "DE" |
| AES/EEI filing (US exports) | Alpha-2 | Required for all export declarations |
UN/LOCODE
The United Nations Code for Trade and Transport Locations combines the alpha-2 country code with a three-letter location code:
US NYC — New York, United States
DE HAM — Hamburg, Germany
CN SHA — Shanghai, China
SG SIN — Singapore
JP TYO — Tokyo, Japan
NL RTM — Rotterdam, Netherlands
AE DXB — Dubai, UAE
GB LHR — London Heathrow, UK
Customs and Trade Compliance
When filing customs declarations, the country of origin, destination, and transit countries must be specified using ISO codes:
Country of Origin: CN (China)
Country of Export: CN (China)
Country of Destination: US (United States)
Transit Countries: JP (Japan), — (if applicable)
Carrier API Integration
Major carriers use alpha-2 codes in their APIs:
{
"shipment": {
"origin": {
"country_code": "US",
"postal_code": "10001",
"city": "New York"
},
"destination": {
"country_code": "DE",
"postal_code": "10115",
"city": "Berlin"
},
"customs": {
"country_of_origin": "CN",
"harmonized_code": "6110.30",
"declared_value": 150.00,
"currency": "USD"
}
}
}
Restricted and Sanctioned Countries
Shipping systems must check country codes against sanctions lists:
- OFAC (US Treasury) — Comprehensive sanctions list
- EU sanctions — Restrictive measures by country
- UN sanctions — Security Council resolutions
An export compliance check validates the destination country code before allowing shipment processing.
Use Case
An e-commerce platform integrates with FedEx, DHL, and UPS APIs to offer international shipping. The system uses alpha-2 country codes to calculate duties, validate addresses, generate customs forms, and check for trade sanctions before processing each shipment.
Try It — Country Code Reference
Related Topics
ISO 3166-1 Alpha-2 Codes — The Two-Letter Country Standard
Standards
Alpha-3 vs Alpha-2 Country Codes — When to Use Each
Standards
ISO 3166-1 Numeric Country Codes — Language-Independent Identifiers
Standards
Country Codes in Payment Processing and Financial Systems
Industry
ISO 3166-2 Subdivision Codes — States, Provinces, and Regions
Programming