curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=iso2&to=iso3&value=US' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=iso3&to=numeric&value=IND' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=numeric&to=iso2&value=840' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
const params = new URLSearchParams({ from: 'iso2', to: 'iso3', value: 'DE' });
const response = await fetch(
`https://api.countrystatecity.in/v1/iso/country/convert?${params}`,
{ headers: { 'X-CSCAPI-KEY': 'YOUR_API_KEY' } }
);
const { result } = await response.json();
console.log(result); // "DEU"
import requests
response = requests.get(
'https://api.countrystatecity.in/v1/iso/country/convert',
params={'from': 'iso2', 'to': 'numeric', 'value': 'JP'},
headers={'X-CSCAPI-KEY': 'YOUR_API_KEY'}
)
print(response.json()['result']) # "392"
{
"from": "iso2",
"to": "iso3",
"input": "US",
"result": "USA"
}
{
"from": "iso3",
"to": "numeric",
"input": "IND",
"result": "356"
}
{
"status": "error",
"message": "Invalid query parameters: from and to must be different"
}
{
"status": "error",
"message": "Invalid query parameters: value does not match the format required by from"
}
{
"status": "error",
"message": "Invalid query parameters: from: must be one of: iso2, iso3, numeric"
}
{
"status": "error",
"message": "This feature is not available on your current plan.",
"details": {
"feature": "isoLookup",
"currentTier": "community",
"requiredTier": "starter",
"upgradeUrl": "https://app.countrystatecity.in/pricing"
}
}
{
"status": "error",
"message": "Country not found for the given code"
}
{
"status": "error",
"message": "No iso3 code available for this country"
}
ISO Codes
Convert ISO Code
Translate a country code between ISO 3166-1 alpha-2, alpha-3, and numeric formats
GET
/
iso
/
country
/
convert
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=iso2&to=iso3&value=US' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=iso3&to=numeric&value=IND' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=numeric&to=iso2&value=840' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
const params = new URLSearchParams({ from: 'iso2', to: 'iso3', value: 'DE' });
const response = await fetch(
`https://api.countrystatecity.in/v1/iso/country/convert?${params}`,
{ headers: { 'X-CSCAPI-KEY': 'YOUR_API_KEY' } }
);
const { result } = await response.json();
console.log(result); // "DEU"
import requests
response = requests.get(
'https://api.countrystatecity.in/v1/iso/country/convert',
params={'from': 'iso2', 'to': 'numeric', 'value': 'JP'},
headers={'X-CSCAPI-KEY': 'YOUR_API_KEY'}
)
print(response.json()['result']) # "392"
{
"from": "iso2",
"to": "iso3",
"input": "US",
"result": "USA"
}
{
"from": "iso3",
"to": "numeric",
"input": "IND",
"result": "356"
}
{
"status": "error",
"message": "Invalid query parameters: from and to must be different"
}
{
"status": "error",
"message": "Invalid query parameters: value does not match the format required by from"
}
{
"status": "error",
"message": "Invalid query parameters: from: must be one of: iso2, iso3, numeric"
}
{
"status": "error",
"message": "This feature is not available on your current plan.",
"details": {
"feature": "isoLookup",
"currentTier": "community",
"requiredTier": "starter",
"upgradeUrl": "https://app.countrystatecity.in/pricing"
}
}
{
"status": "error",
"message": "Country not found for the given code"
}
{
"status": "error",
"message": "No iso3 code available for this country"
}
Convert a country code between the three ISO 3166-1 formats in a single call:
- alpha-2 ↔ alpha-3 (e.g.
US↔USA) - alpha-2 ↔ numeric (e.g.
US↔840) - alpha-3 ↔ numeric (e.g.
USA↔840)
Availability: Starter plan and above. Returns
403 on Community plan.Cache reuse: Conversions share the same cache slot as
/v1/iso/country. A previous ?iso2=US lookup serves any ?from=iso2&value=US&to=... conversion without a fresh database hit. The target column is extracted after the cache read, so different to values reuse the same slot.Numeric inputs 4 and 004 resolve to the same cache slot.curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=iso2&to=iso3&value=US' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=iso3&to=numeric&value=IND' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
curl -X GET 'https://api.countrystatecity.in/v1/iso/country/convert?from=numeric&to=iso2&value=840' \
-H 'X-CSCAPI-KEY: YOUR_API_KEY'
const params = new URLSearchParams({ from: 'iso2', to: 'iso3', value: 'DE' });
const response = await fetch(
`https://api.countrystatecity.in/v1/iso/country/convert?${params}`,
{ headers: { 'X-CSCAPI-KEY': 'YOUR_API_KEY' } }
);
const { result } = await response.json();
console.log(result); // "DEU"
import requests
response = requests.get(
'https://api.countrystatecity.in/v1/iso/country/convert',
params={'from': 'iso2', 'to': 'numeric', 'value': 'JP'},
headers={'X-CSCAPI-KEY': 'YOUR_API_KEY'}
)
print(response.json()['result']) # "392"
{
"from": "iso2",
"to": "iso3",
"input": "US",
"result": "USA"
}
{
"from": "iso3",
"to": "numeric",
"input": "IND",
"result": "356"
}
{
"status": "error",
"message": "Invalid query parameters: from and to must be different"
}
{
"status": "error",
"message": "Invalid query parameters: value does not match the format required by from"
}
{
"status": "error",
"message": "Invalid query parameters: from: must be one of: iso2, iso3, numeric"
}
{
"status": "error",
"message": "This feature is not available on your current plan.",
"details": {
"feature": "isoLookup",
"currentTier": "community",
"requiredTier": "starter",
"upgradeUrl": "https://app.countrystatecity.in/pricing"
}
}
{
"status": "error",
"message": "Country not found for the given code"
}
{
"status": "error",
"message": "No iso3 code available for this country"
}
Related Endpoints
- Lookup Country by ISO Code — return the full country record instead of just the converted code
- Lookup State by ISO Code — ISO 3166-2 subdivision lookup
Authorizations
API key for authentication. Get your free key at app.countrystatecity.in.
Query Parameters
Source format
Available options:
iso2, iso3, numeric Example:
"iso2"
Target format (must differ from from)
Available options:
iso2, iso3, numeric Example:
"iso3"
The code to convert (e.g., US when from=iso2)
Example:
"US"
Response
Converted ISO code
Result of an ISO 3166-1 code conversion.
Source format
Available options:
iso2, iso3, numeric Example:
"iso2"
Target format
Available options:
iso2, iso3, numeric Example:
"iso3"
The input code, echoed back from the value query parameter
Example:
"US"
The converted code. Numeric results are zero-padded to 3 digits.
Example:
"USA"