Create an agent
curl --request POST \
--url https://api.openmic.ai/v2/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support Agent",
"prompt": "You are a friendly customer support agent for Acme Corp.",
"first_message": "Hello! How can I help you today?",
"voice_provider": "ElevenLabs",
"voice": "rachel",
"llm_model_name": "gpt-4o",
"call_settings": {
"max_call_duration": 10,
"call_recording_enabled": true
},
"advanced_settings": {
"agent_personality": "friendly",
"allow_interruptions": true
}
}
'import requests
url = "https://api.openmic.ai/v2/agents"
payload = {
"name": "Support Agent",
"prompt": "You are a friendly customer support agent for Acme Corp.",
"first_message": "Hello! How can I help you today?",
"voice_provider": "ElevenLabs",
"voice": "rachel",
"llm_model_name": "gpt-4o",
"call_settings": {
"max_call_duration": 10,
"call_recording_enabled": True
},
"advanced_settings": {
"agent_personality": "friendly",
"allow_interruptions": True
}
}
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({
name: 'Support Agent',
prompt: 'You are a friendly customer support agent for Acme Corp.',
first_message: 'Hello! How can I help you today?',
voice_provider: 'ElevenLabs',
voice: 'rachel',
llm_model_name: 'gpt-4o',
call_settings: {max_call_duration: 10, call_recording_enabled: true},
advanced_settings: {agent_personality: 'friendly', allow_interruptions: true}
})
};
fetch('https://api.openmic.ai/v2/agents', 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.openmic.ai/v2/agents",
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([
'name' => 'Support Agent',
'prompt' => 'You are a friendly customer support agent for Acme Corp.',
'first_message' => 'Hello! How can I help you today?',
'voice_provider' => 'ElevenLabs',
'voice' => 'rachel',
'llm_model_name' => 'gpt-4o',
'call_settings' => [
'max_call_duration' => 10,
'call_recording_enabled' => true
],
'advanced_settings' => [
'agent_personality' => 'friendly',
'allow_interruptions' => true
]
]),
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.openmic.ai/v2/agents"
payload := strings.NewReader("{\n \"name\": \"Support Agent\",\n \"prompt\": \"You are a friendly customer support agent for Acme Corp.\",\n \"first_message\": \"Hello! How can I help you today?\",\n \"voice_provider\": \"ElevenLabs\",\n \"voice\": \"rachel\",\n \"llm_model_name\": \"gpt-4o\",\n \"call_settings\": {\n \"max_call_duration\": 10,\n \"call_recording_enabled\": true\n },\n \"advanced_settings\": {\n \"agent_personality\": \"friendly\",\n \"allow_interruptions\": true\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.openmic.ai/v2/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support Agent\",\n \"prompt\": \"You are a friendly customer support agent for Acme Corp.\",\n \"first_message\": \"Hello! How can I help you today?\",\n \"voice_provider\": \"ElevenLabs\",\n \"voice\": \"rachel\",\n \"llm_model_name\": \"gpt-4o\",\n \"call_settings\": {\n \"max_call_duration\": 10,\n \"call_recording_enabled\": true\n },\n \"advanced_settings\": {\n \"agent_personality\": \"friendly\",\n \"allow_interruptions\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmic.ai/v2/agents")
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 \"name\": \"Support Agent\",\n \"prompt\": \"You are a friendly customer support agent for Acme Corp.\",\n \"first_message\": \"Hello! How can I help you today?\",\n \"voice_provider\": \"ElevenLabs\",\n \"voice\": \"rachel\",\n \"llm_model_name\": \"gpt-4o\",\n \"call_settings\": {\n \"max_call_duration\": 10,\n \"call_recording_enabled\": true\n },\n \"advanced_settings\": {\n \"agent_personality\": \"friendly\",\n \"allow_interruptions\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"uid": "<string>",
"name": "<string>",
"prompt": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"first_message": "<string>",
"auto_first_message": true,
"knowledge_base_id": 123,
"voice": "<string>",
"voice_model": "<string>",
"voice_speed": 123,
"llm_model_name": "<string>",
"llm_model_temperature": 1,
"llm_max_tokens": 123,
"stt_provider": "Deepgram",
"stt_model": "<string>",
"auto_end_call": true,
"call_settings": {
"max_call_duration": 16,
"silence_timeout": 25,
"silence_timeout_max_retries": 3,
"silence_timeout_message": "<string>",
"call_recording_enabled": true,
"voicemail_detection_enabled": true,
"voicemail_message": "<string>",
"voicemail_post_detection_delay": 15,
"hipaa_compliance_enabled": true,
"pci_compliance_enabled": true
},
"advanced_settings": {
"humanize_conversation": true,
"background_noise_reduction": true,
"allow_interruptions": true,
"min_interruption_duration": 2.6,
"background_sound": "<string>",
"short_pause": 1.1,
"long_pause": 3.25,
"filter_phrases": "<string>"
},
"boosted_keywords": [
"<string>"
],
"selected_jargons": [
"<string>"
],
"post_call_settings": {
"summary_prompt": "<string>",
"success_evaluation_prompt": "<string>",
"structured_extraction_prompt": "<string>",
"structured_extraction_json_schema": {}
}
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"success": true,
"message": "<string>",
"error": "<string>",
"retryAfter": 123
}{
"error": "<string>",
"details": "<string>"
}Agents
Create an agent
Creates a new voice AI agent.
Note:
first_messageandauto_first_messageare mutually exclusive. Providing both returns a400error.
POST
/
v2
/
agents
Create an agent
curl --request POST \
--url https://api.openmic.ai/v2/agents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Support Agent",
"prompt": "You are a friendly customer support agent for Acme Corp.",
"first_message": "Hello! How can I help you today?",
"voice_provider": "ElevenLabs",
"voice": "rachel",
"llm_model_name": "gpt-4o",
"call_settings": {
"max_call_duration": 10,
"call_recording_enabled": true
},
"advanced_settings": {
"agent_personality": "friendly",
"allow_interruptions": true
}
}
'import requests
url = "https://api.openmic.ai/v2/agents"
payload = {
"name": "Support Agent",
"prompt": "You are a friendly customer support agent for Acme Corp.",
"first_message": "Hello! How can I help you today?",
"voice_provider": "ElevenLabs",
"voice": "rachel",
"llm_model_name": "gpt-4o",
"call_settings": {
"max_call_duration": 10,
"call_recording_enabled": True
},
"advanced_settings": {
"agent_personality": "friendly",
"allow_interruptions": True
}
}
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({
name: 'Support Agent',
prompt: 'You are a friendly customer support agent for Acme Corp.',
first_message: 'Hello! How can I help you today?',
voice_provider: 'ElevenLabs',
voice: 'rachel',
llm_model_name: 'gpt-4o',
call_settings: {max_call_duration: 10, call_recording_enabled: true},
advanced_settings: {agent_personality: 'friendly', allow_interruptions: true}
})
};
fetch('https://api.openmic.ai/v2/agents', 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.openmic.ai/v2/agents",
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([
'name' => 'Support Agent',
'prompt' => 'You are a friendly customer support agent for Acme Corp.',
'first_message' => 'Hello! How can I help you today?',
'voice_provider' => 'ElevenLabs',
'voice' => 'rachel',
'llm_model_name' => 'gpt-4o',
'call_settings' => [
'max_call_duration' => 10,
'call_recording_enabled' => true
],
'advanced_settings' => [
'agent_personality' => 'friendly',
'allow_interruptions' => true
]
]),
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.openmic.ai/v2/agents"
payload := strings.NewReader("{\n \"name\": \"Support Agent\",\n \"prompt\": \"You are a friendly customer support agent for Acme Corp.\",\n \"first_message\": \"Hello! How can I help you today?\",\n \"voice_provider\": \"ElevenLabs\",\n \"voice\": \"rachel\",\n \"llm_model_name\": \"gpt-4o\",\n \"call_settings\": {\n \"max_call_duration\": 10,\n \"call_recording_enabled\": true\n },\n \"advanced_settings\": {\n \"agent_personality\": \"friendly\",\n \"allow_interruptions\": true\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.openmic.ai/v2/agents")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Support Agent\",\n \"prompt\": \"You are a friendly customer support agent for Acme Corp.\",\n \"first_message\": \"Hello! How can I help you today?\",\n \"voice_provider\": \"ElevenLabs\",\n \"voice\": \"rachel\",\n \"llm_model_name\": \"gpt-4o\",\n \"call_settings\": {\n \"max_call_duration\": 10,\n \"call_recording_enabled\": true\n },\n \"advanced_settings\": {\n \"agent_personality\": \"friendly\",\n \"allow_interruptions\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.openmic.ai/v2/agents")
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 \"name\": \"Support Agent\",\n \"prompt\": \"You are a friendly customer support agent for Acme Corp.\",\n \"first_message\": \"Hello! How can I help you today?\",\n \"voice_provider\": \"ElevenLabs\",\n \"voice\": \"rachel\",\n \"llm_model_name\": \"gpt-4o\",\n \"call_settings\": {\n \"max_call_duration\": 10,\n \"call_recording_enabled\": true\n },\n \"advanced_settings\": {\n \"agent_personality\": \"friendly\",\n \"allow_interruptions\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"uid": "<string>",
"name": "<string>",
"prompt": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"first_message": "<string>",
"auto_first_message": true,
"knowledge_base_id": 123,
"voice": "<string>",
"voice_model": "<string>",
"voice_speed": 123,
"llm_model_name": "<string>",
"llm_model_temperature": 1,
"llm_max_tokens": 123,
"stt_provider": "Deepgram",
"stt_model": "<string>",
"auto_end_call": true,
"call_settings": {
"max_call_duration": 16,
"silence_timeout": 25,
"silence_timeout_max_retries": 3,
"silence_timeout_message": "<string>",
"call_recording_enabled": true,
"voicemail_detection_enabled": true,
"voicemail_message": "<string>",
"voicemail_post_detection_delay": 15,
"hipaa_compliance_enabled": true,
"pci_compliance_enabled": true
},
"advanced_settings": {
"humanize_conversation": true,
"background_noise_reduction": true,
"allow_interruptions": true,
"min_interruption_duration": 2.6,
"background_sound": "<string>",
"short_pause": 1.1,
"long_pause": 3.25,
"filter_phrases": "<string>"
},
"boosted_keywords": [
"<string>"
],
"selected_jargons": [
"<string>"
],
"post_call_settings": {
"summary_prompt": "<string>",
"success_evaluation_prompt": "<string>",
"structured_extraction_prompt": "<string>",
"structured_extraction_json_schema": {}
}
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"error": "<string>",
"details": "<string>"
}{
"success": true,
"message": "<string>",
"error": "<string>",
"retryAfter": 123
}{
"error": "<string>",
"details": "<string>"
}Authorizations
API key obtained from the OpenMic dashboard.
Body
application/json
Required string length:
1 - 255Minimum string length:
1Cannot be combined with auto_first_message: true.
Cannot be combined with first_message.
Available options:
OpenAI, ElevenLabs, Deepgram, Cartesia Required range:
0 <= x <= 2Available options:
Deepgram Show child attributes
Show child attributes
Show child attributes
Show child attributes
Maximum array length:
30Show child attributes
Show child attributes
Response
Agent created.
Unique agent identifier (slug/UUID).
Available options:
OpenAI, ElevenLabs, Deepgram, Cartesia Required range:
0 <= x <= 2Available options:
Deepgram Show child attributes
Show child attributes
Show child attributes
Show child attributes
Maximum array length:
30Show child attributes
Show child attributes
Was this page helpful?
⌘I