Country Code
This API provides the Country code and region details.
GET
{{Base_url}}/rest/V1/directory/countries
This Magento REST API endpoint retrieves country and region details available in the store. It provides country codes, names, and a list of states/regions within each country.
curl --location '{{Base_url}}/rest/V1/directory/countries' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjU1LCJ1dHlwaWQiOjIsImlhdCI6MTczNzM2Njg2MiwiZXhwIjoxNzM3MzcwNDYyfQ.d2U_7NYN8lwP8cIG0wtFV5Acxw7RI-A9BUrPjLaac3w' \
--header 'Cookie: PHPSESSID=0k4u1vfr2u6bkue7tvt3h7v75n; private_content_version=5ab80b7def0c212f723edead3c971a19'
Response
[
{
"id": "IN",
"two_letter_abbreviation": "IN",
"three_letter_abbreviation": "IND",
"full_name_locale": "India",
"full_name_english": "India",
"available_regions": [
{
"id": "533",
"code": "AN",
"name": "Andaman and Nicobar Islands"
},
{
"id": "534",
"code": "AP",
"name": "Andhra Pradesh"
},
{
"id": "535",
"code": "AR",
"name": "Arunachal Pradesh"
},
{
"id": "536",
"code": "AS",
"name": "Assam"
},
{
"id": "537",
"code": "BR",
"name": "Bihar"
},
{
"id": "538",
"code": "CH",
"name": "Chandigarh"
},
{
"id": "539",
"code": "CT",
"name": "Chhattisgarh"
},
{
"id": "540",
"code": "DN",
"name": "Dadra and Nagar Haveli"
},
{
"id": "541",
"code": "DD",
"name": "Daman and Diu"
},
{
"id": "542",
"code": "DL",
"name": "Delhi"
},
{
"id": "543",
"code": "GA",
"name": "Goa"
},
{
"id": "544",
"code": "GJ",
"name": "Gujarat"
},
{
"id": "545",
"code": "HR",
"name": "Haryana"
},
{
"id": "546",
"code": "HP",
"name": "Himachal Pradesh"
},
{
"id": "547",
"code": "JK",
"name": "Jammu and Kashmir"
},
{
"id": "548",
"code": "JH",
"name": "Jharkhand"
},
{
"id": "549",
"code": "KA",
"name": "Karnataka"
},
{
"id": "550",
"code": "KL",
"name": "Kerala"
},
{
"id": "1156",
"code": "LA",
"name": "Ladakh"
},
{
"id": "551",
"code": "LD",
"name": "Lakshadweep"
},
{
"id": "552",
"code": "MP",
"name": "Madhya Pradesh"
},
{
"id": "553",
"code": "MH",
"name": "Maharashtra"
},
{
"id": "554",
"code": "MN",
"name": "Manipur"
},
{
"id": "555",
"code": "ML",
"name": "Meghalaya"
},
{
"id": "556",
"code": "MZ",
"name": "Mizoram"
},
{
"id": "557",
"code": "NL",
"name": "Nagaland"
},
{
"id": "558",
"code": "OR",
"name": "Odisha"
},
{
"id": "559",
"code": "PY",
"name": "Puducherry"
},
{
"id": "560",
"code": "PB",
"name": "Punjab"
},
{
"id": "561",
"code": "RJ",
"name": "Rajasthan"
},
{
"id": "562",
"code": "SK",
"name": "Sikkim"
},
{
"id": "563",
"code": "TN",
"name": "Tamil Nadu"
},
{
"id": "564",
"code": "TG",
"name": "Telangana"
},
{
"id": "565",
"code": "TR",
"name": "Tripura"
},
{
"id": "566",
"code": "UP",
"name": "Uttar Pradesh"
},
{
"id": "567",
"code": "UT",
"name": "Uttarakhand"
},
{
"id": "568",
"code": "WB",
"name": "West Bengal"
}
]
}
]
Explanation of Each Attribute
Country-Level Attributes
id
Value:
"IN"
Explanation: Represents the ISO 2-letter country code for India.
two_letter_abbreviation
Value:
"IN"
Explanation: The official 2-letter country abbreviation (same as
id
in most cases).
three_letter_abbreviation
Value:
"IND"
Explanation: The official 3-letter country abbreviation for India (as per ISO 3166-1).
full_name_locale
Value:
"India"
Explanation: The country name as displayed in the store’s locale-specific language (e.g., localized for different languages).
full_name_english
Value:
"India"
Explanation: The English name of the country.
Region-Level Attributes (Inside available_regions
)
available_regions
)Each object inside "available_regions"
represents a state/region within the country.
id
Example Value:
"533"
Explanation: The unique region ID in the Magento system for each state or union territory.
code
Example Value:
"AP"
Explanation: The short region code (state abbreviation), commonly used in shipping/billing addresses.
name
Example Value:
"Andhra Pradesh"
Explanation: The full name of the state/region as recognized in Magento.
How This API is Used
Populate Country & State Dropdowns
Used in frontend checkout and address forms to dynamically list available countries and their states.
Set Country/Region Restrictions
Helps store owners define allowed shipping/billing regions for orders.
Validate Addresses
Ensures customers select a valid country/region during checkout.
Last updated