# AvailablePhoneNumber Local resource

To find local phone numbers you can purchase, use the `AvailablePhoneNumbers Local` subresource.

## Focus your phone number search

To focus your search of available phone numbers, provide one or more of the following characteristics:

* A pattern within the phone number
* A state, province, country, or postal code for the phone number ([North American Numbering Plan (NANP)][nanp] numbers only)
* An area code or exchange
* A feature that phone number supports, like SMS

[nanp]: https://en.wikipedia.org/wiki/North_American_Numbering_Plan

Twilio seeks to keep a wide variety of phone numbers in stock at all times. To learn which countries Twilio supports, see [pricing](https://www.twilio.com/en-us/pricing).

## Local Properties

```json
{"type":"object","refName":"api.v2010.account.available_phone_number_country.available_phone_number_local","modelName":"api_v2010_account_available_phone_number_country_available_phone_number_local","properties":{"friendly_name":{"type":"string","format":"phone-number","nullable":true,"description":"A formatted version of the phone number."},"phone_number":{"type":"string","format":"phone-number","nullable":true,"description":"The phone number in [E.164](/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number."},"lata":{"type":"string","nullable":true,"description":"The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada."},"locality":{"type":"string","nullable":true,"description":"The locality or city of this phone number's location."},"rate_center":{"type":"string","nullable":true,"description":"The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada."},"latitude":{"type":"number","nullable":true,"description":"The latitude of this phone number's location. Available for only phone numbers from the US and Canada."},"longitude":{"type":"number","nullable":true,"description":"The longitude of this phone number's location. Available for only phone numbers from the US and Canada."},"region":{"type":"string","nullable":true,"description":"The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada."},"postal_code":{"type":"string","nullable":true,"description":"The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada."},"iso_country":{"type":"string","format":"iso-country-code","nullable":true,"description":"The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number."},"address_requirements":{"type":"string","nullable":true,"description":"The type of [Address](/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required."},"beta":{"type":"boolean","nullable":true,"description":"Whether the phone number is new to the Twilio platform. Can be: `true` or `false`."},"capabilities":{"type":"object","format":"phone-number-capabilities","x-class-extra-annotation":"@JsonInclude(JsonInclude.Include.NON_NULL)","nullable":true,"description":"The set of Boolean properties that indicate whether a phone number can receive calls or messages.  Capabilities are: `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`.","properties":{"mms":{"type":"boolean"},"sms":{"type":"boolean"},"voice":{"type":"boolean"},"fax":{"type":"boolean"}}}}}
```

## Read multiple AvailablePhoneNumberLocal resources

`GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/Local.json`

### Path parameters

```json
[{"name":"AccountSid","in":"path","description":"The SID of the [Account](/docs/iam/api/account) requesting the AvailablePhoneNumber resources.","schema":{"type":"string","minLength":34,"maxLength":34,"pattern":"^AC[0-9a-fA-F]{32}$"},"required":true},{"name":"CountryCode","in":"path","description":"The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country from which to read phone numbers.","schema":{"type":"string","format":"iso-country-code"},"required":true}]
```

### Query parameters

```json
[{"name":"AreaCode","in":"query","description":"The area code of the phone numbers to read. Applies to only phone numbers in the US and Canada.","schema":{"type":"integer"}},{"name":"Contains","in":"query","description":"Matching pattern to identify phone numbers. This pattern can be between 2 and 16 characters long and allows all digits (0-9) and all non-diacritic latin alphabet letters (a-z, A-Z). It accepts four meta-characters: `*`, `%`, `+`, `$`. The `*` and `%` meta-characters can appear multiple times in the pattern. To match wildcards at the beginning or end of the pattern, use `*` to match any single character or `%` to match a sequence of characters. If you use the wildcard patterns, it must include at least two non-meta-characters, and wildcards cannot be used between non-meta-characters. To match the beginning of a pattern, start the pattern with `+`. To match the end of the pattern, append the pattern with `$`. These meta-characters can't be adjacent to each other.","schema":{"type":"string"}},{"name":"SmsEnabled","in":"query","description":"Whether the phone numbers can receive text messages. Can be: `true` or `false`.","schema":{"type":"boolean"}},{"name":"MmsEnabled","in":"query","description":"Whether the phone numbers can receive MMS messages. Can be: `true` or `false`.","schema":{"type":"boolean"}},{"name":"VoiceEnabled","in":"query","description":"Whether the phone numbers can receive calls. Can be: `true` or `false`.","schema":{"type":"boolean"}},{"name":"ExcludeAllAddressRequired","in":"query","description":"Whether to exclude phone numbers that require an [Address](/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.","schema":{"type":"boolean"}},{"name":"ExcludeLocalAddressRequired","in":"query","description":"Whether to exclude phone numbers that require a local [Address](/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.","schema":{"type":"boolean"}},{"name":"ExcludeForeignAddressRequired","in":"query","description":"Whether to exclude phone numbers that require a foreign [Address](/docs/usage/api/address). Can be: `true` or `false` and the default is `false`.","schema":{"type":"boolean"}},{"name":"Beta","in":"query","description":"Whether to read phone numbers that are new to the Twilio platform. Can be: `true` or `false` and the default is `true`.","schema":{"type":"boolean"},"examples":{"readFull":{"value":"true"},"readEmpty":{"value":"true"}}},{"name":"NearNumber","in":"query","description":"Given a phone number, find a geographically close number within `distance` miles. Distance defaults to 25 miles. Applies to only phone numbers in the US and Canada.","schema":{"type":"string","format":"phone-number"}},{"name":"NearLatLong","in":"query","description":"Given a latitude/longitude pair `lat,long` find geographically close numbers within `distance` miles. Applies to only phone numbers in the US and Canada.","schema":{"type":"string"}},{"name":"Distance","in":"query","description":"The search radius, in miles, for a `near_` query.  Can be up to `500` and the default is `25`. Applies to only phone numbers in the US and Canada.","schema":{"type":"integer"}},{"name":"InPostalCode","in":"query","description":"Limit results to a particular postal code. Given a phone number, search within the same postal code as that number. Applies to only phone numbers in the US and Canada.","schema":{"type":"string"}},{"name":"InRegion","in":"query","description":"Limit results to a particular region, state, or province. Given a phone number, search within the same region as that number. Applies to only phone numbers in the US and Canada.","schema":{"type":"string"}},{"name":"InRateCenter","in":"query","description":"Limit results to a specific rate center, or given a phone number search within the same rate center as that number. Requires `in_lata` to be set as well. Applies to only phone numbers in the US and Canada.","schema":{"type":"string"}},{"name":"InLata","in":"query","description":"Limit results to a specific local access and transport area ([LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area)). Given a phone number, search within the same [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) as that number. Applies to only phone numbers in the US and Canada.","schema":{"type":"string"}},{"name":"InLocality","in":"query","description":"Limit results to a particular locality or city. Given a phone number, search within the same Locality as that number.","schema":{"type":"string"}},{"name":"FaxEnabled","in":"query","description":"Whether the phone numbers can receive faxes. 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"}}]
```

### Find phone numbers based on their characteristics

Find available local phone numbers by area code

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    areaCode: 510,
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    area_code=510, limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals = await LocalResource.ReadAsync(pathCountryCode: "US", areaCode: 510, limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setAreaCode(510).limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetAreaCode(510)
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["areaCode" => 510], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           area_code: 510,
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --area-code 510
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?AreaCode=510&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers by state

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    inRegion: "AR",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    in_region="AR", limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals =
            await LocalResource.ReadAsync(pathCountryCode: "US", inRegion: "AR", limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setInRegion("AR").limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetInRegion("AR")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["inRegion" => "AR"], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           in_region: 'AR',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --in-region AR
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?InRegion=AR&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers by prefix

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("GB").local.list({
    contains: "+4420",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("GB").local.list(
    contains="+4420", limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals =
            await LocalResource.ReadAsync(pathCountryCode: "GB", contains: "+4420", limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("GB").setContains("+4420").limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetContains("+4420")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("GB",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("GB")
    ->local->read(["contains" => "+4420"], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('GB')
         .local
         .list(
           contains: '+4420',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code GB \
   --contains +4420
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/GB/Local.json?Contains=%2B4420&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers by feature

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("GB").local.list({
    smsEnabled: true,
    voiceEnabled: true,
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("GB").local.list(
    sms_enabled=True, voice_enabled=True, limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals = await LocalResource.ReadAsync(
            pathCountryCode: "GB", smsEnabled: true, voiceEnabled: true, limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("GB").setSmsEnabled(true).setVoiceEnabled(true).limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetSmsEnabled(true)
	params.SetVoiceEnabled(true)
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("GB",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio->availablePhoneNumbers("GB")->local->read(
    [
        "smsEnabled" => true,
        "voiceEnabled" => true,
    ],
    20
);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('GB')
         .local
         .list(
           sms_enabled: true,
           voice_enabled: true,
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code GB \
   --sms-enabled \
   --voice-enabled
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/GB/Local.json?SmsEnabled=true&VoiceEnabled=true&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers without address requirements

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    excludeAllAddressRequired: true,
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    exclude_all_address_required=True, limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals = await LocalResource.ReadAsync(
            pathCountryCode: "US", excludeAllAddressRequired: true, limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setExcludeAllAddressRequired(true).limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetExcludeAllAddressRequired(true)
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["excludeAllAddressRequired" => true], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           exclude_all_address_required: true,
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --exclude-all-address-required
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?ExcludeAllAddressRequired=true&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

### Find phone numbers with a given pattern

Find available local phone numbers that start with a pattern

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    contains: "+1510555",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    contains="+1510555", limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals =
            await LocalResource.ReadAsync(pathCountryCode: "US", contains: "+1510555", limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setContains("+1510555").limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetContains("+1510555")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["contains" => "+1510555"], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           contains: '+1510555',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --contains +1510555
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?Contains=%2B1510555&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers that end with a pattern

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    contains: "7306$",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    contains="7306$", limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals =
            await LocalResource.ReadAsync(pathCountryCode: "US", contains: "7306$", limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setContains("7306$").limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetContains("7306$")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["contains" => "7306$"], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           contains: '7306$',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --contains 7306$
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?Contains=7306%24&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers that contain a pattern

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    contains: "%979%",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    contains="%979%", limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals =
            await LocalResource.ReadAsync(pathCountryCode: "US", contains: "%979%", limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setContains("%979%").limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetContains("%979%")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["contains" => "%979%"], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           contains: '%979%',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --contains %979%
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?Contains=%25979%25&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

Find available local phone numbers by character pattern

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    contains: "STORM",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    contains="STORM", limit=20
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals =
            await LocalResource.ReadAsync(pathCountryCode: "US", contains: "STORM", limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US").setContains("STORM").limit(20).read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetContains("STORM")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio
    ->availablePhoneNumbers("US")
    ->local->read(["contains" => "STORM"], 20);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           contains: 'STORM',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --contains STORM
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?Contains=STORM&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

### Find phone numbers using advanced filters

Find available local phone numbers using advanced filters

```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 listAvailablePhoneNumberLocal() {
  const locals = await client.availablePhoneNumbers("US").local.list({
    contains: "555",
    distance: 50,
    inRegion: "CA",
    nearLatLong: "37.840699,-122.461853",
    limit: 20,
  });

  locals.forEach((l) => console.log(l.friendlyName));
}

listAvailablePhoneNumberLocal();
```

```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)

locals = client.available_phone_numbers("US").local.list(
    contains="555",
    near_lat_long="37.840699,-122.461853",
    distance=50,
    in_region="CA",
    limit=20,
)

for record in locals:
    print(record.friendly_name)
```

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

using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account.AvailablePhoneNumberCountry;
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 locals = await LocalResource.ReadAsync(
            pathCountryCode: "US",
            contains: "555",
            nearLatLong: "37.840699,-122.461853",
            distance: 50,
            inRegion: "CA",
            limit: 20);

        foreach (var record in locals) {
            Console.WriteLine(record.FriendlyName);
        }
    }
}
```

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

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.availablephonenumbercountry.Local;
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<Local> locals = Local.reader("US")
                                        .setContains("555")
                                        .setNearLatLong("37.840699,-122.461853")
                                        .setDistance(50)
                                        .setInRegion("CA")
                                        .limit(20)
                                        .read();

        for (Local record : locals) {
            System.out.println(record.getFriendlyName());
        }
    }
}
```

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

import (
	"fmt"
	"github.com/twilio/twilio-go"
	api "github.com/twilio/twilio-go/rest/api/v2010"
	"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 := &api.ListAvailablePhoneNumberLocalParams{}
	params.SetContains("555")
	params.SetNearLatLong("37.840699,-122.461853")
	params.SetDistance(50)
	params.SetInRegion("CA")
	params.SetLimit(20)

	resp, err := client.Api.ListAvailablePhoneNumberLocal("US",
		params)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		for record := range resp {
			if resp[record].FriendlyName != nil {
				fmt.Println(*resp[record].FriendlyName)
			} else {
				fmt.Println(resp[record].FriendlyName)
			}
		}
	}
}
```

```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);

$locals = $twilio->availablePhoneNumbers("US")->local->read(
    [
        "contains" => "555",
        "nearLatLong" => "37.840699,-122.461853",
        "distance" => 50,
        "inRegion" => "CA",
    ],
    20
);

foreach ($locals as $record) {
    print $record->friendlyName;
}
```

```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)

locals = @client
         .api
         .v2010
         .available_phone_numbers('US')
         .local
         .list(
           contains: '555',
           near_lat_long: '37.840699,-122.461853',
           distance: 50,
           in_region: 'CA',
           limit: 20
         )

locals.each do |record|
   puts record.friendly_name
end
```

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

twilio api:core:available-phone-numbers:local:list \
   --country-code US \
   --contains 555 \
   --near-lat-long 37.840699,-122.461853 \
   --distance 50 \
   --in-region CA
```

```bash
curl -X GET "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/AvailablePhoneNumbers/US/Local.json?Contains=555&NearLatLong=37.840699%2C-122.461853&Distance=50&InRegion=CA&PageSize=20" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
```

## Purchase your phone number

To purchase the phone number you found, make a `POST` request to the [IncomingPhoneNumbers list resource](/docs/phone-numbers/api/incomingphonenumber-resource). Set the `PhoneNumber` parameter value to your found number.
