> For the complete documentation index, see [llms.txt](https://raphaelugwu.gitbook.io/airtime/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raphaelugwu.gitbook.io/airtime/countries/get-country-by-iso-code.md).

# Get country by ISO Code

With the `/countries/{countrycode}` endpoint, you can retrieve the details of a country by making a request with its ISO code

## Country by ISO code

<mark style="color:blue;">`GET`</mark> `https://topups.reloadly.com/countries/{countrycode}`

#### Path Parameters

| Name                                          | Type   | Description            |
| --------------------------------------------- | ------ | ---------------------- |
| countryCode<mark style="color:red;">\*</mark> | string | The country's ISO Code |

#### Headers

| Name                                            | Type   | Description                                                             |
| ----------------------------------------------- | ------ | ----------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Your access token is required as a bearer token in the request's header |

{% tabs %}
{% tab title="200 This response is gotten when a successful request is made and the details of a country are retrieved" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
  "isoName":"US",
  "name":"United States",
  "currencyCode":"USD",
  "currencyName":"US Dollar",
  "currencySymbol":"$",
  "flag":"https://s3.amazonaws.com/rld-flags/us.svg",
  "callingCodes":[
    "+1"
  ]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="401 This response is gotten when an incorrect or expired access token is used to make a request" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
  "timeStamp":"2021-05-12 07:17:42",
  "message":"Full authentication is required to access this resource",
  "path":"/countries/US",
  "errorCode":"INVALID_TOKEN",
  "infoLink":null,
  "details":[
    
  ]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}

{% tab title="404 This response is gotten when a request is made to an incorrect URL path" %}
{% tabs %}
{% tab title="JSON" %}

```bash
{
  "timeStamp":"2021-05-12 07:15:00",
  "message":"Country not found and/or not currently supported",
  "path":"/countries/PKGG",
  "errorCode":"COUNTRY_NOT_SUPPORTED",
  "infoLink":null,
  "details":[
    
  ]
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

###

### Request samples

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://topups.reloadly.com/countries/PK' \
--header 'Accept: application/com.reloadly.topups-v1+json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE'
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Threading.Tasks;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace WebAPIClient {
  class Program {

    static async Task Main(string[] args) {
      await ApiCall();
    }

    private static async Task ApiCall() {

      var message = new HttpRequestMessage(HttpMethod.Get, "https://topups.reloadly.com/countries/PK");

      message.Headers.TryAddWithoutValidation("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");
      message.Headers.TryAddWithoutValidation("Accept", "application/com.reloadly.topups-v1+json");

      using
      var httpClient = new HttpClient();
      var response = await httpClient.SendAsync(message);
      var responseBody = await response.Content.ReadAsStringAsync();
      var result = JsonConvert.DeserializeObject < dynamic > (responseBody);

      Console.WriteLine(result);
    }

  }
}
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://topups.reloadly.com/countries/PK"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Accept", "application/com.reloadly.topups-v1+json")
  req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Java" %}

```java
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://topups.reloadly.com/countries/PK")
  .method("GET", null)
  .addHeader("Accept", "application/com.reloadly.topups-v1+json")
  .addHeader("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
  .build();
Response response = client.newCall(request).execute();
```

{% endtab %}

{% tab title="Node JS" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/com.reloadly.topups-v1+json");
myHeaders.append("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");

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

fetch("https://topups.reloadly.com/countries/PK", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://topups.reloadly.com/countries/PK',
  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',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/com.reloadly.topups-v1+json',
    'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://topups.reloadly.com/countries/PK"

payload={}
headers = {
  'Accept': 'application/com.reloadly.topups-v1+json',
  'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

###

### Response parameters

| Parameters       | Type   | Description                                             |
| ---------------- | ------ | ------------------------------------------------------- |
| `isoName`        | string | This indicates the ISO code of the country              |
| `name`           | string | This indicates the country's name                       |
| `currencyCode`   | string | This indicates the code of the country's currency       |
| `currencyName`   | string | This indicates the name of the country's currency       |
| `currencySymbol` | string | This indicates the symbol of the country's currency     |
| `flag`           | string | This is a link to an SVG image of the country's flag    |
| `callingCodes`   | string | This indicates the country's international dialing code |
