curl --request POST \
--url https://app.altheastudio.ai/api/agents/{agent_id}/calls \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"templateContext": {},
"initialMessages": [
{
"text": "<string>",
"invocationId": "<string>",
"toolName": "<string>",
"errorDetails": "<string>",
"callStageMessageIndex": 123,
"callStageId": "<string>",
"callState": {},
"timespan": {
"start": "<string>",
"end": "<string>"
},
"wallClockTimespan": {
"start": "<string>",
"end": "<string>"
}
}
],
"metadata": {},
"medium": {
"webRtc": {
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"twilio": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"serverWebSocket": {
"inputSampleRate": 123,
"outputSampleRate": 123,
"clientBufferSizeMs": 123,
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"telnyx": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"plivo": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"exotel": {},
"sip": {
"incoming": {},
"outgoing": {
"to": "<string>",
"from": "<string>",
"username": "<string>",
"password": "<string>"
}
}
},
"joinTimeout": "<string>",
"maxDuration": "<string>",
"recordingEnabled": true,
"firstSpeakerSettings": {
"user": {
"fallback": {
"delay": "<string>",
"text": "<string>",
"prompt": "<string>"
}
},
"agent": {
"uninterruptible": true,
"text": "<string>",
"prompt": "<string>",
"delay": "<string>"
}
},
"dataConnection": {
"websocketUrl": "<string>",
"audioConfig": {
"sampleRate": 123
},
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"experimentalSettings": {},
"callbacks": {
"joined": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"ended": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"billed": {
"url": "<string>",
"secrets": [
"<string>"
]
}
}
}
'import requests
url = "https://app.altheastudio.ai/api/agents/{agent_id}/calls"
payload = {
"templateContext": {},
"initialMessages": [
{
"text": "<string>",
"invocationId": "<string>",
"toolName": "<string>",
"errorDetails": "<string>",
"callStageMessageIndex": 123,
"callStageId": "<string>",
"callState": {},
"timespan": {
"start": "<string>",
"end": "<string>"
},
"wallClockTimespan": {
"start": "<string>",
"end": "<string>"
}
}
],
"metadata": {},
"medium": {
"webRtc": { "dataMessages": {
"pong": True,
"state": True,
"transcript": True,
"clientToolInvocation": True,
"dataConnectionToolInvocation": True,
"playbackClearBuffer": True,
"callStarted": True,
"debug": True,
"callEvent": True,
"toolUsed": True,
"userStartedSpeaking": True,
"userStoppedSpeaking": True
} },
"twilio": { "outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
} },
"serverWebSocket": {
"inputSampleRate": 123,
"outputSampleRate": 123,
"clientBufferSizeMs": 123,
"dataMessages": {
"pong": True,
"state": True,
"transcript": True,
"clientToolInvocation": True,
"dataConnectionToolInvocation": True,
"playbackClearBuffer": True,
"callStarted": True,
"debug": True,
"callEvent": True,
"toolUsed": True,
"userStartedSpeaking": True,
"userStoppedSpeaking": True
}
},
"telnyx": { "outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
} },
"plivo": { "outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
} },
"exotel": {},
"sip": {
"incoming": {},
"outgoing": {
"to": "<string>",
"from": "<string>",
"username": "<string>",
"password": "<string>"
}
}
},
"joinTimeout": "<string>",
"maxDuration": "<string>",
"recordingEnabled": True,
"firstSpeakerSettings": {
"user": { "fallback": {
"delay": "<string>",
"text": "<string>",
"prompt": "<string>"
} },
"agent": {
"uninterruptible": True,
"text": "<string>",
"prompt": "<string>",
"delay": "<string>"
}
},
"dataConnection": {
"websocketUrl": "<string>",
"audioConfig": { "sampleRate": 123 },
"dataMessages": {
"pong": True,
"state": True,
"transcript": True,
"clientToolInvocation": True,
"dataConnectionToolInvocation": True,
"playbackClearBuffer": True,
"callStarted": True,
"debug": True,
"callEvent": True,
"toolUsed": True,
"userStartedSpeaking": True,
"userStoppedSpeaking": True
}
},
"experimentalSettings": {},
"callbacks": {
"joined": {
"url": "<string>",
"secrets": ["<string>"]
},
"ended": {
"url": "<string>",
"secrets": ["<string>"]
},
"billed": {
"url": "<string>",
"secrets": ["<string>"]
}
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
templateContext: {},
initialMessages: [
{
text: '<string>',
invocationId: '<string>',
toolName: '<string>',
errorDetails: '<string>',
callStageMessageIndex: 123,
callStageId: '<string>',
callState: {},
timespan: {start: '<string>', end: '<string>'},
wallClockTimespan: {start: '<string>', end: '<string>'}
}
],
metadata: {},
medium: {
webRtc: {
dataMessages: {
pong: true,
state: true,
transcript: true,
clientToolInvocation: true,
dataConnectionToolInvocation: true,
playbackClearBuffer: true,
callStarted: true,
debug: true,
callEvent: true,
toolUsed: true,
userStartedSpeaking: true,
userStoppedSpeaking: true
}
},
twilio: {outgoing: {to: '<string>', from: '<string>', additionalParams: {}}},
serverWebSocket: {
inputSampleRate: 123,
outputSampleRate: 123,
clientBufferSizeMs: 123,
dataMessages: {
pong: true,
state: true,
transcript: true,
clientToolInvocation: true,
dataConnectionToolInvocation: true,
playbackClearBuffer: true,
callStarted: true,
debug: true,
callEvent: true,
toolUsed: true,
userStartedSpeaking: true,
userStoppedSpeaking: true
}
},
telnyx: {outgoing: {to: '<string>', from: '<string>', additionalParams: {}}},
plivo: {outgoing: {to: '<string>', from: '<string>', additionalParams: {}}},
exotel: {},
sip: {
incoming: {},
outgoing: {to: '<string>', from: '<string>', username: '<string>', password: '<string>'}
}
},
joinTimeout: '<string>',
maxDuration: '<string>',
recordingEnabled: true,
firstSpeakerSettings: {
user: {fallback: {delay: '<string>', text: '<string>', prompt: '<string>'}},
agent: {uninterruptible: true, text: '<string>', prompt: '<string>', delay: '<string>'}
},
dataConnection: {
websocketUrl: '<string>',
audioConfig: {sampleRate: 123},
dataMessages: {
pong: true,
state: true,
transcript: true,
clientToolInvocation: true,
dataConnectionToolInvocation: true,
playbackClearBuffer: true,
callStarted: true,
debug: true,
callEvent: true,
toolUsed: true,
userStartedSpeaking: true,
userStoppedSpeaking: true
}
},
experimentalSettings: {},
callbacks: {
joined: {url: '<string>', secrets: ['<string>']},
ended: {url: '<string>', secrets: ['<string>']},
billed: {url: '<string>', secrets: ['<string>']}
}
})
};
fetch('https://app.altheastudio.ai/api/agents/{agent_id}/calls', 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://app.altheastudio.ai/api/agents/{agent_id}/calls",
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([
'templateContext' => [
],
'initialMessages' => [
[
'text' => '<string>',
'invocationId' => '<string>',
'toolName' => '<string>',
'errorDetails' => '<string>',
'callStageMessageIndex' => 123,
'callStageId' => '<string>',
'callState' => [
],
'timespan' => [
'start' => '<string>',
'end' => '<string>'
],
'wallClockTimespan' => [
'start' => '<string>',
'end' => '<string>'
]
]
],
'metadata' => [
],
'medium' => [
'webRtc' => [
'dataMessages' => [
'pong' => true,
'state' => true,
'transcript' => true,
'clientToolInvocation' => true,
'dataConnectionToolInvocation' => true,
'playbackClearBuffer' => true,
'callStarted' => true,
'debug' => true,
'callEvent' => true,
'toolUsed' => true,
'userStartedSpeaking' => true,
'userStoppedSpeaking' => true
]
],
'twilio' => [
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'additionalParams' => [
]
]
],
'serverWebSocket' => [
'inputSampleRate' => 123,
'outputSampleRate' => 123,
'clientBufferSizeMs' => 123,
'dataMessages' => [
'pong' => true,
'state' => true,
'transcript' => true,
'clientToolInvocation' => true,
'dataConnectionToolInvocation' => true,
'playbackClearBuffer' => true,
'callStarted' => true,
'debug' => true,
'callEvent' => true,
'toolUsed' => true,
'userStartedSpeaking' => true,
'userStoppedSpeaking' => true
]
],
'telnyx' => [
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'additionalParams' => [
]
]
],
'plivo' => [
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'additionalParams' => [
]
]
],
'exotel' => [
],
'sip' => [
'incoming' => [
],
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'username' => '<string>',
'password' => '<string>'
]
]
],
'joinTimeout' => '<string>',
'maxDuration' => '<string>',
'recordingEnabled' => true,
'firstSpeakerSettings' => [
'user' => [
'fallback' => [
'delay' => '<string>',
'text' => '<string>',
'prompt' => '<string>'
]
],
'agent' => [
'uninterruptible' => true,
'text' => '<string>',
'prompt' => '<string>',
'delay' => '<string>'
]
],
'dataConnection' => [
'websocketUrl' => '<string>',
'audioConfig' => [
'sampleRate' => 123
],
'dataMessages' => [
'pong' => true,
'state' => true,
'transcript' => true,
'clientToolInvocation' => true,
'dataConnectionToolInvocation' => true,
'playbackClearBuffer' => true,
'callStarted' => true,
'debug' => true,
'callEvent' => true,
'toolUsed' => true,
'userStartedSpeaking' => true,
'userStoppedSpeaking' => true
]
],
'experimentalSettings' => [
],
'callbacks' => [
'joined' => [
'url' => '<string>',
'secrets' => [
'<string>'
]
],
'ended' => [
'url' => '<string>',
'secrets' => [
'<string>'
]
],
'billed' => [
'url' => '<string>',
'secrets' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.altheastudio.ai/api/agents/{agent_id}/calls"
payload := strings.NewReader("{\n \"templateContext\": {},\n \"initialMessages\": [\n {\n \"text\": \"<string>\",\n \"invocationId\": \"<string>\",\n \"toolName\": \"<string>\",\n \"errorDetails\": \"<string>\",\n \"callStageMessageIndex\": 123,\n \"callStageId\": \"<string>\",\n \"callState\": {},\n \"timespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n },\n \"wallClockTimespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n }\n ],\n \"metadata\": {},\n \"medium\": {\n \"webRtc\": {\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"twilio\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"serverWebSocket\": {\n \"inputSampleRate\": 123,\n \"outputSampleRate\": 123,\n \"clientBufferSizeMs\": 123,\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"telnyx\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"plivo\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"exotel\": {},\n \"sip\": {\n \"incoming\": {},\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n }\n }\n },\n \"joinTimeout\": \"<string>\",\n \"maxDuration\": \"<string>\",\n \"recordingEnabled\": true,\n \"firstSpeakerSettings\": {\n \"user\": {\n \"fallback\": {\n \"delay\": \"<string>\",\n \"text\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n },\n \"agent\": {\n \"uninterruptible\": true,\n \"text\": \"<string>\",\n \"prompt\": \"<string>\",\n \"delay\": \"<string>\"\n }\n },\n \"dataConnection\": {\n \"websocketUrl\": \"<string>\",\n \"audioConfig\": {\n \"sampleRate\": 123\n },\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"experimentalSettings\": {},\n \"callbacks\": {\n \"joined\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"ended\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"billed\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.altheastudio.ai/api/agents/{agent_id}/calls")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"templateContext\": {},\n \"initialMessages\": [\n {\n \"text\": \"<string>\",\n \"invocationId\": \"<string>\",\n \"toolName\": \"<string>\",\n \"errorDetails\": \"<string>\",\n \"callStageMessageIndex\": 123,\n \"callStageId\": \"<string>\",\n \"callState\": {},\n \"timespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n },\n \"wallClockTimespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n }\n ],\n \"metadata\": {},\n \"medium\": {\n \"webRtc\": {\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"twilio\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"serverWebSocket\": {\n \"inputSampleRate\": 123,\n \"outputSampleRate\": 123,\n \"clientBufferSizeMs\": 123,\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"telnyx\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"plivo\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"exotel\": {},\n \"sip\": {\n \"incoming\": {},\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n }\n }\n },\n \"joinTimeout\": \"<string>\",\n \"maxDuration\": \"<string>\",\n \"recordingEnabled\": true,\n \"firstSpeakerSettings\": {\n \"user\": {\n \"fallback\": {\n \"delay\": \"<string>\",\n \"text\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n },\n \"agent\": {\n \"uninterruptible\": true,\n \"text\": \"<string>\",\n \"prompt\": \"<string>\",\n \"delay\": \"<string>\"\n }\n },\n \"dataConnection\": {\n \"websocketUrl\": \"<string>\",\n \"audioConfig\": {\n \"sampleRate\": 123\n },\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"experimentalSettings\": {},\n \"callbacks\": {\n \"joined\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"ended\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"billed\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.altheastudio.ai/api/agents/{agent_id}/calls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateContext\": {},\n \"initialMessages\": [\n {\n \"text\": \"<string>\",\n \"invocationId\": \"<string>\",\n \"toolName\": \"<string>\",\n \"errorDetails\": \"<string>\",\n \"callStageMessageIndex\": 123,\n \"callStageId\": \"<string>\",\n \"callState\": {},\n \"timespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n },\n \"wallClockTimespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n }\n ],\n \"metadata\": {},\n \"medium\": {\n \"webRtc\": {\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"twilio\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"serverWebSocket\": {\n \"inputSampleRate\": 123,\n \"outputSampleRate\": 123,\n \"clientBufferSizeMs\": 123,\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"telnyx\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"plivo\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"exotel\": {},\n \"sip\": {\n \"incoming\": {},\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n }\n }\n },\n \"joinTimeout\": \"<string>\",\n \"maxDuration\": \"<string>\",\n \"recordingEnabled\": true,\n \"firstSpeakerSettings\": {\n \"user\": {\n \"fallback\": {\n \"delay\": \"<string>\",\n \"text\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n },\n \"agent\": {\n \"uninterruptible\": true,\n \"text\": \"<string>\",\n \"prompt\": \"<string>\",\n \"delay\": \"<string>\"\n }\n },\n \"dataConnection\": {\n \"websocketUrl\": \"<string>\",\n \"audioConfig\": {\n \"sampleRate\": 123\n },\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"experimentalSettings\": {},\n \"callbacks\": {\n \"joined\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"ended\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"billed\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"callId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"clientVersion": "<string>",
"created": "2023-11-07T05:31:56Z",
"joined": "2023-11-07T05:31:56Z",
"ended": "2023-11-07T05:31:56Z",
"billedDuration": "<string>",
"billedSideInputTokens": 123,
"billedSideOutputTokens": 123,
"firstSpeakerSettings": {
"user": {
"fallback": {
"delay": "<string>",
"text": "<string>",
"prompt": "<string>"
}
},
"agent": {
"uninterruptible": true,
"text": "<string>",
"prompt": "<string>",
"delay": "<string>"
}
},
"joinUrl": "<string>",
"shortSummary": "<string>",
"summary": "<string>",
"agent": {
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"agentId": "<string>",
"experimentalSettings": "<unknown>",
"metadata": {},
"initialState": {},
"requestContext": "<unknown>",
"sipDetails": {
"billedDuration": "<string>"
},
"inactivityMessages": [
{
"duration": "<string>",
"message": "<string>"
}
],
"joinTimeout": "30s",
"languageHint": "<string>",
"maxDuration": "3600s",
"medium": {
"webRtc": {
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"twilio": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"serverWebSocket": {
"inputSampleRate": 123,
"outputSampleRate": 123,
"clientBufferSizeMs": 123,
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"telnyx": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"plivo": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"exotel": {},
"sip": {
"incoming": {},
"outgoing": {
"to": "<string>",
"from": "<string>",
"username": "<string>",
"password": "<string>"
}
}
},
"model": "althea-v0.7",
"recordingEnabled": false,
"systemPrompt": "<string>",
"temperature": 0,
"timeExceededMessage": "<string>",
"voice": "<string>",
"externalVoice": {
"elevenLabs": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"useSpeakerBoost": true,
"style": 123,
"similarityBoost": 123,
"stability": 123,
"pronunciationDictionaries": [
{
"dictionaryId": "<string>",
"versionId": "<string>"
}
],
"optimizeStreamingLatency": 123,
"maxSampleRate": 123
},
"cartesia": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"emotion": "<string>",
"emotions": [
"<string>"
],
"generationConfig": {
"volume": 123,
"speed": 123,
"emotion": "<string>",
"pronunciationDictId": "<string>"
}
},
"lmnt": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"conversational": true
},
"google": {
"voiceId": "<string>",
"speakingRate": 123
},
"inworld": {
"voiceId": "<string>",
"modelId": "<string>",
"speakingRate": 123,
"temperature": 123,
"applyTextNormalization": true
},
"respeecher": {
"voiceId": "<string>",
"seed": 123,
"temperature": 123,
"topK": 123,
"topP": 123,
"minP": 123,
"presencePenalty": 123,
"repetitionPenalty": 123,
"frequencyPenalty": 123
},
"generic": {
"url": "<string>",
"headers": {},
"body": {},
"responseSampleRate": 123,
"responseWordsPerMinute": 123,
"responseMimeType": "<string>",
"jsonAudioFieldPath": "<string>"
}
},
"voiceOverrides": {
"elevenLabs": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"useSpeakerBoost": true,
"style": 123,
"similarityBoost": 123,
"stability": 123,
"pronunciationDictionaries": [
{
"dictionaryId": "<string>",
"versionId": "<string>"
}
],
"optimizeStreamingLatency": 123,
"maxSampleRate": 123
},
"cartesia": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"emotion": "<string>",
"emotions": [
"<string>"
],
"generationConfig": {
"volume": 123,
"speed": 123,
"emotion": "<string>",
"pronunciationDictId": "<string>"
}
},
"lmnt": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"conversational": true
},
"google": {
"voiceId": "<string>",
"speakingRate": 123
},
"inworld": {
"voiceId": "<string>",
"modelId": "<string>",
"speakingRate": 123,
"temperature": 123,
"applyTextNormalization": true
},
"respeecher": {
"voiceId": "<string>",
"seed": 123,
"temperature": 123,
"topK": 123,
"topP": 123,
"minP": 123,
"presencePenalty": 123,
"repetitionPenalty": 123,
"frequencyPenalty": 123
},
"generic": {
"url": "<string>",
"headers": {},
"body": {},
"responseSampleRate": 123,
"responseWordsPerMinute": 123,
"responseMimeType": "<string>",
"jsonAudioFieldPath": "<string>"
}
},
"transcriptOptional": true,
"vadSettings": {
"turnEndpointDelay": "<string>",
"minimumTurnDuration": "<string>",
"minimumInterruptionDuration": "<string>",
"frameActivationThreshold": 123
},
"dataConnectionConfig": {
"websocketUrl": "<string>",
"audioConfig": {
"sampleRate": 123
},
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"callbacks": {
"joined": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"ended": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"billed": {
"url": "<string>",
"secrets": [
"<string>"
]
}
}
}Create Agent Call
Creates a new call using the the specified agent
curl --request POST \
--url https://app.altheastudio.ai/api/agents/{agent_id}/calls \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"templateContext": {},
"initialMessages": [
{
"text": "<string>",
"invocationId": "<string>",
"toolName": "<string>",
"errorDetails": "<string>",
"callStageMessageIndex": 123,
"callStageId": "<string>",
"callState": {},
"timespan": {
"start": "<string>",
"end": "<string>"
},
"wallClockTimespan": {
"start": "<string>",
"end": "<string>"
}
}
],
"metadata": {},
"medium": {
"webRtc": {
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"twilio": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"serverWebSocket": {
"inputSampleRate": 123,
"outputSampleRate": 123,
"clientBufferSizeMs": 123,
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"telnyx": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"plivo": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"exotel": {},
"sip": {
"incoming": {},
"outgoing": {
"to": "<string>",
"from": "<string>",
"username": "<string>",
"password": "<string>"
}
}
},
"joinTimeout": "<string>",
"maxDuration": "<string>",
"recordingEnabled": true,
"firstSpeakerSettings": {
"user": {
"fallback": {
"delay": "<string>",
"text": "<string>",
"prompt": "<string>"
}
},
"agent": {
"uninterruptible": true,
"text": "<string>",
"prompt": "<string>",
"delay": "<string>"
}
},
"dataConnection": {
"websocketUrl": "<string>",
"audioConfig": {
"sampleRate": 123
},
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"experimentalSettings": {},
"callbacks": {
"joined": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"ended": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"billed": {
"url": "<string>",
"secrets": [
"<string>"
]
}
}
}
'import requests
url = "https://app.altheastudio.ai/api/agents/{agent_id}/calls"
payload = {
"templateContext": {},
"initialMessages": [
{
"text": "<string>",
"invocationId": "<string>",
"toolName": "<string>",
"errorDetails": "<string>",
"callStageMessageIndex": 123,
"callStageId": "<string>",
"callState": {},
"timespan": {
"start": "<string>",
"end": "<string>"
},
"wallClockTimespan": {
"start": "<string>",
"end": "<string>"
}
}
],
"metadata": {},
"medium": {
"webRtc": { "dataMessages": {
"pong": True,
"state": True,
"transcript": True,
"clientToolInvocation": True,
"dataConnectionToolInvocation": True,
"playbackClearBuffer": True,
"callStarted": True,
"debug": True,
"callEvent": True,
"toolUsed": True,
"userStartedSpeaking": True,
"userStoppedSpeaking": True
} },
"twilio": { "outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
} },
"serverWebSocket": {
"inputSampleRate": 123,
"outputSampleRate": 123,
"clientBufferSizeMs": 123,
"dataMessages": {
"pong": True,
"state": True,
"transcript": True,
"clientToolInvocation": True,
"dataConnectionToolInvocation": True,
"playbackClearBuffer": True,
"callStarted": True,
"debug": True,
"callEvent": True,
"toolUsed": True,
"userStartedSpeaking": True,
"userStoppedSpeaking": True
}
},
"telnyx": { "outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
} },
"plivo": { "outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
} },
"exotel": {},
"sip": {
"incoming": {},
"outgoing": {
"to": "<string>",
"from": "<string>",
"username": "<string>",
"password": "<string>"
}
}
},
"joinTimeout": "<string>",
"maxDuration": "<string>",
"recordingEnabled": True,
"firstSpeakerSettings": {
"user": { "fallback": {
"delay": "<string>",
"text": "<string>",
"prompt": "<string>"
} },
"agent": {
"uninterruptible": True,
"text": "<string>",
"prompt": "<string>",
"delay": "<string>"
}
},
"dataConnection": {
"websocketUrl": "<string>",
"audioConfig": { "sampleRate": 123 },
"dataMessages": {
"pong": True,
"state": True,
"transcript": True,
"clientToolInvocation": True,
"dataConnectionToolInvocation": True,
"playbackClearBuffer": True,
"callStarted": True,
"debug": True,
"callEvent": True,
"toolUsed": True,
"userStartedSpeaking": True,
"userStoppedSpeaking": True
}
},
"experimentalSettings": {},
"callbacks": {
"joined": {
"url": "<string>",
"secrets": ["<string>"]
},
"ended": {
"url": "<string>",
"secrets": ["<string>"]
},
"billed": {
"url": "<string>",
"secrets": ["<string>"]
}
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
templateContext: {},
initialMessages: [
{
text: '<string>',
invocationId: '<string>',
toolName: '<string>',
errorDetails: '<string>',
callStageMessageIndex: 123,
callStageId: '<string>',
callState: {},
timespan: {start: '<string>', end: '<string>'},
wallClockTimespan: {start: '<string>', end: '<string>'}
}
],
metadata: {},
medium: {
webRtc: {
dataMessages: {
pong: true,
state: true,
transcript: true,
clientToolInvocation: true,
dataConnectionToolInvocation: true,
playbackClearBuffer: true,
callStarted: true,
debug: true,
callEvent: true,
toolUsed: true,
userStartedSpeaking: true,
userStoppedSpeaking: true
}
},
twilio: {outgoing: {to: '<string>', from: '<string>', additionalParams: {}}},
serverWebSocket: {
inputSampleRate: 123,
outputSampleRate: 123,
clientBufferSizeMs: 123,
dataMessages: {
pong: true,
state: true,
transcript: true,
clientToolInvocation: true,
dataConnectionToolInvocation: true,
playbackClearBuffer: true,
callStarted: true,
debug: true,
callEvent: true,
toolUsed: true,
userStartedSpeaking: true,
userStoppedSpeaking: true
}
},
telnyx: {outgoing: {to: '<string>', from: '<string>', additionalParams: {}}},
plivo: {outgoing: {to: '<string>', from: '<string>', additionalParams: {}}},
exotel: {},
sip: {
incoming: {},
outgoing: {to: '<string>', from: '<string>', username: '<string>', password: '<string>'}
}
},
joinTimeout: '<string>',
maxDuration: '<string>',
recordingEnabled: true,
firstSpeakerSettings: {
user: {fallback: {delay: '<string>', text: '<string>', prompt: '<string>'}},
agent: {uninterruptible: true, text: '<string>', prompt: '<string>', delay: '<string>'}
},
dataConnection: {
websocketUrl: '<string>',
audioConfig: {sampleRate: 123},
dataMessages: {
pong: true,
state: true,
transcript: true,
clientToolInvocation: true,
dataConnectionToolInvocation: true,
playbackClearBuffer: true,
callStarted: true,
debug: true,
callEvent: true,
toolUsed: true,
userStartedSpeaking: true,
userStoppedSpeaking: true
}
},
experimentalSettings: {},
callbacks: {
joined: {url: '<string>', secrets: ['<string>']},
ended: {url: '<string>', secrets: ['<string>']},
billed: {url: '<string>', secrets: ['<string>']}
}
})
};
fetch('https://app.altheastudio.ai/api/agents/{agent_id}/calls', 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://app.altheastudio.ai/api/agents/{agent_id}/calls",
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([
'templateContext' => [
],
'initialMessages' => [
[
'text' => '<string>',
'invocationId' => '<string>',
'toolName' => '<string>',
'errorDetails' => '<string>',
'callStageMessageIndex' => 123,
'callStageId' => '<string>',
'callState' => [
],
'timespan' => [
'start' => '<string>',
'end' => '<string>'
],
'wallClockTimespan' => [
'start' => '<string>',
'end' => '<string>'
]
]
],
'metadata' => [
],
'medium' => [
'webRtc' => [
'dataMessages' => [
'pong' => true,
'state' => true,
'transcript' => true,
'clientToolInvocation' => true,
'dataConnectionToolInvocation' => true,
'playbackClearBuffer' => true,
'callStarted' => true,
'debug' => true,
'callEvent' => true,
'toolUsed' => true,
'userStartedSpeaking' => true,
'userStoppedSpeaking' => true
]
],
'twilio' => [
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'additionalParams' => [
]
]
],
'serverWebSocket' => [
'inputSampleRate' => 123,
'outputSampleRate' => 123,
'clientBufferSizeMs' => 123,
'dataMessages' => [
'pong' => true,
'state' => true,
'transcript' => true,
'clientToolInvocation' => true,
'dataConnectionToolInvocation' => true,
'playbackClearBuffer' => true,
'callStarted' => true,
'debug' => true,
'callEvent' => true,
'toolUsed' => true,
'userStartedSpeaking' => true,
'userStoppedSpeaking' => true
]
],
'telnyx' => [
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'additionalParams' => [
]
]
],
'plivo' => [
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'additionalParams' => [
]
]
],
'exotel' => [
],
'sip' => [
'incoming' => [
],
'outgoing' => [
'to' => '<string>',
'from' => '<string>',
'username' => '<string>',
'password' => '<string>'
]
]
],
'joinTimeout' => '<string>',
'maxDuration' => '<string>',
'recordingEnabled' => true,
'firstSpeakerSettings' => [
'user' => [
'fallback' => [
'delay' => '<string>',
'text' => '<string>',
'prompt' => '<string>'
]
],
'agent' => [
'uninterruptible' => true,
'text' => '<string>',
'prompt' => '<string>',
'delay' => '<string>'
]
],
'dataConnection' => [
'websocketUrl' => '<string>',
'audioConfig' => [
'sampleRate' => 123
],
'dataMessages' => [
'pong' => true,
'state' => true,
'transcript' => true,
'clientToolInvocation' => true,
'dataConnectionToolInvocation' => true,
'playbackClearBuffer' => true,
'callStarted' => true,
'debug' => true,
'callEvent' => true,
'toolUsed' => true,
'userStartedSpeaking' => true,
'userStoppedSpeaking' => true
]
],
'experimentalSettings' => [
],
'callbacks' => [
'joined' => [
'url' => '<string>',
'secrets' => [
'<string>'
]
],
'ended' => [
'url' => '<string>',
'secrets' => [
'<string>'
]
],
'billed' => [
'url' => '<string>',
'secrets' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://app.altheastudio.ai/api/agents/{agent_id}/calls"
payload := strings.NewReader("{\n \"templateContext\": {},\n \"initialMessages\": [\n {\n \"text\": \"<string>\",\n \"invocationId\": \"<string>\",\n \"toolName\": \"<string>\",\n \"errorDetails\": \"<string>\",\n \"callStageMessageIndex\": 123,\n \"callStageId\": \"<string>\",\n \"callState\": {},\n \"timespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n },\n \"wallClockTimespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n }\n ],\n \"metadata\": {},\n \"medium\": {\n \"webRtc\": {\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"twilio\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"serverWebSocket\": {\n \"inputSampleRate\": 123,\n \"outputSampleRate\": 123,\n \"clientBufferSizeMs\": 123,\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"telnyx\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"plivo\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"exotel\": {},\n \"sip\": {\n \"incoming\": {},\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n }\n }\n },\n \"joinTimeout\": \"<string>\",\n \"maxDuration\": \"<string>\",\n \"recordingEnabled\": true,\n \"firstSpeakerSettings\": {\n \"user\": {\n \"fallback\": {\n \"delay\": \"<string>\",\n \"text\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n },\n \"agent\": {\n \"uninterruptible\": true,\n \"text\": \"<string>\",\n \"prompt\": \"<string>\",\n \"delay\": \"<string>\"\n }\n },\n \"dataConnection\": {\n \"websocketUrl\": \"<string>\",\n \"audioConfig\": {\n \"sampleRate\": 123\n },\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"experimentalSettings\": {},\n \"callbacks\": {\n \"joined\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"ended\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"billed\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://app.altheastudio.ai/api/agents/{agent_id}/calls")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"templateContext\": {},\n \"initialMessages\": [\n {\n \"text\": \"<string>\",\n \"invocationId\": \"<string>\",\n \"toolName\": \"<string>\",\n \"errorDetails\": \"<string>\",\n \"callStageMessageIndex\": 123,\n \"callStageId\": \"<string>\",\n \"callState\": {},\n \"timespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n },\n \"wallClockTimespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n }\n ],\n \"metadata\": {},\n \"medium\": {\n \"webRtc\": {\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"twilio\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"serverWebSocket\": {\n \"inputSampleRate\": 123,\n \"outputSampleRate\": 123,\n \"clientBufferSizeMs\": 123,\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"telnyx\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"plivo\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"exotel\": {},\n \"sip\": {\n \"incoming\": {},\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n }\n }\n },\n \"joinTimeout\": \"<string>\",\n \"maxDuration\": \"<string>\",\n \"recordingEnabled\": true,\n \"firstSpeakerSettings\": {\n \"user\": {\n \"fallback\": {\n \"delay\": \"<string>\",\n \"text\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n },\n \"agent\": {\n \"uninterruptible\": true,\n \"text\": \"<string>\",\n \"prompt\": \"<string>\",\n \"delay\": \"<string>\"\n }\n },\n \"dataConnection\": {\n \"websocketUrl\": \"<string>\",\n \"audioConfig\": {\n \"sampleRate\": 123\n },\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"experimentalSettings\": {},\n \"callbacks\": {\n \"joined\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"ended\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"billed\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.altheastudio.ai/api/agents/{agent_id}/calls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"templateContext\": {},\n \"initialMessages\": [\n {\n \"text\": \"<string>\",\n \"invocationId\": \"<string>\",\n \"toolName\": \"<string>\",\n \"errorDetails\": \"<string>\",\n \"callStageMessageIndex\": 123,\n \"callStageId\": \"<string>\",\n \"callState\": {},\n \"timespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n },\n \"wallClockTimespan\": {\n \"start\": \"<string>\",\n \"end\": \"<string>\"\n }\n }\n ],\n \"metadata\": {},\n \"medium\": {\n \"webRtc\": {\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"twilio\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"serverWebSocket\": {\n \"inputSampleRate\": 123,\n \"outputSampleRate\": 123,\n \"clientBufferSizeMs\": 123,\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"telnyx\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"plivo\": {\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"additionalParams\": {}\n }\n },\n \"exotel\": {},\n \"sip\": {\n \"incoming\": {},\n \"outgoing\": {\n \"to\": \"<string>\",\n \"from\": \"<string>\",\n \"username\": \"<string>\",\n \"password\": \"<string>\"\n }\n }\n },\n \"joinTimeout\": \"<string>\",\n \"maxDuration\": \"<string>\",\n \"recordingEnabled\": true,\n \"firstSpeakerSettings\": {\n \"user\": {\n \"fallback\": {\n \"delay\": \"<string>\",\n \"text\": \"<string>\",\n \"prompt\": \"<string>\"\n }\n },\n \"agent\": {\n \"uninterruptible\": true,\n \"text\": \"<string>\",\n \"prompt\": \"<string>\",\n \"delay\": \"<string>\"\n }\n },\n \"dataConnection\": {\n \"websocketUrl\": \"<string>\",\n \"audioConfig\": {\n \"sampleRate\": 123\n },\n \"dataMessages\": {\n \"pong\": true,\n \"state\": true,\n \"transcript\": true,\n \"clientToolInvocation\": true,\n \"dataConnectionToolInvocation\": true,\n \"playbackClearBuffer\": true,\n \"callStarted\": true,\n \"debug\": true,\n \"callEvent\": true,\n \"toolUsed\": true,\n \"userStartedSpeaking\": true,\n \"userStoppedSpeaking\": true\n }\n },\n \"experimentalSettings\": {},\n \"callbacks\": {\n \"joined\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"ended\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n },\n \"billed\": {\n \"url\": \"<string>\",\n \"secrets\": [\n \"<string>\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"callId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"clientVersion": "<string>",
"created": "2023-11-07T05:31:56Z",
"joined": "2023-11-07T05:31:56Z",
"ended": "2023-11-07T05:31:56Z",
"billedDuration": "<string>",
"billedSideInputTokens": 123,
"billedSideOutputTokens": 123,
"firstSpeakerSettings": {
"user": {
"fallback": {
"delay": "<string>",
"text": "<string>",
"prompt": "<string>"
}
},
"agent": {
"uninterruptible": true,
"text": "<string>",
"prompt": "<string>",
"delay": "<string>"
}
},
"joinUrl": "<string>",
"shortSummary": "<string>",
"summary": "<string>",
"agent": {
"agentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"agentId": "<string>",
"experimentalSettings": "<unknown>",
"metadata": {},
"initialState": {},
"requestContext": "<unknown>",
"sipDetails": {
"billedDuration": "<string>"
},
"inactivityMessages": [
{
"duration": "<string>",
"message": "<string>"
}
],
"joinTimeout": "30s",
"languageHint": "<string>",
"maxDuration": "3600s",
"medium": {
"webRtc": {
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"twilio": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"serverWebSocket": {
"inputSampleRate": 123,
"outputSampleRate": 123,
"clientBufferSizeMs": 123,
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"telnyx": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"plivo": {
"outgoing": {
"to": "<string>",
"from": "<string>",
"additionalParams": {}
}
},
"exotel": {},
"sip": {
"incoming": {},
"outgoing": {
"to": "<string>",
"from": "<string>",
"username": "<string>",
"password": "<string>"
}
}
},
"model": "althea-v0.7",
"recordingEnabled": false,
"systemPrompt": "<string>",
"temperature": 0,
"timeExceededMessage": "<string>",
"voice": "<string>",
"externalVoice": {
"elevenLabs": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"useSpeakerBoost": true,
"style": 123,
"similarityBoost": 123,
"stability": 123,
"pronunciationDictionaries": [
{
"dictionaryId": "<string>",
"versionId": "<string>"
}
],
"optimizeStreamingLatency": 123,
"maxSampleRate": 123
},
"cartesia": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"emotion": "<string>",
"emotions": [
"<string>"
],
"generationConfig": {
"volume": 123,
"speed": 123,
"emotion": "<string>",
"pronunciationDictId": "<string>"
}
},
"lmnt": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"conversational": true
},
"google": {
"voiceId": "<string>",
"speakingRate": 123
},
"inworld": {
"voiceId": "<string>",
"modelId": "<string>",
"speakingRate": 123,
"temperature": 123,
"applyTextNormalization": true
},
"respeecher": {
"voiceId": "<string>",
"seed": 123,
"temperature": 123,
"topK": 123,
"topP": 123,
"minP": 123,
"presencePenalty": 123,
"repetitionPenalty": 123,
"frequencyPenalty": 123
},
"generic": {
"url": "<string>",
"headers": {},
"body": {},
"responseSampleRate": 123,
"responseWordsPerMinute": 123,
"responseMimeType": "<string>",
"jsonAudioFieldPath": "<string>"
}
},
"voiceOverrides": {
"elevenLabs": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"useSpeakerBoost": true,
"style": 123,
"similarityBoost": 123,
"stability": 123,
"pronunciationDictionaries": [
{
"dictionaryId": "<string>",
"versionId": "<string>"
}
],
"optimizeStreamingLatency": 123,
"maxSampleRate": 123
},
"cartesia": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"emotion": "<string>",
"emotions": [
"<string>"
],
"generationConfig": {
"volume": 123,
"speed": 123,
"emotion": "<string>",
"pronunciationDictId": "<string>"
}
},
"lmnt": {
"voiceId": "<string>",
"model": "<string>",
"speed": 123,
"conversational": true
},
"google": {
"voiceId": "<string>",
"speakingRate": 123
},
"inworld": {
"voiceId": "<string>",
"modelId": "<string>",
"speakingRate": 123,
"temperature": 123,
"applyTextNormalization": true
},
"respeecher": {
"voiceId": "<string>",
"seed": 123,
"temperature": 123,
"topK": 123,
"topP": 123,
"minP": 123,
"presencePenalty": 123,
"repetitionPenalty": 123,
"frequencyPenalty": 123
},
"generic": {
"url": "<string>",
"headers": {},
"body": {},
"responseSampleRate": 123,
"responseWordsPerMinute": 123,
"responseMimeType": "<string>",
"jsonAudioFieldPath": "<string>"
}
},
"transcriptOptional": true,
"vadSettings": {
"turnEndpointDelay": "<string>",
"minimumTurnDuration": "<string>",
"minimumInterruptionDuration": "<string>",
"frameActivationThreshold": 123
},
"dataConnectionConfig": {
"websocketUrl": "<string>",
"audioConfig": {
"sampleRate": 123
},
"dataMessages": {
"pong": true,
"state": true,
"transcript": true,
"clientToolInvocation": true,
"dataConnectionToolInvocation": true,
"playbackClearBuffer": true,
"callStarted": true,
"debug": true,
"callEvent": true,
"toolUsed": true,
"userStartedSpeaking": true,
"userStoppedSpeaking": true
}
},
"callbacks": {
"joined": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"ended": {
"url": "<string>",
"secrets": [
"<string>"
]
},
"billed": {
"url": "<string>",
"secrets": [
"<string>"
]
}
}
}Authorizations
API key
Path Parameters
Body
A request to start a call with an existing agent.
Context for filling any mustache templates for the call.
The conversation history to start from for this call.
Show child attributes
Show child attributes
Optional metadata key-value pairs to associate with the call. All values must be strings. Keys may not start with "althea.", which is reserved for system-provided metadata.
Show child attributes
Show child attributes
The (overridden) medium used for this call.
Show child attributes
Show child attributes
The (overridden) timeout for joining this call.
^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$The (overridden) maximum duration of this call.
^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$The (overridden) setting for whether the call should be recorded.
The (overridden) medium initially used by the agent. May be altered by the client later.
MESSAGE_MEDIUM_UNSPECIFIED, MESSAGE_MEDIUM_VOICE, MESSAGE_MEDIUM_TEXT The (overridden) settings for the initial message to get a conversation started.
Defaults to agent: {} which means the agent will start the conversation with an
(interruptible) greeting generated based on the system prompt and any initial messages.
(If first_speaker is set and this is not, first_speaker will be used instead.)
Show child attributes
Show child attributes
The (overridden) data connection configuration.
Show child attributes
Show child attributes
Experimental settings for the call.
Callbacks for call lifecycle events.
Show child attributes
Show child attributes
Response
The version of the client that joined this call.
The reason the call ended.
unjoined- Client never joinedhangup- Client hung upagent_hangup- Agent hung uptimeout- Call timed outconnection_error- Connection errorsystem_error- System error
unjoined, hangup, agent_hangup, timeout, connection_error, system_error - BILLING_STATUS_PENDING* - The call hasn't been billed yet, but will be in the future. This is the case for ongoing calls for example. (Note: Calls created before May 28, 2025 may have this status even if they were billed.)
- BILLING_STATUS_FREE_CONSOLE* - The call was free because it was initiated on https://portal.altheastudio.ai.
- BILLING_STATUS_FREE_ZERO_EFFECTIVE_DURATION* - The call was free because its effective duration was zero. (Note: There may still be a non-zero sip bill in this case.)
- BILLING_STATUS_FREE_MINUTES* - The call was unbilled but counted against the account's free minutes. (Note: There may still be a non-zero sip bill in this case.)
- BILLING_STATUS_FREE_SYSTEM_ERROR* - The call was free because it ended due to a system error.
- BILLING_STATUS_FREE_OTHER* - The call is in an undocumented free billing state.
- BILLING_STATUS_BILLED* - The call was billed. See billedDuration for the billed duration.
- BILLING_STATUS_REFUNDED* - The call was billed but was later refunded.
- BILLING_STATUS_UNSPECIFIED* - The call is in an unexpected billing state. Please contact support.
BILLING_STATUS_PENDING, BILLING_STATUS_FREE_CONSOLE, BILLING_STATUS_FREE_ZERO_EFFECTIVE_DURATION, BILLING_STATUS_FREE_MINUTES, BILLING_STATUS_FREE_SYSTEM_ERROR, BILLING_STATUS_FREE_OTHER, BILLING_STATUS_BILLED, BILLING_STATUS_REFUNDED, BILLING_STATUS_UNSPECIFIED Who was supposed to talk first when the call started. Typically set to FIRST_SPEAKER_USER for outgoing calls and left as the default (FIRST_SPEAKER_AGENT) otherwise.
FIRST_SPEAKER_AGENT, FIRST_SPEAKER_USER Settings for the initial message to get the call started.
Show child attributes
Show child attributes
The medium used initially by the agent. May later be changed by the client.
MESSAGE_MEDIUM_VOICE, MESSAGE_MEDIUM_TEXT A short summary of the call.
A summary of the call.
The agent used for this call.
Show child attributes
Show child attributes
The ID of the agent used for this call.
Experimental settings for the call.
Optional metadata key-value pairs to associate with the call. All values must be strings.
Show child attributes
Show child attributes
The initial state of the call which is readable/writable by tools.
Show child attributes
Show child attributes
SIP details for the call, if applicable.
Show child attributes
Show child attributes
Messages spoken by the agent when the user is inactive for the specified duration. Durations are cumulative, so a message m > 1 with duration 30s will be spoken 30 seconds after message m-1.
Show child attributes
Show child attributes
BCP47 language code that may be used to guide speech recognition.
16Details about a call's protocol. By default, calls occur over WebRTC using the Althea client SDK. Setting a different call medium will prepare the server for a call using a different protocol. At most one call medium may be set.
Show child attributes
Show child attributes
0 <= x <= 1A voice not known to Althea Realtime that can nonetheless be used for a call. Such voices are significantly less validated than normal voices and you'll be responsible for your own TTS-related errors. Exactly one field must be set.
Show child attributes
Show child attributes
Overrides for the selected voice.
Show child attributes
Show child attributes
Indicates whether a transcript is optional for the call.
VAD settings for the call.
Show child attributes
Show child attributes
Settings for exchanging data messages with an additional participant.
Show child attributes
Show child attributes
Callbacks configuration for the call.
Show child attributes
Show child attributes