JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const tollFreeCampaign = await client.tollFreeCampaigns.retrieve('tfc_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
)
toll_free_campaign = client.toll_free_campaigns.retrieve(
"tfc_01j9a43avnfqzbjfch6pygv1td",
)
print(toll_free_campaign.id)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
toll_free_campaign = surge.toll_free_campaigns.retrieve("tfc_01j9a43avnfqzbjfch6pygv1td")
puts(toll_free_campaign)curl --request GET \
--url https://api.surge.app/toll_free_campaigns/{campaign_id} \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/toll_free_campaigns/{campaign_id}",
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/toll_free_campaigns/{campaign_id}"
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/toll_free_campaigns/{campaign_id}")
.header("Authorization", "Bearer <token>")
.asString();{
"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"
]
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Toll-free Campaigns
Retrieve toll-free campaign
Retrieve a toll-free campaign by ID.
GET
/
toll_free_campaigns
/
{campaign_id}
JavaScript
import Surge from '@surgeapi/node';
const client = new Surge({
apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});
const tollFreeCampaign = await client.tollFreeCampaigns.retrieve('tfc_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
)
toll_free_campaign = client.toll_free_campaigns.retrieve(
"tfc_01j9a43avnfqzbjfch6pygv1td",
)
print(toll_free_campaign.id)require "surge_api"
surge = SurgeAPI::Client.new(api_key: "My API Key")
toll_free_campaign = surge.toll_free_campaigns.retrieve("tfc_01j9a43avnfqzbjfch6pygv1td")
puts(toll_free_campaign)curl --request GET \
--url https://api.surge.app/toll_free_campaigns/{campaign_id} \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.surge.app/toll_free_campaigns/{campaign_id}",
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/toll_free_campaigns/{campaign_id}"
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/toll_free_campaigns/{campaign_id}")
.header("Authorization", "Bearer <token>")
.asString();{
"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"
]
}{
"error": {
"message": "The requested resource could not be found.",
"type": "not_found"
}
}Authorizations
Path Parameters
Response
Toll-free campaign
A toll-free campaign registration for a phone number.