List of AvailablePhoneNumber Resources
Use this endpoint for the AvailablePhoneNumbers method to return a list of URIs to phone number resources available to the account. The list is categorized by type (Local, Toll-Free, Mobile, etc) and ISO country.
Parameters
Parameter |
---|
None |
Examples
Request
- cURL
- Node.js
- C#
- Python
- Ruby
curl https://example.signalwire.com/api/laml/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers.json \
-X GET \
-u "YourProjectID:YourAuthToken"
const { RestClient } = require('@signalwire/compatibility-api')
const client = RestClient('YourProjectID', 'YourAuthToken', { signalwireSpaceUrl: 'example.signalwire.com' })
client
.availablePhoneNumbers()
.then(availablePhoneNumbers => {
console.log(availablePhoneNumbers);
});
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Program
{
static void Main(string[] args)
{
TwilioClient.Init("YourProjectID", "YourAuthToken", new Dictionary<string, object> { ["signalwireSpaceUrl"] = "{SPACE}.signalwire.com" });
var availablePhoneNumbers = AvailablePhoneNumberCountryResource.Read();
Console.WriteLine(availablePhoneNumbers);
}
}
from signalwire.rest import Client as signalwire_client
client = signalwire_client("YourProjectID", "YourAuthToken", signalwire_space_url = 'example.signalwire.com')
numbers = client.available_phone_numbers() \
.list()
print(numbers)
require 'signalwire/sdk'
@client = Signalwire::REST::Client.new 'YourProjectID', 'YourAuthToken', signalwire_space_url: "example.signalwire.com"
@numbers = @client.api.available_phone_numbers()
.list()
puts @numbers
Response
200 OK
{
"countries": [
{
"beta": false,
"country": "United States",
"country_code": "US",
"subresource_uris": {
"local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local",
"toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree"
},
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US"
}
],
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers"
}
Request: List of AvailablePhoneNumber Resources in US
This example returns a list of URIs to phone number resources available to the account in the US ISO country. The URIs are categorized by type (Local, Toll-Free, Mobile, etc).
- cURL
- Node.js
- C#
- Python
- Ruby
curl https://example.signalwire.com/api/laml/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/US.json \
-X GET \
-u "YourProjectID:YourAuthToken"
const { RestClient } = require('@signalwire/compatibility-api')
const client = RestClient('YourProjectID', 'YourAuthToken', { signalwireSpaceUrl: 'example.signalwire.com' })
client
.availablePhoneNumbers('US')
.fetch()
.then(availablePhoneNumbers => {
console.log(availablePhoneNumbers);
});
using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Program
{
static void Main(string[] args)
{
TwilioClient.Init("YourProjectID", "YourAuthToken", new Dictionary<string, object> { ["signalwireSpaceUrl"] = "{SPACE}.signalwire.com" });
var availablePhoneNumbers = AvailablePhoneNumberCountryResource.Fetch("US");
Console.WriteLine(availablePhoneNumbers);
}
}
from signalwire.rest import Client as signalwire_client
client = signalwire_client("YourProjectID", "YourAuthToken", signalwire_space_url = 'example.signalwire.com')
numbers = client.available_phone_numbers("US") \
.fetch()
print(numbers)
require 'signalwire/sdk'
@client = Signalwire::REST::Client.new 'YourProjectID', 'YourAuthToken', signalwire_space_url: "example.signalwire.com"
@numbers = @client.api.available_phone_numbers('US')
.fetch()
puts @numbers
Response
200 OK
{
"beta": null,
"country": "United States",
"country_code": "US",
"subresource_uris": {
"local": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/Local.json",
"toll_free": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US/TollFree.json"
},
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/AvailablePhoneNumbers/US.json"
}