# Dialing Permissions - Countries resource

Voice dialing permissions are organized by country and identified by the country's [ISO](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code.

## Countries properties

```json
{"type":"object","refName":"voice.v1.dialing_permissions.dialing_permissions_country","modelName":"voice_v1_dialing_permissions_dialing_permissions_country","properties":{"iso_code":{"type":"string","format":"iso-country-code","nullable":true,"description":"The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)."},"name":{"type":"string","nullable":true,"description":"The name of the country."},"continent":{"type":"string","nullable":true,"description":"The name of the continent in which the country is located."},"country_codes":{"type":"array","items":{"type":"string"},"nullable":true,"description":"The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html)"},"low_risk_numbers_enabled":{"type":"boolean","nullable":true,"description":"Whether dialing to low-risk numbers is enabled."},"high_risk_special_numbers_enabled":{"type":"boolean","nullable":true,"description":"Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others"},"high_risk_tollfraud_numbers_enabled":{"type":"boolean","nullable":true,"description":"Whether dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently"},"url":{"type":"string","format":"uri","nullable":true,"description":"The absolute URL of this resource."},"links":{"type":"object","format":"uri-map","nullable":true,"description":"A list of URLs related to this resource."}}}
```

## Retrieve a Country

`GET https://voice.twilio.com/v1/DialingPermissions/Countries/{IsoCode}`

### Path parameters

```json
[{"name":"IsoCode","in":"path","description":"The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the DialingPermissions Country resource to fetch","schema":{"type":"string","format":"iso-country-code"},"required":true}]
```

Retrieve a Country

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function fetchDialingPermissionsCountry() {
  const country = await client.voice.v1.dialingPermissions
    .countries("US")
    .fetch();

  console.log(country.isoCode);
}

fetchDialingPermissionsCountry();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

country = client.voice.v1.dialing_permissions.countries("US").fetch()

print(country.iso_code)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Voice.V1.DialingPermissions;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var country = await CountryResource.FetchAsync(pathIsoCode: "US");

        Console.WriteLine(country.IsoCode);
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.voice.v1.dialingpermissions.Country;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        Country country = Country.fetcher("US").fetch();

        System.out.println(country.getIsoCode());
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	resp, err := client.VoiceV1.FetchDialingPermissionsCountry("US")
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		if resp.IsoCode != nil {
			fmt.Println(*resp.IsoCode)
		} else {
			fmt.Println(resp.IsoCode)
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$country = $twilio->voice->v1->dialingPermissions->countries("US")->fetch();

print $country->isoCode;
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

country = @client
          .voice
          .v1
          .dialing_permissions
          .countries('US')
          .fetch

puts country.iso_code
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:voice:v1:dialing-permissions:countries:fetch \
   --iso-code US
```

```bash
curl -X GET "https://voice.twilio.com/v1/DialingPermissions/Countries/US" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "iso_code": "US",
  "name": "United States/Canada",
  "country_codes": [
    "+1"
  ],
  "continent": "NORTH_AMERICA",
  "low_risk_numbers_enabled": false,
  "high_risk_special_numbers_enabled": false,
  "high_risk_tollfraud_numbers_enabled": false,
  "url": "https://voice.twilio.com/v1/DialingPermissions/Countries/US",
  "links": {
    "highrisk_special_prefixes": "https://voice.twilio.com/v1/DialingPermissions/Countries/US/HighRiskSpecialPrefixes"
  }
}
```

## Retrieve a list of Countries

`GET https://voice.twilio.com/v1/DialingPermissions/Countries`

### Query parameters

```json
[{"name":"IsoCode","in":"query","description":"Filter to retrieve the country permissions by specifying the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)","schema":{"type":"string","format":"iso-country-code"},"examples":{"readUs":{"value":"US"}}},{"name":"Continent","in":"query","description":"Filter to retrieve the country permissions by specifying the continent","schema":{"type":"string"}},{"name":"CountryCode","in":"query","description":"Filter the results by specified [country codes](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html)","schema":{"type":"string"}},{"name":"LowRiskNumbersEnabled","in":"query","description":"Filter to retrieve the country permissions with dialing to low-risk numbers enabled. Can be: `true` or `false`.","schema":{"type":"boolean"}},{"name":"HighRiskSpecialNumbersEnabled","in":"query","description":"Filter to retrieve the country permissions with dialing to high-risk special service numbers enabled. Can be: `true` or `false`","schema":{"type":"boolean"}},{"name":"HighRiskTollfraudNumbersEnabled","in":"query","description":"Filter to retrieve the country permissions with dialing to high-risk [toll fraud](https://www.twilio.com/blog/how-to-protect-your-account-from-toll-fraud-with-voice-dialing-geo-permissions-html) numbers enabled. Can be: `true` or `false`.","schema":{"type":"boolean"}},{"name":"PageSize","in":"query","description":"How many resources to return in each list page. The default is 50, and the maximum is 1000.","schema":{"type":"integer","format":"int64","minimum":1,"maximum":1000}},{"name":"Page","in":"query","description":"The page index. This value is simply for client state.","schema":{"type":"integer","minimum":0}},{"name":"PageToken","in":"query","description":"The page token. This is provided by the API.","schema":{"type":"string"}}]
```

