An Overview of the REST Countries API

Get introduced to the REST Countries API, and learn about its uses.

In today’s world, where businesses are expanding globally, information is critical. A country’s information is beneficial not only for companies but also for tourists. Developers can empower their clients by creating applications and websites that provide their target audience with the information they require. This goal can be accomplished with the help of the REST Countries API.

What is the REST Countries API?

The REST Countries API is a basic REST API that delivers information about the countries in JSON format. Each country’s data offers essential information, such as the capital city, population, languages, currencies, regions, and country code.

Press + to interact

Uses of the REST Countries API

Using the REST Countries API, we can:

  • Develop registration or sign-up forms, and display currencies for hotel booking websites and payment applications.
  • Create an application for shipping companies, which need a lot of information about countries they ship to.
  • Create a database of countries’ information that is searchable anytime.
Press + to interact
REST Countries API endpoints
REST Countries API endpoints

Response of the REST Countries API

When we call an endpoint of the REST Countries API, it returns a JSON response with information about a country. Some endpoints return information about a single country, while others return a list of information about multiple countries.

The following table shows the information we can get about a country.

Response Fields

Field

Type

Description

name

Object

The name of the country

tld

String

The top level domain of the country

cca2

String

The two-letter country code that the International Organization for Standardization (ISO) assigned to identify the country

ccn3

Integer

The three-digit country code that the International Organization for Standardization (ISO) assigned to identify the country

cca3

String

The three-letter country code that the International Organization for Standardization (ISO) assigned to identify the country

cioc

String

The three-letter country code that the International Olympic Committee (IOC) assigned to identify the country

independent

Boolean

Indicates whether or not the country is independent

status

String

The assignment status of the country

unMember

Boolean

Indicates whether or not the country is a member of the United Nations

currencies

Object

The information about the currency of the country

idd

Object

Contains information about international direct dialing for the country

capital

String

The capital city of the country

altSpellings

String

The alternative spellings of the country's name

region

String

The region in which the country is situated

subregion

String

The subregion in which the country is situated

languages

Object

A list of official languages of the country

translations

Object

A list of the country's name written in different languages

latlng

Float

The latitude and longitude of the country

landlocked

Boolean

Indicates whether or not the country has a coastline or direct access to a major body of water, such as an ocean or sea

borders

String

A list of countries that are connected to the country through borders

area

Float

The area of the country in square kilometers

demonyms

String

The origin of the people of the country

flag

String

Unicode string for the emoji of the flag of the country

maps

String

Contains links to the country's OpenStreetMap and Google Maps

population

Integer

The population of the country

gini

Object

The gini ratio of the country, which is a measure of economic inequality in a country

fifa

String

The FIFA code for the country

car

Object

Contains information about the traffic signs and the drive side for the country

timezones

String

The time zone of the country

continents

String

The continent in which the country is situated

flags

Object

A link to an image of the country’s flag

coatOfArms

Object

A link to an image of the country’s coat of arms

startOfWeek

String

The day when the week starts in the country

capitalInfo

Object

The latitude and longitude of the capital city of the country

postalCode

Object

The format of the postal code of the country