Skip to main content

Overview

The Countries API provides access to country data including names, ISO codes, address formats, and postal code requirements. This information is essential for address validation and international shipping. Model Location: catalog/model/localisation/country.php

Get Country

Retrieve information about a specific country by ID.

Method

Parameters

integer
required
Country ID

Response

integer
Country identifier
string
Country name
string
ISO 3166-1 alpha-2 code (2 letters)
string
ISO 3166-1 alpha-3 code (3 letters)
integer
Address format identifier
string
Address format template
boolean
Whether postcode is required
boolean
Country enabled status

Example Response

Get Country by ISO Code 2

Retrieve country information using 2-letter ISO code.

Method

Parameters

string
required
2-letter ISO country code (e.g., “US”, “GB”, “CA”)

Example

Get Country by ISO Code 3

Retrieve country information using 3-letter ISO code.

Method

Parameters

string
required
3-letter ISO country code (e.g., “USA”, “GBR”, “CAN”)

Example

Get Countries

Retrieve all active countries.

Method

Response

Returns an array of country objects.

Example Response

Address Format

Countries have specific address formats for proper display.

Format Variables

  • {firstname} - First name
  • {lastname} - Last name
  • {company} - Company name
  • {address_1} - Address line 1
  • {address_2} - Address line 2
  • {city} - City
  • {postcode} - Postal/ZIP code
  • {zone} - State/Province/Zone
  • {zone_code} - Zone code
  • {country} - Country name

Example Formats

United States:
United Kingdom:
Japan:

Format Address

Format an address using country-specific template.

Example

Validate Address

Validate address based on country requirements.

Example

Country Dropdown

Build a country selection dropdown.

Example

Example Response

Get Zones for Country

Retrieve states/provinces for a country.

Example

Common Countries

API Usage Example

Use in Address Validation

Only countries with status = 1 (enabled) are returned by the API. Disabled countries are not accessible for customer selection.

Shipping Restrictions

Countries can be restricted for specific shipping methods:

Next Steps

Zones API

Access state/province data

Addresses API

Manage customer addresses

Orders API

Create orders with addresses

Currencies API

Access currency information