cURL
curl --request POST \
--url https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"areaCode": 415,
"countryCode": "US",
"tollFree": false,
"locationId": "loc_9f7a123",
"campaignId": "campaign_speed_to_lead_123"
}'import requests
url = "https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers"
payload = {
"areaCode": 415,
"countryCode": "US",
"tollFree": False,
"locationId": "loc_9f7a123",
"campaignId": "campaign_speed_to_lead_123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
areaCode: 415,
countryCode: 'US',
tollFree: false,
locationId: 'loc_9f7a123',
campaignId: 'campaign_speed_to_lead_123'
})
};
fetch('https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers', 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.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'areaCode' => 415,
'countryCode' => 'US',
'tollFree' => false,
'locationId' => 'loc_9f7a123',
'campaignId' => 'campaign_speed_to_lead_123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers"
payload := strings.NewReader("{\n \"areaCode\": 415,\n \"countryCode\": \"US\",\n \"tollFree\": false,\n \"locationId\": \"loc_9f7a123\",\n \"campaignId\": \"campaign_speed_to_lead_123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"areaCode\": 415,\n \"countryCode\": \"US\",\n \"tollFree\": false,\n \"locationId\": \"loc_9f7a123\",\n \"campaignId\": \"campaign_speed_to_lead_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"areaCode\": 415,\n \"countryCode\": \"US\",\n \"tollFree\": false,\n \"locationId\": \"loc_9f7a123\",\n \"campaignId\": \"campaign_speed_to_lead_123\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"phoneNumber": {
"phoneNumber": "+14155551234",
"pretty": "+1 (415) 555-1234",
"nickname": "Lead follow-up",
"boundToAgent": true
}
}{
"success": false,
"error": "VALIDATION",
"message": "A campaignId is required."
}{
"success": false,
"error": "Unauthorized",
"message": "Authentication required."
}{
"success": false,
"error": "Forbidden",
"message": "You do not have access to phone number endpoints."
}{
"success": false,
"error": "NotFound",
"message": "Campaign \"campaign_missing\" not found or not accessible."
}{
"success": false,
"error": "CONFLICT",
"message": "This is the only number on an active campaign. Pause the campaign or add another number before removing it."
}{
"success": false,
"error": "TooManyRequests",
"message": "Too many requests, please try again later."
}{
"success": false,
"error": "InternalError",
"message": "Unexpected server error."
}Buy agent phone number
Buy a new caller ID and attach it to the requested agent context. This is a paid action. Allowed customer role: agency_admin.
Required API key scope: phone_numbers:write.
POST
/
api
/
agent-builder
/
agents
/
{id}
/
phone-numbers
cURL
curl --request POST \
--url https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"areaCode": 415,
"countryCode": "US",
"tollFree": false,
"locationId": "loc_9f7a123",
"campaignId": "campaign_speed_to_lead_123"
}'import requests
url = "https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers"
payload = {
"areaCode": 415,
"countryCode": "US",
"tollFree": False,
"locationId": "loc_9f7a123",
"campaignId": "campaign_speed_to_lead_123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
areaCode: 415,
countryCode: 'US',
tollFree: false,
locationId: 'loc_9f7a123',
campaignId: 'campaign_speed_to_lead_123'
})
};
fetch('https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers', 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.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'areaCode' => 415,
'countryCode' => 'US',
'tollFree' => false,
'locationId' => 'loc_9f7a123',
'campaignId' => 'campaign_speed_to_lead_123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers"
payload := strings.NewReader("{\n \"areaCode\": 415,\n \"countryCode\": \"US\",\n \"tollFree\": false,\n \"locationId\": \"loc_9f7a123\",\n \"campaignId\": \"campaign_speed_to_lead_123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"areaCode\": 415,\n \"countryCode\": \"US\",\n \"tollFree\": false,\n \"locationId\": \"loc_9f7a123\",\n \"campaignId\": \"campaign_speed_to_lead_123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.teamfollowup.ai/api/agent-builder/agents/{id}/phone-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"areaCode\": 415,\n \"countryCode\": \"US\",\n \"tollFree\": false,\n \"locationId\": \"loc_9f7a123\",\n \"campaignId\": \"campaign_speed_to_lead_123\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"phoneNumber": {
"phoneNumber": "+14155551234",
"pretty": "+1 (415) 555-1234",
"nickname": "Lead follow-up",
"boundToAgent": true
}
}{
"success": false,
"error": "VALIDATION",
"message": "A campaignId is required."
}{
"success": false,
"error": "Unauthorized",
"message": "Authentication required."
}{
"success": false,
"error": "Forbidden",
"message": "You do not have access to phone number endpoints."
}{
"success": false,
"error": "NotFound",
"message": "Campaign \"campaign_missing\" not found or not accessible."
}{
"success": false,
"error": "CONFLICT",
"message": "This is the only number on an active campaign. Pause the campaign or add another number before removing it."
}{
"success": false,
"error": "TooManyRequests",
"message": "Too many requests, please try again later."
}{
"success": false,
"error": "InternalError",
"message": "Unexpected server error."
}Authorizations
Send your API key as Authorization: Bearer YOUR_API_KEY.
Path Parameters
Agent id returned by the Agents API.
Minimum string length:
1Body
application/json
Number purchase constraints.
Three-digit area code preference.
Required range:
200 <= x <= 999Example:
415
Country for the new phone number.
Available options:
US, CA Example:
"US"
Request a toll-free number.
Example:
false
Specific E.164 number selected from search.
Pattern:
^\+\d{10,15}$Example:
"+14155559876"
Project location id used to disambiguate shared-agent contexts.
Example:
"loc_9f7a123"
Campaign id used to attach the number to one campaign.
Example:
"campaign_speed_to_lead_123"
⌘I
