The only country data API you’ll ever need.
Countries API provides quick access to accurate information for all countries recognized under ISO 3166. ISO 3166 is the standard published by the International Organization for Standardization (ISO) that defines codes for the names of countries, dependent territories, and special areas of geographical interest. There are currently 249 countries recognized under ISO 3166.
The API provides an extremely detailed data set. Data is continuously monitored for accuracy and updated accordingly.
Detailed
We have the most robust "Country" data set available today. Every country in our set falls within ISO 3166 so you know exactly what you're going to get. The amount of detail available for each country is unmatched anywhere on the web.
Fast
Optimized database and data processing mean you will get your data response extremely fast. No more waiting an unacceptable amount of time for your data response to come back.
Flexibile
We offer an extensive range of endpoints so you can get exactly what you need when you need it. Query string parameters are also available on some endpoints so you can really pinpoint exact data when desired.
Reliable
We have partnered with one of the top cloud providers available for backend services including database and computing power, so you can rest assured that the API is there when you need it.
Documentation
Data
Our extensive data set has everything you need. We provide the most detailed set of country data anywhere on the web. Our set includes:
Field | Description |
---|---|
name | Common, short form country name. |
state_name | Official country name. |
capital | Object containing name, lat/lon, population and notes for each country capital (some countries have more than one capital). |
sovereignty | Identifies whether the country is an independent state or if not, the country which governs it. |
iso_3166 | Object containing ISO 3166 designations. Includes alpha-2, alpha-3, numeric code and subdivision code. |
top_level_domain | Identifies tld indicator as assigned by IANA. |
un_geoscheme | Object containing assigned UN geoscheme groupings. Includes region, subregion, and sub-subregion (if applicable). |
area | Object containing total area, land area and water area in square miles and square kilometers. Water percentage is also included. |
population | Total country population. |
demonyms | A list of names used to describe country inhabitants. |
time_zones | A list of all time zone offsets in which a country lies. Offsets of overseas territories for each country are also included in the list. |
currency | Object containing recognized currencies in each country. Includes currency name, symbol, fractional unit, and ISO 4217 currency code. |
languages | Object containing a list of official languages for each country. |
government | Object containing government structure for each country. Includes system of governance, head of state, and constitutional form. |
gdp | Object containing nominal GDP and nominal per capita GDP. |
elevation | Object containing elevations for each country. Includes minimum, maximum, and span in feet and meters. . Also includes highest and lowest geographic point for each country. |
gini | GINI index for the country. |
hdi | Human Development Index for the country. |
traffic | Traffic indicator for the country. Options are right hand traffic (RHT) or left hand traffic (LHT). |
fearson_diversity | Object containing Fearon diversity index. Includes linguistic, religious, and ethnic fractionalizations. |
anthem | Official country anthem. |
motto | Official country motto. |
Plans and Pricing
Four usage plans are available for Countries API. Review each plan’s features and choose the one that fits you best. If necessary, we can even create a custom plan tailored to your exact needs. All plans are month-to-month and can be cancelled at any time.
Pro
$9.99/month
300 requests/day
$0.025 per additional request
- Basic Country Data
- Email Support
Ultra
$49.99/month
750 requests/day
$0.01 per additional request
- Basic Country Data
- Detailed Country Data
- Name/Capital Search Paths
- Path Parameters
- Sort and Filter Results
- Randomized Results
- Email Support
Mega
$99.99/month
5000 requests/day
$0.001 per additional request
- Basic Country Data
- Detailed Country Data
- Name/Capital Search Paths
- Path Parameters
- Sort and Filter Results
- Randomized Results
- Metadata Endpoint
- Custom Endpoints
- Email Support
Response
Data is returned in a standard JSON format and easily parsed in any programming language. All data is in string format for ease of use and manipulation. A sample response is provided below:
Errors
When a problem occurs, a JSON error is returned. The error will contain a status code and message. Errors are explained below:
Status Code
400
401
404
Message
Invalid Request
Unauthorized
Value Not Found
Information
You have specified an invalid resource or not supplied appropriate path parameters.
You are not authorized to use the specified endpoint.
The path parameter(s) provided could not be found.
Endpoints
The API provides numerous endpoints for ultimate flexibility. Select an endpoint below to understand usage and response. Note that not all endpoints are available on all plans.
An API request to the /basic endpoint returns six fields for every country:
Name, State Name, Capital, ISO 3166, UN Geoscheme, and Population.
Available on all plans.
An API request to the /all endpoint returns all fields for every country.
Query string parameters can be used on this endpoint for additional filtering and sorting capabilities. ‘sort’, ‘limit’, ‘fields’, and ‘randomize’ parameters can be used individually or together.
Example: /all?sort=state_name:desc returns all fields for all countries sorted in descinding order by state name (‘asc’ sorts ascending).
Example: /all?limit=5 returns at most 5 records.
Example: /all?fields=name,state_name,capital returns only name, state name, and capital fields.
Example: /all?randomize=true returns response data in random order. This is a neat feature for quiz or game apps. Get a single, random country name by using: /all?limit=1&fields=name&randomize=true
Available on Ultra and Mega plans.
The /name endpoint allows you to search by country name. Enter a full or partial country name as a path parameter. Name and State Name fields are searched.
Example: /name/bel returns all fields for Belgium, Belarus, and Belize.
All fields are returned.
Available on Ultra and Mega plans.
The /capital endpoint allows you to search by capital name. Enter a full or partial capital name as a path parameter. In cases where countries have multiple capitals, all capitals are searched.
Example: /capital/ku returns all fields for Azerbaijan (Baku), Kuwait (Kuwait City), Malaysia (Kuala Lumpur), and Tonga (Nuku’alofa).
All fields are returned.
Available on Ultra and Mega plans.
The /region endpoint allows you get all countries by UN geoscheme region. The full region name must be specified.
Example: /region/Asia
All fields are returned.
Available on Ultra and Mega plans.
The /subregion endpoint allows you get all countries by UN geoscheme subregion. The full subregion name must be specified.
Example: /subregion/Easter Europe
All fields are returned.
Available on Ultra and Mega plans.
The /subsubregion endpoint allows you get all countries by UN geoscheme sub-subregion. The full sub-subregion name must be specified.
Example: /subsubregion/South America
All fields are returned.
Available on Ultra and Mega plans.
The /alpha2 endpoint allows you retrieve countries by ISO 3166 alpha 2 code. Full alpha 2 code must be provided for the path parameter (partial searches will not work). Multiple alpha 2 codes can be supplied separated by commas.
Example: /alpha2/RW returns Rwanda.
Example: /alpha2/DZ,FM returns Algeria and Micronesia.
All fields are returned.
Available on Ultra and Mega plans.
The /alpha3 endpoint allows you retrieve countries by ISO 3166 alpha 3 code. Full alpha 3 code must be provided for the path parameter (partial searches will not work). Multiple alpha 3 codes can be supplied separated by commas.
Example: /alpha3/SGP returns Singapore.
Example: /alpha3/USA,NZL returns United States and New Zealand.
All fields are returned.
Available on Ultra and Mega plans.
The /numeric endpoint allows you retrieve countries by ISO 3166 numeric code. Full numeric code must be provided for the path parameter (partial searches will not work). Multiple numeric codes can be supplied separated by commas.
Example: /numeric/704 returns Vietnam.
Example: /numeric/188,894 returns Costa Rica and Zambia.
All fields are returned.
Available on Ultra and Mega plans.
The /timezone endpoint allows you retrieve countries by time zone offset. Full time zone offset must be provided for the path parameter (partial searches will not work). Multiple time zone offsets can be supplied separated by commas.
Example: /timezone/UTC+01:00 returns all countries located in the UTC+01:00 time zone offset.
Example: /timezone/UTC-05:00,UTC+04:00 returns all countries located in the UTC-05:00 and UTC+04:00 time zone offsets.
All fields are returned.
Available on Ultra and Mega plans.
The /metadata endpoint allows you to retrieve value lists from the complete data set. This can be very helpful for form building. The query string parameter valueList must be supplied with one of the following values:
- name
- stateName
- region
- subregion
- subsubregion
- alpha2
- alpha3
- numeric
- subdivision
- currencyName
- currencySymbol
- currencyFraction
- currency4217
- language
- timezone
Example: /metadata?valueList=region returns:
Frequently Asked Questions
Countries API is a service that provides country data via a RESTful API. Users are able to get detailed information about all countries recognized under ISO 3166.
We built and maintain the API ourselves. Rest assured, if you need assistance with anything, we are here to help.
We have our own database comprised of data assembled from official country sources around the world. We continually monitor and update the data for accuracy.
Any “country” assigned a code under ISO 3166 is included in our data set. There are currently 249 countries in ISO 3166.
Free plans provided a full data set with limited fields – very useful for developers wishing to try the API features. The free plan is limited to 40 requests per day. The paid plans have increasing detail and features in addition to more API requests per day.
Accessing any endpoint is considered a single request.
The free plan has a hard limit of 40 requests per day. You can not exceed that limit. Paid plans have a “per request” charge once you exceed the daily request limit. See plan details for additional information about overages.
Updates
18 FEB 2022: Added the following elements to the “elevation” object:
- highest_point – Contains the geographic name for the highest point in the country.
- lowest_point – Contains the geographic name for the lowest point in the country.