Getcountrycodes logo

Getting Started Edit

Welcome to the GetCountryCodes API documentation.

This API document is designed for those interested in using the API.

We hope you enjoy calling the available endpoints.

You’ll succeed if you do this.

Here’s some useful information.

Something may not happen if you try and do this.

Something bad will happen if you do this.

Base URL: https://getcountrycodes.com/api

Authentication Edit

You need to be authenticated for all your API requests. You can generate an API_KEY in your developer dashboard GetCountryCodes.

Your <token> can be created by combining your API_KEY and the letter “X” as such “API_KEY:X” and applying the Base64 function to the resulting string.

Add the resulting <token> to all your API requests using the Authorization Header:
Authorization: Bearer <token>

Without the Authorization Header, your API calls won’t succeed.

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
  )

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
      req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/", nil)
      req.Header.Add("Authorization", "Bearer" + token)

      resp, err := client.Do(req)
      if err != nil {
          log.Fatalln(err)
      }

      body, err := ioutil.ReadAll(resp.Body)
      if err != nil {
          log.Fatalln(err)
      }
      log.Println(string(body))
}

Errors Edit

HTTP Errors

Code Name Description
200 OK Success
400 Bad Request The server could not process that action
403 Forbidden The server could not authenticate you
405 Method Not Allowed The method received is not supported

Application Errors

Code Description
1 Country not found
2 Country detail not found
3 Authorization <token> not provided
4 Authorization <token> invalid

All errors will return JSON in the following format:

{
  "error": true,
  "error_code": 1,
  "message": "Error message here"
}

/countries/ Edit

Get All Countries

This call will return all available Countries

Lists details about all available Countries.

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
[
  {
    "country": "Italy",
    "country_official": "Italian Republic",
    "calling_code": "+39",
    "capital": "Rome",
    "continent": "Europe",
    "continent_iso2": "EU",
    "country_iso2": "IT",
    "country_iso3": "ITA",
    "country_iso3_num": "380",
    "currency_iso3": "EUR",
    "currency_name": "Euro",
    "currency_unit": "Euro",
    "currency_symbol": "€",
    "currency_subunit": "cent",
    "region": "Southern Europe"
  },
  {
    "country": "Côte d’Ivoire",
    "country_official": "Republic of Côte d'Ivoire",
    "calling_code": "+225",
    "capital": "Yamoussoukro",
    "continent": "Africa",
    "continent_iso2": "AF",
    "country_iso2": "CI",
    "country_iso3": "CIV",
    "country_iso3_num": "384",
    "currency_iso3": "XOF",
    "currency_name": "West African CFA franc",
    "currency_unit": "Franc",
    "currency_symbol": "CFA",
    "currency_subunit": "centime",
    "region": "Western Africa"
  }
]
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/ Edit

Get Country Details

Returns details about a specific Country

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "country": "Italy",
  "country_official": "Italian Republic",
  "calling_code": "+39",
  "capital": "Rome",
  "continent": "Europe",
  "continent_iso2": "EU",
  "country_iso2": "IT",
  "country_iso3": "ITA",
  "country_iso3_num": "380",
  "currency_iso3": "EUR",
  "currency_name": "Euro",
  "currency_unit": "Euro",
  "currency_symbol": "€",
  "currency_subunit": "cent",
  "region": "Southern Europe"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/country/ Edit

Get Country

Returns a Country’s name

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/country/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/country/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/country/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/country/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/country/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/country/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "country": "Italy"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/calling_code/ Edit

Get Calling Code

Returns the calling code of a Country

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/calling_code/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/calling_code/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/calling_code/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/calling_code/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/calling_code/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/calling_code/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "calling_code": "+39"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/capital/ Edit

Get Capital

Returns the capital code of a Country

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/capital/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/capital/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/capital/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/capital/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/capital/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/capital/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "capital": "Rome"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/continent/ Edit

Get Continent

Returns the continent where a Country belongs to

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/continent/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/continent/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/continent/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/continent/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/continent/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/continent/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "continent": "Europe"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/continent_iso2/ Edit

Get Continent ISO2

Returns the ISO2 code of the continent where a Country belongs to

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/continent_iso2/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/continent_iso2/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/continent_iso2/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/continent_iso2/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/continent_iso2/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/continent_iso2/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "continent_iso2": "EU"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/country_iso2/ Edit

Get Country ISO2

Returns the ISO2 code of a Country

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/country_iso2/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/country_iso2/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/country_iso2/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/country_iso2/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/country_iso2/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/country_iso2/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "country_iso2": "IT"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/country_iso3/ Edit

Get Country ISO3

Returns the ISO3 code of a Country

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/country_iso3/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/country_iso3/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/country_iso3/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/country_iso3/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/country_iso3/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/country_iso3/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "country_iso3": "ITA"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/currency_iso3/ Edit

Get Currency ISO3

Returns the ISO3 currency code of a Country

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/currency_iso3/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/currency_iso3/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/currency_iso3/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/currency_iso3/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/currency_iso3/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/currency_iso3/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "currency_iso3": "EUR"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/currency_name/ Edit

Get Currency Name

Returns the name of a Country’s currency

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/currency_name/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/currency_name/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/currency_name/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/currency_name/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/currency_name/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/currency_name/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "currency_name": "Euro"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}

/countries/:country/currency_symbol/ Edit

Get Currency Symbol

Returns the Symbol of a Country’s currency

echo -n '<API_KEY>:X' | openssl base64

curl -H "Authorization: Bearer <token>" https://getcountrycodes.com/api/countries/:country/currency_symbol/
const axios = require('axios')

var token = Buffer.from("<API_KEY>" + ":X").toString('base64')
axios.defaults.headers.common['Authorization'] ="Bearer " + token;

axios.get('https://getcountrycodes.com/api/countries/:country/currency_symbol/')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  })
var token = btoa('<API_KEY>:X');

$.ajaxSetup({
  headers:{
    'Authorization': "Bearer " + token
  }
});

$.get("https://getcountrycodes.com/api/countries/:country/currency_symbol/",
function(data) {
  alert(data);
});
import requests
import base64

token = base64.b64encode(b'<API_KEY>:X')

headers = {'Authorization': 'Bearer ' + token}
r = requests.get('https://getcountrycodes.com/api/countries/:country/currency_symbol/', headers=headers)

r.json()
$token = base64_encode('<API_KEY>:X')
$client = new GuzzleHttp\Client(['headers' => ['Authorization' => "Bearer $token"]]);

$response = $client->get('https://getcountrycodes.com/api/countries/:country/currency_symbol/');

$body = $response->getBody();
echo $body;
import (
    "net/http"
    "log"
    "io/ioutil"
    "encoding/base64"
)

func main() {
    var token = base64.NewEncoding("<API_KEY>:X")

    client := &http.Client{}
    req, err := http.NewRequest("GET", "https://getcountrycodes.com/api/countries/:country/currency_symbol/", nil)
    req.Header.Add("Authorization", "Bearer" + token)

    resp, err := client.Do(req)
    if err != nil {
        log.Fatalln(err)
    }

    body, err := ioutil.ReadAll(resp.Body)
    if err != nil {
        log.Fatalln(err)
    }
    log.Println(string(body))
}
{
  "currency_symbol": "€"
}
{
  "error": true,
  "error_code": 1,
  "message": "Country not found"
}