Agent v1.0 APIs
Create Voice AI Agent API (deprecated)
Learn how to create new agents with Bolna APIs, enabling customized tasks, prompts, and configurations for Bolna voice AI agents.
POST
/
agent
cURL
curl --request POST \
--url https://api.bolna.ai/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_config": {
"agent_name": "Alfred",
"tasks": [
{
"tools_config": {
"llm_agent": {
"model": "gpt-4.1-mini",
"max_tokens": 350,
"agent_flow_type": "streaming",
"family": "openai",
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"temperature": 0.3,
"request_json": false,
"routes": {
"embedding_model": "snowflake/snowflake-arctic-embed-m",
"routes": [
{
"route_name": "politics",
"utterances": [
"Who do you think will win the elections?",
"Whom would you vote for?"
],
"response": "Hey, thanks but I do not have opinions on politics",
"score_threshold": 0.9
}
]
}
},
"transcriber": {
"provider": "deepgram",
"model": "nova-3",
"language": "hi",
"stream": true,
"sampling_rate": 16000,
"encoding": "linear16",
"endpointing": 250
},
"api_tools": null
},
"task_config": {
"hangup_after_silence": 10,
"incremental_delay": 400,
"number_of_words_for_interruption": 2,
"hangup_after_LLMCall": false,
"call_cancellation_prompt": null,
"backchanneling": false,
"backchanneling_message_gap": 5,
"backchanneling_start_delay": 5,
"ambient_noise_track": "coffee-shop",
"call_terminate": 90,
"voicemail": false,
"inbound_limit": -1,
"whitelist_phone_numbers": null,
"disallow_unknown_numbers": false
}
}
],
"agent_welcome_message": "How are you doing Bruce?",
"webhook_url": "https://my-webhook-url",
"agent_type": "other"
},
"agent_prompts": {}
}
'import requests
url = "https://api.bolna.ai/agent"
payload = {
"agent_config": {
"agent_name": "Alfred",
"tasks": [
{
"tools_config": {
"llm_agent": {
"model": "gpt-4.1-mini",
"max_tokens": 350,
"agent_flow_type": "streaming",
"family": "openai",
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"temperature": 0.3,
"request_json": False,
"routes": {
"embedding_model": "snowflake/snowflake-arctic-embed-m",
"routes": [
{
"route_name": "politics",
"utterances": ["Who do you think will win the elections?", "Whom would you vote for?"],
"response": "Hey, thanks but I do not have opinions on politics",
"score_threshold": 0.9
}
]
}
},
"transcriber": {
"provider": "deepgram",
"model": "nova-3",
"language": "hi",
"stream": True,
"sampling_rate": 16000,
"encoding": "linear16",
"endpointing": 250
},
"api_tools": None
},
"task_config": {
"hangup_after_silence": 10,
"incremental_delay": 400,
"number_of_words_for_interruption": 2,
"hangup_after_LLMCall": False,
"call_cancellation_prompt": None,
"backchanneling": False,
"backchanneling_message_gap": 5,
"backchanneling_start_delay": 5,
"ambient_noise_track": "coffee-shop",
"call_terminate": 90,
"voicemail": False,
"inbound_limit": -1,
"whitelist_phone_numbers": None,
"disallow_unknown_numbers": False
}
}
],
"agent_welcome_message": "How are you doing Bruce?",
"webhook_url": "https://my-webhook-url",
"agent_type": "other"
},
"agent_prompts": {}
}
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_config: {
agent_name: 'Alfred',
tasks: [
{
tools_config: {
llm_agent: {
model: 'gpt-4.1-mini',
max_tokens: 350,
agent_flow_type: 'streaming',
family: 'openai',
provider: 'openai',
base_url: 'https://api.openai.com/v1',
temperature: 0.3,
request_json: false,
routes: {
embedding_model: 'snowflake/snowflake-arctic-embed-m',
routes: [
{
route_name: 'politics',
utterances: ['Who do you think will win the elections?', 'Whom would you vote for?'],
response: 'Hey, thanks but I do not have opinions on politics',
score_threshold: 0.9
}
]
}
},
transcriber: {
provider: 'deepgram',
model: 'nova-3',
language: 'hi',
stream: true,
sampling_rate: 16000,
encoding: 'linear16',
endpointing: 250
},
api_tools: null
},
task_config: {
hangup_after_silence: 10,
incremental_delay: 400,
number_of_words_for_interruption: 2,
hangup_after_LLMCall: false,
call_cancellation_prompt: null,
backchanneling: false,
backchanneling_message_gap: 5,
backchanneling_start_delay: 5,
ambient_noise_track: 'coffee-shop',
call_terminate: 90,
voicemail: false,
inbound_limit: -1,
whitelist_phone_numbers: null,
disallow_unknown_numbers: false
}
}
],
agent_welcome_message: 'How are you doing Bruce?',
webhook_url: 'https://my-webhook-url',
agent_type: 'other'
},
agent_prompts: {}
})
};
fetch('https://api.bolna.ai/agent', 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/agent",
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_config' => [
'agent_name' => 'Alfred',
'tasks' => [
[
'tools_config' => [
'llm_agent' => [
'model' => 'gpt-4.1-mini',
'max_tokens' => 350,
'agent_flow_type' => 'streaming',
'family' => 'openai',
'provider' => 'openai',
'base_url' => 'https://api.openai.com/v1',
'temperature' => 0.3,
'request_json' => false,
'routes' => [
'embedding_model' => 'snowflake/snowflake-arctic-embed-m',
'routes' => [
[
'route_name' => 'politics',
'utterances' => [
'Who do you think will win the elections?',
'Whom would you vote for?'
],
'response' => 'Hey, thanks but I do not have opinions on politics',
'score_threshold' => 0.9
]
]
]
],
'transcriber' => [
'provider' => 'deepgram',
'model' => 'nova-3',
'language' => 'hi',
'stream' => true,
'sampling_rate' => 16000,
'encoding' => 'linear16',
'endpointing' => 250
],
'api_tools' => null
],
'task_config' => [
'hangup_after_silence' => 10,
'incremental_delay' => 400,
'number_of_words_for_interruption' => 2,
'hangup_after_LLMCall' => false,
'call_cancellation_prompt' => null,
'backchanneling' => false,
'backchanneling_message_gap' => 5,
'backchanneling_start_delay' => 5,
'ambient_noise_track' => 'coffee-shop',
'call_terminate' => 90,
'voicemail' => false,
'inbound_limit' => -1,
'whitelist_phone_numbers' => null,
'disallow_unknown_numbers' => false
]
]
],
'agent_welcome_message' => 'How are you doing Bruce?',
'webhook_url' => 'https://my-webhook-url',
'agent_type' => 'other'
],
'agent_prompts' => [
]
]),
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/agent"
payload := strings.NewReader("{\n \"agent_config\": {\n \"agent_name\": \"Alfred\",\n \"tasks\": [\n {\n \"tools_config\": {\n \"llm_agent\": {\n \"model\": \"gpt-4.1-mini\",\n \"max_tokens\": 350,\n \"agent_flow_type\": \"streaming\",\n \"family\": \"openai\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"temperature\": 0.3,\n \"request_json\": false,\n \"routes\": {\n \"embedding_model\": \"snowflake/snowflake-arctic-embed-m\",\n \"routes\": [\n {\n \"route_name\": \"politics\",\n \"utterances\": [\n \"Who do you think will win the elections?\",\n \"Whom would you vote for?\"\n ],\n \"response\": \"Hey, thanks but I do not have opinions on politics\",\n \"score_threshold\": 0.9\n }\n ]\n }\n },\n \"transcriber\": {\n \"provider\": \"deepgram\",\n \"model\": \"nova-3\",\n \"language\": \"hi\",\n \"stream\": true,\n \"sampling_rate\": 16000,\n \"encoding\": \"linear16\",\n \"endpointing\": 250\n },\n \"api_tools\": null\n },\n \"task_config\": {\n \"hangup_after_silence\": 10,\n \"incremental_delay\": 400,\n \"number_of_words_for_interruption\": 2,\n \"hangup_after_LLMCall\": false,\n \"call_cancellation_prompt\": null,\n \"backchanneling\": false,\n \"backchanneling_message_gap\": 5,\n \"backchanneling_start_delay\": 5,\n \"ambient_noise_track\": \"coffee-shop\",\n \"call_terminate\": 90,\n \"voicemail\": false,\n \"inbound_limit\": -1,\n \"whitelist_phone_numbers\": null,\n \"disallow_unknown_numbers\": false\n }\n }\n ],\n \"agent_welcome_message\": \"How are you doing Bruce?\",\n \"webhook_url\": \"https://my-webhook-url\",\n \"agent_type\": \"other\"\n },\n \"agent_prompts\": {}\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/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_config\": {\n \"agent_name\": \"Alfred\",\n \"tasks\": [\n {\n \"tools_config\": {\n \"llm_agent\": {\n \"model\": \"gpt-4.1-mini\",\n \"max_tokens\": 350,\n \"agent_flow_type\": \"streaming\",\n \"family\": \"openai\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"temperature\": 0.3,\n \"request_json\": false,\n \"routes\": {\n \"embedding_model\": \"snowflake/snowflake-arctic-embed-m\",\n \"routes\": [\n {\n \"route_name\": \"politics\",\n \"utterances\": [\n \"Who do you think will win the elections?\",\n \"Whom would you vote for?\"\n ],\n \"response\": \"Hey, thanks but I do not have opinions on politics\",\n \"score_threshold\": 0.9\n }\n ]\n }\n },\n \"transcriber\": {\n \"provider\": \"deepgram\",\n \"model\": \"nova-3\",\n \"language\": \"hi\",\n \"stream\": true,\n \"sampling_rate\": 16000,\n \"encoding\": \"linear16\",\n \"endpointing\": 250\n },\n \"api_tools\": null\n },\n \"task_config\": {\n \"hangup_after_silence\": 10,\n \"incremental_delay\": 400,\n \"number_of_words_for_interruption\": 2,\n \"hangup_after_LLMCall\": false,\n \"call_cancellation_prompt\": null,\n \"backchanneling\": false,\n \"backchanneling_message_gap\": 5,\n \"backchanneling_start_delay\": 5,\n \"ambient_noise_track\": \"coffee-shop\",\n \"call_terminate\": 90,\n \"voicemail\": false,\n \"inbound_limit\": -1,\n \"whitelist_phone_numbers\": null,\n \"disallow_unknown_numbers\": false\n }\n }\n ],\n \"agent_welcome_message\": \"How are you doing Bruce?\",\n \"webhook_url\": \"https://my-webhook-url\",\n \"agent_type\": \"other\"\n },\n \"agent_prompts\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bolna.ai/agent")
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_config\": {\n \"agent_name\": \"Alfred\",\n \"tasks\": [\n {\n \"tools_config\": {\n \"llm_agent\": {\n \"model\": \"gpt-4.1-mini\",\n \"max_tokens\": 350,\n \"agent_flow_type\": \"streaming\",\n \"family\": \"openai\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"temperature\": 0.3,\n \"request_json\": false,\n \"routes\": {\n \"embedding_model\": \"snowflake/snowflake-arctic-embed-m\",\n \"routes\": [\n {\n \"route_name\": \"politics\",\n \"utterances\": [\n \"Who do you think will win the elections?\",\n \"Whom would you vote for?\"\n ],\n \"response\": \"Hey, thanks but I do not have opinions on politics\",\n \"score_threshold\": 0.9\n }\n ]\n }\n },\n \"transcriber\": {\n \"provider\": \"deepgram\",\n \"model\": \"nova-3\",\n \"language\": \"hi\",\n \"stream\": true,\n \"sampling_rate\": 16000,\n \"encoding\": \"linear16\",\n \"endpointing\": 250\n },\n \"api_tools\": null\n },\n \"task_config\": {\n \"hangup_after_silence\": 10,\n \"incremental_delay\": 400,\n \"number_of_words_for_interruption\": 2,\n \"hangup_after_LLMCall\": false,\n \"call_cancellation_prompt\": null,\n \"backchanneling\": false,\n \"backchanneling_message_gap\": 5,\n \"backchanneling_start_delay\": 5,\n \"ambient_noise_track\": \"coffee-shop\",\n \"call_terminate\": 90,\n \"voicemail\": false,\n \"inbound_limit\": -1,\n \"whitelist_phone_numbers\": null,\n \"disallow_unknown_numbers\": false\n }\n }\n ],\n \"agent_welcome_message\": \"How are you doing Bruce?\",\n \"webhook_url\": \"https://my-webhook-url\",\n \"agent_type\": \"other\"\n },\n \"agent_prompts\": {}\n}"
response = http.request(request)
puts response.read_body{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "created"
}{
"error": 123,
"message": "<string>"
}These APIs have now been deprecated.Please use the latest v2 APIs.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Creates a new agent
Was this page helpful?
Previous
Get agentRetrieve detailed Voice AI agent information, including configuration, status, and tasks, using Bolna APIs.
Next
⌘I
cURL
curl --request POST \
--url https://api.bolna.ai/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_config": {
"agent_name": "Alfred",
"tasks": [
{
"tools_config": {
"llm_agent": {
"model": "gpt-4.1-mini",
"max_tokens": 350,
"agent_flow_type": "streaming",
"family": "openai",
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"temperature": 0.3,
"request_json": false,
"routes": {
"embedding_model": "snowflake/snowflake-arctic-embed-m",
"routes": [
{
"route_name": "politics",
"utterances": [
"Who do you think will win the elections?",
"Whom would you vote for?"
],
"response": "Hey, thanks but I do not have opinions on politics",
"score_threshold": 0.9
}
]
}
},
"transcriber": {
"provider": "deepgram",
"model": "nova-3",
"language": "hi",
"stream": true,
"sampling_rate": 16000,
"encoding": "linear16",
"endpointing": 250
},
"api_tools": null
},
"task_config": {
"hangup_after_silence": 10,
"incremental_delay": 400,
"number_of_words_for_interruption": 2,
"hangup_after_LLMCall": false,
"call_cancellation_prompt": null,
"backchanneling": false,
"backchanneling_message_gap": 5,
"backchanneling_start_delay": 5,
"ambient_noise_track": "coffee-shop",
"call_terminate": 90,
"voicemail": false,
"inbound_limit": -1,
"whitelist_phone_numbers": null,
"disallow_unknown_numbers": false
}
}
],
"agent_welcome_message": "How are you doing Bruce?",
"webhook_url": "https://my-webhook-url",
"agent_type": "other"
},
"agent_prompts": {}
}
'import requests
url = "https://api.bolna.ai/agent"
payload = {
"agent_config": {
"agent_name": "Alfred",
"tasks": [
{
"tools_config": {
"llm_agent": {
"model": "gpt-4.1-mini",
"max_tokens": 350,
"agent_flow_type": "streaming",
"family": "openai",
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"temperature": 0.3,
"request_json": False,
"routes": {
"embedding_model": "snowflake/snowflake-arctic-embed-m",
"routes": [
{
"route_name": "politics",
"utterances": ["Who do you think will win the elections?", "Whom would you vote for?"],
"response": "Hey, thanks but I do not have opinions on politics",
"score_threshold": 0.9
}
]
}
},
"transcriber": {
"provider": "deepgram",
"model": "nova-3",
"language": "hi",
"stream": True,
"sampling_rate": 16000,
"encoding": "linear16",
"endpointing": 250
},
"api_tools": None
},
"task_config": {
"hangup_after_silence": 10,
"incremental_delay": 400,
"number_of_words_for_interruption": 2,
"hangup_after_LLMCall": False,
"call_cancellation_prompt": None,
"backchanneling": False,
"backchanneling_message_gap": 5,
"backchanneling_start_delay": 5,
"ambient_noise_track": "coffee-shop",
"call_terminate": 90,
"voicemail": False,
"inbound_limit": -1,
"whitelist_phone_numbers": None,
"disallow_unknown_numbers": False
}
}
],
"agent_welcome_message": "How are you doing Bruce?",
"webhook_url": "https://my-webhook-url",
"agent_type": "other"
},
"agent_prompts": {}
}
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_config: {
agent_name: 'Alfred',
tasks: [
{
tools_config: {
llm_agent: {
model: 'gpt-4.1-mini',
max_tokens: 350,
agent_flow_type: 'streaming',
family: 'openai',
provider: 'openai',
base_url: 'https://api.openai.com/v1',
temperature: 0.3,
request_json: false,
routes: {
embedding_model: 'snowflake/snowflake-arctic-embed-m',
routes: [
{
route_name: 'politics',
utterances: ['Who do you think will win the elections?', 'Whom would you vote for?'],
response: 'Hey, thanks but I do not have opinions on politics',
score_threshold: 0.9
}
]
}
},
transcriber: {
provider: 'deepgram',
model: 'nova-3',
language: 'hi',
stream: true,
sampling_rate: 16000,
encoding: 'linear16',
endpointing: 250
},
api_tools: null
},
task_config: {
hangup_after_silence: 10,
incremental_delay: 400,
number_of_words_for_interruption: 2,
hangup_after_LLMCall: false,
call_cancellation_prompt: null,
backchanneling: false,
backchanneling_message_gap: 5,
backchanneling_start_delay: 5,
ambient_noise_track: 'coffee-shop',
call_terminate: 90,
voicemail: false,
inbound_limit: -1,
whitelist_phone_numbers: null,
disallow_unknown_numbers: false
}
}
],
agent_welcome_message: 'How are you doing Bruce?',
webhook_url: 'https://my-webhook-url',
agent_type: 'other'
},
agent_prompts: {}
})
};
fetch('https://api.bolna.ai/agent', 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/agent",
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_config' => [
'agent_name' => 'Alfred',
'tasks' => [
[
'tools_config' => [
'llm_agent' => [
'model' => 'gpt-4.1-mini',
'max_tokens' => 350,
'agent_flow_type' => 'streaming',
'family' => 'openai',
'provider' => 'openai',
'base_url' => 'https://api.openai.com/v1',
'temperature' => 0.3,
'request_json' => false,
'routes' => [
'embedding_model' => 'snowflake/snowflake-arctic-embed-m',
'routes' => [
[
'route_name' => 'politics',
'utterances' => [
'Who do you think will win the elections?',
'Whom would you vote for?'
],
'response' => 'Hey, thanks but I do not have opinions on politics',
'score_threshold' => 0.9
]
]
]
],
'transcriber' => [
'provider' => 'deepgram',
'model' => 'nova-3',
'language' => 'hi',
'stream' => true,
'sampling_rate' => 16000,
'encoding' => 'linear16',
'endpointing' => 250
],
'api_tools' => null
],
'task_config' => [
'hangup_after_silence' => 10,
'incremental_delay' => 400,
'number_of_words_for_interruption' => 2,
'hangup_after_LLMCall' => false,
'call_cancellation_prompt' => null,
'backchanneling' => false,
'backchanneling_message_gap' => 5,
'backchanneling_start_delay' => 5,
'ambient_noise_track' => 'coffee-shop',
'call_terminate' => 90,
'voicemail' => false,
'inbound_limit' => -1,
'whitelist_phone_numbers' => null,
'disallow_unknown_numbers' => false
]
]
],
'agent_welcome_message' => 'How are you doing Bruce?',
'webhook_url' => 'https://my-webhook-url',
'agent_type' => 'other'
],
'agent_prompts' => [
]
]),
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/agent"
payload := strings.NewReader("{\n \"agent_config\": {\n \"agent_name\": \"Alfred\",\n \"tasks\": [\n {\n \"tools_config\": {\n \"llm_agent\": {\n \"model\": \"gpt-4.1-mini\",\n \"max_tokens\": 350,\n \"agent_flow_type\": \"streaming\",\n \"family\": \"openai\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"temperature\": 0.3,\n \"request_json\": false,\n \"routes\": {\n \"embedding_model\": \"snowflake/snowflake-arctic-embed-m\",\n \"routes\": [\n {\n \"route_name\": \"politics\",\n \"utterances\": [\n \"Who do you think will win the elections?\",\n \"Whom would you vote for?\"\n ],\n \"response\": \"Hey, thanks but I do not have opinions on politics\",\n \"score_threshold\": 0.9\n }\n ]\n }\n },\n \"transcriber\": {\n \"provider\": \"deepgram\",\n \"model\": \"nova-3\",\n \"language\": \"hi\",\n \"stream\": true,\n \"sampling_rate\": 16000,\n \"encoding\": \"linear16\",\n \"endpointing\": 250\n },\n \"api_tools\": null\n },\n \"task_config\": {\n \"hangup_after_silence\": 10,\n \"incremental_delay\": 400,\n \"number_of_words_for_interruption\": 2,\n \"hangup_after_LLMCall\": false,\n \"call_cancellation_prompt\": null,\n \"backchanneling\": false,\n \"backchanneling_message_gap\": 5,\n \"backchanneling_start_delay\": 5,\n \"ambient_noise_track\": \"coffee-shop\",\n \"call_terminate\": 90,\n \"voicemail\": false,\n \"inbound_limit\": -1,\n \"whitelist_phone_numbers\": null,\n \"disallow_unknown_numbers\": false\n }\n }\n ],\n \"agent_welcome_message\": \"How are you doing Bruce?\",\n \"webhook_url\": \"https://my-webhook-url\",\n \"agent_type\": \"other\"\n },\n \"agent_prompts\": {}\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/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agent_config\": {\n \"agent_name\": \"Alfred\",\n \"tasks\": [\n {\n \"tools_config\": {\n \"llm_agent\": {\n \"model\": \"gpt-4.1-mini\",\n \"max_tokens\": 350,\n \"agent_flow_type\": \"streaming\",\n \"family\": \"openai\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"temperature\": 0.3,\n \"request_json\": false,\n \"routes\": {\n \"embedding_model\": \"snowflake/snowflake-arctic-embed-m\",\n \"routes\": [\n {\n \"route_name\": \"politics\",\n \"utterances\": [\n \"Who do you think will win the elections?\",\n \"Whom would you vote for?\"\n ],\n \"response\": \"Hey, thanks but I do not have opinions on politics\",\n \"score_threshold\": 0.9\n }\n ]\n }\n },\n \"transcriber\": {\n \"provider\": \"deepgram\",\n \"model\": \"nova-3\",\n \"language\": \"hi\",\n \"stream\": true,\n \"sampling_rate\": 16000,\n \"encoding\": \"linear16\",\n \"endpointing\": 250\n },\n \"api_tools\": null\n },\n \"task_config\": {\n \"hangup_after_silence\": 10,\n \"incremental_delay\": 400,\n \"number_of_words_for_interruption\": 2,\n \"hangup_after_LLMCall\": false,\n \"call_cancellation_prompt\": null,\n \"backchanneling\": false,\n \"backchanneling_message_gap\": 5,\n \"backchanneling_start_delay\": 5,\n \"ambient_noise_track\": \"coffee-shop\",\n \"call_terminate\": 90,\n \"voicemail\": false,\n \"inbound_limit\": -1,\n \"whitelist_phone_numbers\": null,\n \"disallow_unknown_numbers\": false\n }\n }\n ],\n \"agent_welcome_message\": \"How are you doing Bruce?\",\n \"webhook_url\": \"https://my-webhook-url\",\n \"agent_type\": \"other\"\n },\n \"agent_prompts\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bolna.ai/agent")
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_config\": {\n \"agent_name\": \"Alfred\",\n \"tasks\": [\n {\n \"tools_config\": {\n \"llm_agent\": {\n \"model\": \"gpt-4.1-mini\",\n \"max_tokens\": 350,\n \"agent_flow_type\": \"streaming\",\n \"family\": \"openai\",\n \"provider\": \"openai\",\n \"base_url\": \"https://api.openai.com/v1\",\n \"temperature\": 0.3,\n \"request_json\": false,\n \"routes\": {\n \"embedding_model\": \"snowflake/snowflake-arctic-embed-m\",\n \"routes\": [\n {\n \"route_name\": \"politics\",\n \"utterances\": [\n \"Who do you think will win the elections?\",\n \"Whom would you vote for?\"\n ],\n \"response\": \"Hey, thanks but I do not have opinions on politics\",\n \"score_threshold\": 0.9\n }\n ]\n }\n },\n \"transcriber\": {\n \"provider\": \"deepgram\",\n \"model\": \"nova-3\",\n \"language\": \"hi\",\n \"stream\": true,\n \"sampling_rate\": 16000,\n \"encoding\": \"linear16\",\n \"endpointing\": 250\n },\n \"api_tools\": null\n },\n \"task_config\": {\n \"hangup_after_silence\": 10,\n \"incremental_delay\": 400,\n \"number_of_words_for_interruption\": 2,\n \"hangup_after_LLMCall\": false,\n \"call_cancellation_prompt\": null,\n \"backchanneling\": false,\n \"backchanneling_message_gap\": 5,\n \"backchanneling_start_delay\": 5,\n \"ambient_noise_track\": \"coffee-shop\",\n \"call_terminate\": 90,\n \"voicemail\": false,\n \"inbound_limit\": -1,\n \"whitelist_phone_numbers\": null,\n \"disallow_unknown_numbers\": false\n }\n }\n ],\n \"agent_welcome_message\": \"How are you doing Bruce?\",\n \"webhook_url\": \"https://my-webhook-url\",\n \"agent_type\": \"other\"\n },\n \"agent_prompts\": {}\n}"
response = http.request(request)
puts response.read_body{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "created"
}{
"error": 123,
"message": "<string>"
}
