Countries Database and Codes API
NOTE: This endpoint provides detailed geographic, demographic, and standardized code data for countries worldwide. View all available API endpoints.
Don't have an API key for countries GEO data API but want a try?
Get StartedAPI Endpoint Description
This endpoint retrieves specific country details or dumps the entire countries database with output in JSON, XML or CSV file
Endpoint Address
GET https://content.airhex.com/api/v3.3/countries
Example Request
https://content.airhex.com/api/v3.3/countries?apikey=WcPi7fGFMTihmwdNxkn4XYwZtdhKuykg&code2=US
*Note: At least one query parameter (code2, code3, iso, name, or dump) is required.
Request ParametersParameter | Required | Value | Type | Default | Description |
---|---|---|---|---|---|
apikey | Required | Any | String | none | Your assigned API key. Request a key if needed |
code2 | Conditional | AA-ZZ | String | none | Two-letter ISO 3166-1 Alpha-2 country code |
code3 | Conditional | AAA-ZZZ | String | none | Three-letter ISO 3166-1 Alpha-3 country code |
iso | Conditional | Any | Int | none | Numeric ISO 3166-1 country code |
name | Conditional | Any | String | none | Country name or partial substring for matching |
dump | Conditional | 0 or 1 | Integer | 0 | Set to 1 to export the complete database (ignores other parameters) |
response_type | Optional | JSON or XML or CSV | String | JSON | Response format: JSON, XML, or CSV (CSV initiates file download) |
Response Fields
Field | Example | Description |
---|---|---|
iso | 840 | ISO 3166-1 numeric country code |
code2 | US | ISO 3166-1 Alpha-2 two-letter country code |
code3 | USA | ISO 3166-1 Alpha-3 three-letter country code |
name | United States | Country name |
capital_code | WAS | Three-letter IATA code for the country's capital city |
currency_code | USD | Three-letter ISO currency code |
region | North America | Geographical region of the country |
continent_code | NA | Two-letter continent code |
population | 310232863 | Country’s population count |
phone_code | +1 | International country dialing code |
Example Response (JSON)
[
{
"iso": "840",
"code2": "US",
"code3": "USA",
"name": "United States",
"capital_code": "WAS",
"currency_code": "USD",
"region": "North America",
"continent_code": "NA",
"population": "310232863",
"phone_code": "+1"
}
]
Example Response (XML)
<?xml version="1.0" encoding="UTF-8"?>
<countries>
<country>
<iso>840</iso>
<code2>US</code2>
<code3>USA</code3>
<name>United States</name>
<capital_code>WAS</capital_code>
<currency_code>USD</currency_code>
<region>North America</region>
<continent_code>NA</continent_code>
<population>310232863</population>
<phone_code>+1</phone_code>
</country>
</countries>