Numbers
Set Voice Pool
Replace the voice pool on an inbound number.
POST
/
v1
/
inbound
/
{phone_number}
/
voice-pool
Set Voice Pool
curl --request POST \
--url https://api.bland.ai/v1/inbound/{phone_number}/voice-pool \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"voice_ids": [
{}
]
}
'import requests
url = "https://api.bland.ai/v1/inbound/{phone_number}/voice-pool"
payload = { "voice_ids": [{}] }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({voice_ids: [{}]})
};
fetch('https://api.bland.ai/v1/inbound/{phone_number}/voice-pool', 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.bland.ai/v1/inbound/{phone_number}/voice-pool",
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([
'voice_ids' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/inbound/{phone_number}/voice-pool"
payload := strings.NewReader("{\n \"voice_ids\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/inbound/{phone_number}/voice-pool")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"voice_ids\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/inbound/{phone_number}/voice-pool")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voice_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"count": 3
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "INVALID_REQUEST",
"message": "Maximum number of voices is 20"
}
]
}
{
"data": null,
"errors": [
{
"error": "INVALID_REQUEST",
"message": "invalid voice_ids"
}
]
}
{
"data": null,
"errors": [
{
"error": "UNAUTHORIZED",
"message": "Unauthorized voices"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Inbound number not found"
}
]
}
Overview
Sets the voices an inbound number rotates through. Each inbound call picks one voice from the pool at random, so the same number can answer in a different voice each time. This replaces the whole pool rather than adding to it. Send the full set of voices you want every time, and send an empty array to clear the pool. Read the current pool with Get Voice Pool. A rejected request leaves the current pool untouched, so a validation error cannot cost you the voices already set.Two things override the pool: an agent attached to the number, and a
voice passed to Create Inbound Session when the call starts from a session. In either case the pool is ignored.The number’s own voice setting does not override it. Where a pool is set, it takes the place of that voice on every call.Headers
string
required
Your API key for authentication.
Path Parameters
string
required
The inbound number to configure, in E.164 format (for example
+15551234567). SIP DIDs are matched in the form they are stored, so a numeric DID such as 9994221001 also resolves.Body Parameters
array
required
The voices to put in the pool. At most 20, or the request is rejected with a 400. Each must be a voice An ID that is a well-formed UUID but does not match a voice you can use is dropped without an error. Compare
id from List Voices, which is a UUID, not the provider-facing voice_id string on the same object.You can use any public voice, plus the cloned voices your organization owns.{
"voice_ids": [
"bad67584-9418-4c30-acf2-eb07d4f4fac7",
"89bf6194-d860-4126-be95-190d5bf2d0f9",
"76c0d2ee-8e9d-40a1-83f7-aa39244a004c"
]
}
count in the response against the number you sent to catch this.Response
object
Show data fields
Show data fields
integer
How many voices are now in the pool. Lower than the number of IDs you sent if any were dropped or duplicated.
null | array
null on success, or a list of error objects if the request failed.{
"data": {
"count": 3
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "INVALID_REQUEST",
"message": "Maximum number of voices is 20"
}
]
}
{
"data": null,
"errors": [
{
"error": "INVALID_REQUEST",
"message": "invalid voice_ids"
}
]
}
{
"data": null,
"errors": [
{
"error": "UNAUTHORIZED",
"message": "Unauthorized voices"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Inbound number not found"
}
]
}
Docs for agents: llms.txt
Was this page helpful?
⌘I
Set Voice Pool
curl --request POST \
--url https://api.bland.ai/v1/inbound/{phone_number}/voice-pool \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"voice_ids": [
{}
]
}
'import requests
url = "https://api.bland.ai/v1/inbound/{phone_number}/voice-pool"
payload = { "voice_ids": [{}] }
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({voice_ids: [{}]})
};
fetch('https://api.bland.ai/v1/inbound/{phone_number}/voice-pool', 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.bland.ai/v1/inbound/{phone_number}/voice-pool",
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([
'voice_ids' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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.bland.ai/v1/inbound/{phone_number}/voice-pool"
payload := strings.NewReader("{\n \"voice_ids\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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.bland.ai/v1/inbound/{phone_number}/voice-pool")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"voice_ids\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bland.ai/v1/inbound/{phone_number}/voice-pool")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voice_ids\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"count": 3
},
"errors": null
}
{
"data": null,
"errors": [
{
"error": "INVALID_REQUEST",
"message": "Maximum number of voices is 20"
}
]
}
{
"data": null,
"errors": [
{
"error": "INVALID_REQUEST",
"message": "invalid voice_ids"
}
]
}
{
"data": null,
"errors": [
{
"error": "UNAUTHORIZED",
"message": "Unauthorized voices"
}
]
}
{
"data": null,
"errors": [
{
"error": "NOT_FOUND",
"message": "Inbound number not found"
}
]
}