Reliable real-time country data API for your business.

Retrieve instant, accurate information for
any country in the world in lightweight JSON format.

{
    "name": "United States of America",
    "topLevelDomain": [
        ".us"
    ],
    "alpha2Code": "US",
    "alpha3Code": "USA",
    "callingCodes": [
        "1"
    ],
    "capital": "Washington, D.C.",
    "altSpellings": [
        "US",
        "USA",
        "United States of America"
    ],
    "region": "Americas",
    "subregion": "Northern America",
    "population": 323947000,
    "latlng": [
        38,
        -97
    ],
    "demonym": "American",
    "area":  9629091,
    "gini":  48,
    "timezones": [
        "UTC-12:00",
        "UTC-11:00",
        "UTC-10:00",
        "UTC-09:00",
        "UTC-08:00",
        "UTC-07:00",
        "UTC-06:00",
        "UTC-05:00",
        "UTC-04:00",
        "UTC+10:00",
        "UTC+12:00"
    ],
    "borders": [
        "CAN",
        "MEX"
    ],
    "nativeName": "United States",
    "numericCode":  "840",
    "currencies": [
        {
            "code": "USD",
            "name": "United States 
            dollar",
            "symbol": "$"
        }
    ],
    "languages": [
        {
            "iso639_1": "en",
            "iso639_2": "eng",
            "name": "English",
            "nativeName": "English"
        }
    ],
    "translations": {
        "br": "Estados Unidos",
        "de": "Vereinigte Staaten von 
        Amerika",
        "es": "Estados Unidos",
        "fa": "\u0627\u06cc\u0627\u0644
        \u0627\u062a \u0645\u062a\u062d
        \u062f\u0647 \u0622\u0645\u0631
        \u06cc\u06a9\u0627",
        "fr": "\u00c9tats-Unis",
        "hr": "Sjedinjene Ameri\u010dke 
        Dr\u017eave",
        "it": "Stati Uniti D\u0027
        America",
        "ja": "\u30a2\u30e1\u30ea\u30ab
        \u5408\u8846\u56fd",
        "nl": "Verenigde Staten",
        "pt": "Estados Unidos"
    },
    "flag": "https:\/\/api.countrylayer
    .com\/v2\/",
    "regionalBlocs": [
        {
            "acronym": "NAFTA",
            "name": "North American 
            Free Trade Agreement",
            "otherNames": [
                "Tratado de Libre 
                Comercio de Am\u00e9rica 
                del Norte",
                "Accord de Libre-\
                u00e9change Nord-Am\
                u00e9ricain"
            ]
        }
    ],
    "cioc":  "USA"
}

Trusted by thousands of developers worldwide

Gorillaz Tal Tech Wanderlust Much Better Adventures Fx Skross Xero One Finestay

The reliable country data solution

Free

Improves user experience

Customize user experience by identifying accurately users’ country, city, language, and more.

Simple & Easy To Integrate

Reliable

Accurate country database based on official information from each country.

Information

Easy to Integrate

Delivered in portable JSON format for maximum usability, ease of integration, and compatibility with any programming language.

Country List

Extensive Country Information

Provides accurate country data, including geographical position, population, codes, currencies, languages, flag images,phone number format, and much more.

Access to Worldwide Country Data, Developer friendly

Get instant access to accurate country data for various geo-points in the world and enjoy a rich set of capabilities:

  • Accurate Country API
  • Forms Autocomplete
  • Bulk API Endpoint

Code Samples

You can integrate our countrylayer API into any of your applications written in any programming language.
The following code examples show how to use the countrylayer API with some common programming languages:
Search by country name. It can be a native or partial name.

var client = new
RestClient(“https://api.countrylayer.com/v2/all
? access_key = ((YOUR_ACCESS_KEY))”);
client.Timeout = -1
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
var settings = {
“url”: “https://api.countrylayer.com/v2/all
? access_key = ((YOUR_ACCESS_KEY))”,
“method”: “GET”,
“timeout”: 0,
};

$.ajax(settings).done(function (response) {
console.log (response);
});
$curl = curl.init();

curl.setopt_array($curl, array(
CURLOPT_URL=>
‘https://api.countrylayer.com/v2/all
? access_key = ((YOUR_ACCESS_KEY))’,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => ’’,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => ‘GET’,
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Documentation

Let’s send your first email. Grab the code below in your preferred language and paste it into your terminal.

Endpoint for country search by name

This endpoint will return available country data when it is searched by name of the country. If we search using a partial name, for example, “aus” then the API will return all countries that contain “Aus”. If we want to search for a country by the correct full name, then in the query we will have to add the parameter FullText, true or false.

API Request:

GET https://api.countrylayer.com/v2/name/{name}
    ? access_key = API_KEY & FullText=

Request Parameters:

Parameter Description
access_key [Required] Your API Key.
name As part of the URL
FullText A boolean parameter in the URL

The API response and parameters are given above in the /all endpoint example.

Sign Up for our Free Plan to get instant access to country data