Skip to main content

Get a list of Countries

GET https://api.countrystatecity.in/v1/countries

Security

This api use API KEY as an authentication method.

  • Name: X-CSCAPI-KEY
  • In: header

Request Parameters

No parameters

Response

CodeDescription
200Return a list of countries
401Unauthorized.

Example Usage

countries-states-cities.js
var headers = new Headers();
headers.append("X-CSCAPI-KEY", "API_KEY");

var requestOptions = {
method: 'GET',
headers: headers,
redirect: 'follow'
};

fetch("https://api.countrystatecity.in/v1/countries", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Example Success Response

[
{
"id": 101,
"name": "India",
"iso2": "IN",
"iso3": "IND",
"phonecode": "91",
"capital": "New Delhi",
"currency": "INR",
"native": "भारत",
"emoji": "🇮🇳"
},
...
]

Example Error Response

{
"error'": "Unauthorized. You shouldn't be here."
}