Retrieve a list of Countries

```js
// Download the helper library from https://www.twilio.com/docs/node/install
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = twilio(accountSid, authToken);

async function listDialingPermissionsCountry() {
  const countries = await client.voice.v1.dialingPermissions.countries.list({
    limit: 20,
  });

  countries.forEach((c) => console.log(c.isoCode));
}

listDialingPermissionsCountry();
```

```python
# Download the helper library from https://www.twilio.com/docs/python/install
import os
from twilio.rest import Client

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
client = Client(account_sid, auth_token)

countries = client.voice.v1.dialing_permissions.countries.list(limit=20)

for record in countries:
    print(record.iso_code)
```

```csharp
// Install the C# / .NET helper library from twilio.com/docs/csharp/install

using System;
using Twilio;
using Twilio.Rest.Voice.V1.DialingPermissions;
using System.Threading.Tasks;

class Program {
    public static async Task Main(string[] args) {
        // Find your Account SID and Auth Token at twilio.com/console
        // and set the environment variables. See http://twil.io/secure
        string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
        string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");

        TwilioClient.Init(accountSid, authToken);

        var countries = await CountryResource.ReadAsync(limit: 20);

        foreach (var record in countries) {
            Console.WriteLine(record.IsoCode);
        }
    }
}
```

```java
// Install the Java helper library from twilio.com/docs/java/install

import com.twilio.Twilio;
import com.twilio.rest.voice.v1.dialingpermissions.Country;
import com.twilio.base.ResourceSet;

public class Example {
    // Find your Account SID and Auth Token at twilio.com/console
    // and set the environment variables. See http://twil.io/secure
    public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
    public static final String AUTH_TOKEN = System.getenv("TWILIO_AUTH_TOKEN");

    public static void main(String[] args) {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        ResourceSet<Country> countries = Country.reader().limit(20).read();

        for (Country record : countries) {
            System.out.println(record.getIsoCode());
        }
    }
}
```

```go
// Download the helper library from https://www.twilio.com/docs/go/install
package main

import (
	"fmt"
	"github.com/twilio/twilio-go"
	voice "github.com/twilio/twilio-go/rest/voice/v1"
	"os"
)

func main() {
	// Find your Account SID and Auth Token at twilio.com/console
	// and set the environment variables. See http://twil.io/secure
	// Make sure TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN exists in your environment
	client := twilio.NewRestClient()

	params := &voice.ListDialingPermissionsCountryParams{}
	params.SetLimit(20)

	resp, err := client.VoiceV1.ListDialingPermissionsCountry(params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].IsoCode != nil {
				fmt.Println(*resp[record].IsoCode)
			} else {
				fmt.Println(resp[record].IsoCode)
			}
		}
	}
}
```

```php
<?php

// Update the path below to your autoload.php,
// see https://getcomposer.org/doc/01-basic-usage.md
require_once "/path/to/vendor/autoload.php";

use Twilio\Rest\Client;

// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);

$countries = $twilio->voice->v1->dialingPermissions->countries->read([], 20);

foreach ($countries as $record) {
    print $record->isoCode;
}
```

```ruby
# Download the helper library from https://www.twilio.com/docs/ruby/install
require 'twilio-ruby'

# Find your Account SID and Auth Token at twilio.com/console
# and set the environment variables. See http://twil.io/secure
account_sid = ENV['TWILIO_ACCOUNT_SID']
auth_token = ENV['TWILIO_AUTH_TOKEN']
@client = Twilio::REST::Client.new(account_sid, auth_token)

countries = @client
            .voice
            .v1
            .dialing_permissions
            .countries
            .list(limit: 20)

countries.each do |record|
   puts record.iso_code
end
```

```bash
# Install the twilio-cli from https://twil.io/cli

twilio api:voice:v1:dialing-permissions:countries:list
```

```bash
curl -X GET "https://voice.twilio.com/v1/DialingPermissions/Countries?PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

```json
{
  "content": [
    {
      "iso_code": "US",
      "name": "United States/Canada",
      "country_codes": [
        "+1"
      ],
      "continent": "NORTH_AMERICA",
      "low_risk_numbers_enabled": false,
      "high_risk_special_numbers_enabled": false,
      "high_risk_tollfraud_numbers_enabled": false,
      "url": "https://voice.twilio.com/v1/DialingPermissions/Countries/US",
      "links": {
        "highrisk_special_prefixes": "https://voice.twilio.com/v1/DialingPermissions/Countries/US/HighRiskSpecialPrefixes"
      }
    }
  ],
  "meta": {
    "first_page_url": "https://voice.twilio.com/v1/DialingPermissions/Countries?IsoCode=US&PageSize=50&Page=0",
    "key": "content",
    "next_page_url": null,
    "page": 0,
    "page_size": 50,
    "previous_page_url": null,
    "url": "https://voice.twilio.com/v1/DialingPermissions/Countries?IsoCode=US&PageSize=50&Page=0"
  }
}
```
