JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const tollFreeCampaign of client.tollFreeCampaigns.list(
'acct_01j9a43avnfqzbjfch6pygv1td',
)) {
console.log(tollFreeCampaign.id);
}import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
page = client.toll_free_campaigns.list(
account_id="acct_01j9a43avnfqzbjfch6pygv1td",
)
page = page.data[0]
print(page.id)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
page = surge.toll_free_campaigns.list("acct_01j9a43avnfqzbjfch6pygv1td")
puts(page)curl --request GET \
--url https://api.surge.app/accounts/{account_id}/toll_free_campaigns \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/accounts/{account_id}/toll_free_campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.surge.app/accounts/{account_id}/toll_free_campaigns"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.surge.app/accounts/{account_id}/toll_free_campaigns")
.header("Authorization", "Bearer <token>")
.asString();{
"data": [
{
"consent_flows": [
{
"script": "<string>",
"type": "verbal"
}
],
"description": "<string>",
"id": "<string>",
"includes": [
"age_gated"
],
"message_samples": [
"<string>"
],
"phone_number_id": "<string>",
"privacy_policy_url": "<string>",
"status": "active",
"terms_and_conditions_url": "<string>",
"use_cases": [
"two_factor_authentication"
]
}
],
"pagination": {
"next_cursor": "g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==",
"previous_cursor": null
}
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Toll-free Campaigns
List toll-free campaigns
List all toll-free campaigns for an account with cursor-based pagination.
GET
/
accounts
/
{account_id}
/
toll_free_campaigns
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const tollFreeCampaign of client.tollFreeCampaigns.list(
'acct_01j9a43avnfqzbjfch6pygv1td',
)) {
console.log(tollFreeCampaign.id);
}import os
from surge import Surge
client = Surge(
api_key=os.environ.get("SURGE_API_KEY"), # This is the default and can be omitted
)
page = client.toll_free_campaigns.list(
account_id="acct_01j9a43avnfqzbjfch6pygv1td",
)
page = page.data[0]
print(page.id)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
page = surge.toll_free_campaigns.list("acct_01j9a43avnfqzbjfch6pygv1td")
puts(page)curl --request GET \
--url https://api.surge.app/accounts/{account_id}/toll_free_campaigns \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/accounts/{account_id}/toll_free_campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.surge.app/accounts/{account_id}/toll_free_campaigns"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.surge.app/accounts/{account_id}/toll_free_campaigns")
.header("Authorization", "Bearer <token>")
.asString();{
"data": [
{
"consent_flows": [
{
"script": "<string>",
"type": "verbal"
}
],
"description": "<string>",
"id": "<string>",
"includes": [
"age_gated"
],
"message_samples": [
"<string>"
],
"phone_number_id": "<string>",
"privacy_policy_url": "<string>",
"status": "active",
"terms_and_conditions_url": "<string>",
"use_cases": [
"two_factor_authentication"
]
}
],
"pagination": {
"next_cursor": "g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==",
"previous_cursor": null
}
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The account ID to list toll-free campaigns for.
Example:
"acct_01j9a43avnfqzbjfch6pygv1td"
Query Parameters
Cursor for forward pagination. Use the next_cursor from a previous response.
Cursor for backward pagination. Use the previous_cursor from a previous response.
Response
List of toll-free campaigns
A paginated list of toll-free campaigns