Countries GEO data, codes and extras API
NOTE: This is the endpoint to fetch countries. Full list of endpoints available here: https://airhex.com/api/
Don't have an API key for countries GEO data API but want a try?
Get StartedEndpoint description
This endpoint retrieves specific country details or dumps the entire countries database with output in JSON, XML or CSV file
HTTP Request
GET https://content.airhex.com/api/v3.3/countries
Request Example
https://content.airhex.com/api/v3.3/countries?apikey=WcPi7fGFMTihmwdNxkn4XYwZtdhKuykg&code2=US
*Note: At least one of these parameters is required: code2/code3/iso/name/dump
Request ParametersParameter | Required | Value | Type | Default | Description |
---|---|---|---|---|---|
apikey | Required | Any | String | none | API key received from us. Contact us if you don't have one yet. |
code2 | Required* (at least one parameter with asterisk required) | AA-ZZ | String | none | ISO 3166-1 Alpha-2, 2 char code of a country |
code3 | Required* (at least one parameter with asterisk required) | AAA-ZZZ | String | none | ISO 3166-1 Alpha-3, 3 char code of a country |
iso | Required* (at least one parameter with asterisk required) | Any | Int | none | ISO 3166-1 numeric code of a country |
name | Required* (at least one parameter with asterisk required) | Any | String | none | Name of a specific country or multiple countries. Search will be performed for countries contains name provided with this parameter. |
dump | Required* (at least one parameter with asterisk required) | 0 or 1 | Integer | 0 | Set as "1" to get all entries from the database. Other required parameters will be ignored |
response_type | Optional | JSON or XML or CSV | String | JSON | Types of responses: JSON, XML or CSV (CSV downloads as a file) |
Response Fields
Field | Example | Description |
---|---|---|
iso | 840 | ISO 3166-1 numeric code of a country |
code2 | US | ISO 3166-1 Alpha-2, 2 char code of a country |
code3 | USA | ISO 3166-1 Alpha-3, 3 char code of a country |
name | United States | Country name |
capital_code | WAS | 3 char code of the country capital (matched with IATA code) |
currency_code | USD | 3 char official currency code |
region | North America | Region of the country |
continent_code | NA | 2 char code of the continent |
population | 310232863 | Country population |
phone_code | +1 | Country phone code |
Response Example (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"
}
]
Response Example (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>