Get Available Numbers/v1/numbers/{areaCode}

Description

Gets a list of available numbers for a specified area code.

GET
Endpoint

https://api.textport.com/v1/numbers/{areaCode}

Request
GET /v1/numbers/213 HTTP/1.1
Host: api.textport.com
Authorization: Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn
var client = new RestClient("https://api.textport.com/v1/numbers/213");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn");
IRestResponse response = client.Execute(request);
$request = new HttpRequest();
$request->setUrl('https://api.textport.com/v1/numbers/213');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
    'Authorization' => 'Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn'
));

try {
    $response = $request->send();

    echo $response->getBody();
} catch (HttpException $ex) {
    echo $ex;
}
curl -X GET \
https://api.textport.com/v1/numbers/213 \
-H 'Authorization: Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn'
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.textport.com/v1/numbers/213",
    "method": "GET",
    "headers": {
        "Authorization": "Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
import http.client

conn = http.client.HTTPConnection("api,textport,com")

payload = ""

headers = {
    'Authorization': "Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn"
}

conn.request("GET", "v1,numbers,213", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
require 'uri'
require 'net/http'

url = URI("https://api.textport.com/v1/numbers/213")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic MS13OFBHczdPY09KOkVnbkJDZnh5N2txMXdHVkpycFJn'

response = http.request(request)
puts response.read_body
{
    "AreaCode": "213",
    "NumberCount": 100,
    "Message": "100 numbers found.",
    "Numbers": [
        "12135550615",
        "12135550627",
        "12135550638",
        "12135550641",
        "12135550647",
        ...
        "12135550648",
        "12135550653",
        "12135550656",
        "12135550661",
        "12135550678",
        ]
}
<NumbersResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <AreaCode>213</AreaCode>
    <NumberCount>100</NumberCount>
    <Message>100 numbers found.</Message>
    <Numbers>
        <string>12135551212</string>
        <string>12135551213</string>
        <string>12135551214</string>
        <string>12135551215</string>
        <string>12135551216</string>
        ...
        <string>12135551217</string>
        <string>12135551218</string>
        <string>12135551219</string>
        <string>12135551220</string>
        <string>12135551221</string>
    </Numbers>
</NumbersResult>

Note: The default format for response content is JSON. Adding an HTTP header Accept: application/xml will set the response format to XML.