Set Inbound Agent API
Configure Bolna Voice AI agent to handle inbound calls automatically by associating it with a specific phone number using Bolna APIs.
curl --request POST \
--url https://api.bolna.ai/inbound/setup \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number_id": "123e4567-e89b-12d3-a456-426614174000",
"allow_multiple": true,
"ivr_config": {
"enabled": true,
"voice": "Polly.Aditi",
"welcome_message": "Welcome to Acme Corp.",
"timeout": 7,
"max_retries": 2,
"steps": [
{
"step_id": "<string>",
"prompt": "<string>",
"field_name": "<string>",
"options": [
{}
],
"next_step": "<string>",
"conditional_next": {}
}
],
"default_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
'import requests
url = "https://api.bolna.ai/inbound/setup"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number_id": "123e4567-e89b-12d3-a456-426614174000",
"allow_multiple": True,
"ivr_config": {
"enabled": True,
"voice": "Polly.Aditi",
"welcome_message": "Welcome to Acme Corp.",
"timeout": 7,
"max_retries": 2,
"steps": [
{
"step_id": "<string>",
"prompt": "<string>",
"field_name": "<string>",
"options": [{}],
"next_step": "<string>",
"conditional_next": {}
}
],
"default_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
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({
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
phone_number_id: '123e4567-e89b-12d3-a456-426614174000',
allow_multiple: true,
ivr_config: {
enabled: true,
voice: 'Polly.Aditi',
welcome_message: 'Welcome to Acme Corp.',
timeout: 7,
max_retries: 2,
steps: [
{
step_id: '<string>',
prompt: '<string>',
field_name: '<string>',
options: [{}],
next_step: '<string>',
conditional_next: {}
}
],
default_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
})
};
fetch('https://api.bolna.ai/inbound/setup', 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.bolna.ai/inbound/setup",
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([
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'phone_number_id' => '123e4567-e89b-12d3-a456-426614174000',
'allow_multiple' => true,
'ivr_config' => [
'enabled' => true,
'voice' => 'Polly.Aditi',
'welcome_message' => 'Welcome to Acme Corp.',
'timeout' => 7,
'max_retries' => 2,
'steps' => [
[
'step_id' => '<string>',
'prompt' => '<string>',
'field_name' => '<string>',
'options' => [
[
]
],
'next_step' => '<string>',
'conditional_next' => [
]
]
],
'default_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
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.bolna.ai/inbound/setup"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"phone_number_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"allow_multiple\": true,\n \"ivr_config\": {\n \"enabled\": true,\n \"voice\": \"Polly.Aditi\",\n \"welcome_message\": \"Welcome to Acme Corp.\",\n \"timeout\": 7,\n \"max_retries\": 2,\n \"steps\": [\n {\n \"step_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"field_name\": \"<string>\",\n \"options\": [\n {}\n ],\n \"next_step\": \"<string>\",\n \"conditional_next\": {}\n }\n ],\n \"default_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\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.bolna.ai/inbound/setup")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"phone_number_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"allow_multiple\": true,\n \"ivr_config\": {\n \"enabled\": true,\n \"voice\": \"Polly.Aditi\",\n \"welcome_message\": \"Welcome to Acme Corp.\",\n \"timeout\": 7,\n \"max_retries\": 2,\n \"steps\": [\n {\n \"step_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"field_name\": \"<string>\",\n \"options\": [\n {}\n ],\n \"next_step\": \"<string>\",\n \"conditional_next\": {}\n }\n ],\n \"default_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bolna.ai/inbound/setup")
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 \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"phone_number_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"allow_multiple\": true,\n \"ivr_config\": {\n \"enabled\": true,\n \"voice\": \"Polly.Aditi\",\n \"welcome_message\": \"Welcome to Acme Corp.\",\n \"timeout\": 7,\n \"max_retries\": 2,\n \"steps\": [\n {\n \"step_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"field_name\": \"<string>\",\n \"options\": [\n {}\n ],\n \"next_step\": \"<string>\",\n \"conditional_next\": {}\n }\n ],\n \"default_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}"
response = http.request(request)
puts response.read_body{
"url": "https://api.bolna.ai/inbound_call?agent_id=3c90c3cc-0d44-4b50-8888-8dd25736052a&user_id=28f9c34b-8eb0-4af5-8689-c2f6c4daec22",
"phone_number": "+19876543210",
"id": "3c90c3cc0d444b5088888dd25736052a"
}{
"error": 123,
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Agent id which will handle inbound calls. Used as default if no IVR option-level agent is set.
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
Telephone number id from Phone number list API
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"123e4567-e89b-12d3-a456-426614174000"
Allow this phone number to be linked to multiple phone numbers for the same agent. Only applicable for Plivo phone numbers.
true
Optional IVR configuration for Plivo phone numbers. See IVR documentation for details.
Show child attributes
Show child attributes
Response
providers status response
Message displaying the voice URL
"https://api.bolna.ai/inbound_call?agent_id=3c90c3cc-0d44-4b50-8888-8dd25736052a&user_id=28f9c34b-8eb0-4af5-8689-c2f6c4daec22"
The ID of the phone number
^[0-9a-fA-F]{32}$"3c90c3cc0d444b5088888dd25736052a"
Was this page helpful?
curl --request POST \
--url https://api.bolna.ai/inbound/setup \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number_id": "123e4567-e89b-12d3-a456-426614174000",
"allow_multiple": true,
"ivr_config": {
"enabled": true,
"voice": "Polly.Aditi",
"welcome_message": "Welcome to Acme Corp.",
"timeout": 7,
"max_retries": 2,
"steps": [
{
"step_id": "<string>",
"prompt": "<string>",
"field_name": "<string>",
"options": [
{}
],
"next_step": "<string>",
"conditional_next": {}
}
],
"default_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
'import requests
url = "https://api.bolna.ai/inbound/setup"
payload = {
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"phone_number_id": "123e4567-e89b-12d3-a456-426614174000",
"allow_multiple": True,
"ivr_config": {
"enabled": True,
"voice": "Polly.Aditi",
"welcome_message": "Welcome to Acme Corp.",
"timeout": 7,
"max_retries": 2,
"steps": [
{
"step_id": "<string>",
"prompt": "<string>",
"field_name": "<string>",
"options": [{}],
"next_step": "<string>",
"conditional_next": {}
}
],
"default_agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}
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({
agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
phone_number_id: '123e4567-e89b-12d3-a456-426614174000',
allow_multiple: true,
ivr_config: {
enabled: true,
voice: 'Polly.Aditi',
welcome_message: 'Welcome to Acme Corp.',
timeout: 7,
max_retries: 2,
steps: [
{
step_id: '<string>',
prompt: '<string>',
field_name: '<string>',
options: [{}],
next_step: '<string>',
conditional_next: {}
}
],
default_agent_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
})
};
fetch('https://api.bolna.ai/inbound/setup', 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.bolna.ai/inbound/setup",
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([
'agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'phone_number_id' => '123e4567-e89b-12d3-a456-426614174000',
'allow_multiple' => true,
'ivr_config' => [
'enabled' => true,
'voice' => 'Polly.Aditi',
'welcome_message' => 'Welcome to Acme Corp.',
'timeout' => 7,
'max_retries' => 2,
'steps' => [
[
'step_id' => '<string>',
'prompt' => '<string>',
'field_name' => '<string>',
'options' => [
[
]
],
'next_step' => '<string>',
'conditional_next' => [
]
]
],
'default_agent_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]),
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.bolna.ai/inbound/setup"
payload := strings.NewReader("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"phone_number_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"allow_multiple\": true,\n \"ivr_config\": {\n \"enabled\": true,\n \"voice\": \"Polly.Aditi\",\n \"welcome_message\": \"Welcome to Acme Corp.\",\n \"timeout\": 7,\n \"max_retries\": 2,\n \"steps\": [\n {\n \"step_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"field_name\": \"<string>\",\n \"options\": [\n {}\n ],\n \"next_step\": \"<string>\",\n \"conditional_next\": {}\n }\n ],\n \"default_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\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.bolna.ai/inbound/setup")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"phone_number_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"allow_multiple\": true,\n \"ivr_config\": {\n \"enabled\": true,\n \"voice\": \"Polly.Aditi\",\n \"welcome_message\": \"Welcome to Acme Corp.\",\n \"timeout\": 7,\n \"max_retries\": 2,\n \"steps\": [\n {\n \"step_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"field_name\": \"<string>\",\n \"options\": [\n {}\n ],\n \"next_step\": \"<string>\",\n \"conditional_next\": {}\n }\n ],\n \"default_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bolna.ai/inbound/setup")
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 \"agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"phone_number_id\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"allow_multiple\": true,\n \"ivr_config\": {\n \"enabled\": true,\n \"voice\": \"Polly.Aditi\",\n \"welcome_message\": \"Welcome to Acme Corp.\",\n \"timeout\": 7,\n \"max_retries\": 2,\n \"steps\": [\n {\n \"step_id\": \"<string>\",\n \"prompt\": \"<string>\",\n \"field_name\": \"<string>\",\n \"options\": [\n {}\n ],\n \"next_step\": \"<string>\",\n \"conditional_next\": {}\n }\n ],\n \"default_agent_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n}"
response = http.request(request)
puts response.read_body{
"url": "https://api.bolna.ai/inbound_call?agent_id=3c90c3cc-0d44-4b50-8888-8dd25736052a&user_id=28f9c34b-8eb0-4af5-8689-c2f6c4daec22",
"phone_number": "+19876543210",
"id": "3c90c3cc0d444b5088888dd25736052a"
}{
"error": 123,
"message": "<string>"
}
