API Documentation
Current APIs
- Agent
- Making phone calls
- Executions & calls data
- Phone numbers
- Inbound Agents
- Batches
- Knowledgebases
- Providers
- Voice
- User
Legacy APIs (deprecated)
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
Copy
curl --request POST \
--url https://api.bolna.ai/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"agent_config": {
"agent_name": "Alfred",
"agent_welcome_message": "How are you doing Bruce?",
"webhook_url": "https://my-webhook-url",
"agent_type": "other",
"tasks": [
{
"task_type": "conversation",
"tools_config": {
"llm_agent": {
"model": "gpt-3.5-turbo",
"max_tokens": 100,
"agent_flow_type": "streaming",
"family": "openai",
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"temperature": 0.1,
"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
}
]
}
},
"synthesizer": {
"provider": "polly",
"provider_config": {
"voice": "Matthew",
"engine": "generative",
"sampling_rate": "8000",
"language": "en-US"
},
"stream": true,
"buffer_size": 150,
"audio_format": "wav"
},
"transcriber": {
"provider": "deepgram",
"model": "nova-2",
"language": "en",
"stream": true,
"sampling_rate": 16000,
"encoding": "linear16",
"endpointing": 100
},
"input": {
"provider": "twilio",
"format": "wav"
},
"output": {
"provider": "twilio",
"format": "wav"
},
"api_tools": null
},
"toolchain": {
"execution": "parallel",
"pipelines": [
[
"transcriber",
"llm",
"synthesizer"
]
]
},
"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": false,
"ambient_noise_track": "office-ambience",
"call_terminate": 90
}
}
]
},
"agent_prompts": {
"task_1": {
"system_prompt": "What is the Ultimate Question of Life, the Universe, and Everything?"
}
}
}'
Copy
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "created"
}
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
The body is of type object
.
Response
200
application/json
agent status response
The response is of type object
.
Copy
curl --request POST \
--url https://api.bolna.ai/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"agent_config": {
"agent_name": "Alfred",
"agent_welcome_message": "How are you doing Bruce?",
"webhook_url": "https://my-webhook-url",
"agent_type": "other",
"tasks": [
{
"task_type": "conversation",
"tools_config": {
"llm_agent": {
"model": "gpt-3.5-turbo",
"max_tokens": 100,
"agent_flow_type": "streaming",
"family": "openai",
"provider": "openai",
"base_url": "https://api.openai.com/v1",
"temperature": 0.1,
"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
}
]
}
},
"synthesizer": {
"provider": "polly",
"provider_config": {
"voice": "Matthew",
"engine": "generative",
"sampling_rate": "8000",
"language": "en-US"
},
"stream": true,
"buffer_size": 150,
"audio_format": "wav"
},
"transcriber": {
"provider": "deepgram",
"model": "nova-2",
"language": "en",
"stream": true,
"sampling_rate": 16000,
"encoding": "linear16",
"endpointing": 100
},
"input": {
"provider": "twilio",
"format": "wav"
},
"output": {
"provider": "twilio",
"format": "wav"
},
"api_tools": null
},
"toolchain": {
"execution": "parallel",
"pipelines": [
[
"transcriber",
"llm",
"synthesizer"
]
]
},
"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": false,
"ambient_noise_track": "office-ambience",
"call_terminate": 90
}
}
]
},
"agent_prompts": {
"task_1": {
"system_prompt": "What is the Ultimate Question of Life, the Universe, and Everything?"
}
}
}'
Copy
{
"agent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "created"
}
Assistant
Responses are generated using AI and may contain mistakes.