List area codes
curl --request GET \
--url https://api.isnap.ai/v1/area-codesimport requests
url = "https://api.isnap.ai/v1/area-codes"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.isnap.ai/v1/area-codes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/area-codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/area-codes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.isnap.ai/v1/area-codes")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/area-codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"area_codes": [
{
"area_code": "212",
"region": "New York, NY",
"country_code": "US",
"purchase_zip": "10019",
"alt_zips": [
"10021",
"10023"
],
"shared_with": [
"646",
"917"
]
}
],
"countries": [
{
"country_code": "US",
"name": "United States",
"calling_code": "1"
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}Pre-orders
List area codes
Lists the area codes that can be requested on a pre-order, and the countries they belong to.
GET
/
v1
/
area-codes
List area codes
curl --request GET \
--url https://api.isnap.ai/v1/area-codesimport requests
url = "https://api.isnap.ai/v1/area-codes"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.isnap.ai/v1/area-codes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.isnap.ai/v1/area-codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.isnap.ai/v1/area-codes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.isnap.ai/v1/area-codes")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.isnap.ai/v1/area-codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"area_codes": [
{
"area_code": "212",
"region": "New York, NY",
"country_code": "US",
"purchase_zip": "10019",
"alt_zips": [
"10021",
"10023"
],
"shared_with": [
"646",
"917"
]
}
],
"countries": [
{
"country_code": "US",
"name": "United States",
"calling_code": "1"
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}{
"success": false,
"data": "<unknown>",
"error": {
"status": 123,
"code": "<string>",
"message": "<string>",
"retry_after": 123,
"retry_at": "<string>",
"issues": [
{
"path": [
"<string>"
],
"message": "<string>",
"code": "<string>",
"min": 123,
"max": 123
}
]
},
"trace_id": "<string>",
"request_id": "<string>"
}- Credential: none.
- Events: none.
- Pages: none. The whole list is returned in one response.
area_codesis ordered bycountry_code, then byarea_code, andcountriesbycountry_code. - Meaning: the list contains the area codes that a pre-order can request. It does not say which lines are in stock, and a pre-order does not check its
preferred_area_codesagainst it. See How a pre-order works.
Errors
| Status | error.code | When |
|---|---|---|
| 400 | validation_failed | country is not 2 letters. |
Query Parameters
Keep the area codes of one country: ISO 3166-1 alpha-2 code, case-insensitive. A country with no area code returns an empty area_codes. Omit it for every country.
Pattern:
^[A-Za-z]{2}$Example:
"US"
Response
The area codes and the countries that can be requested.
Always true on a success response.
Available options:
true The area codes and the countries that can be requested on a pre-order.
Show child attributes
Show child attributes
Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.
Id of the request that produced this response: req_ followed by 25 letters or digits.