curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/agents/{id}/dispatch-call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "+14155550123",
"from": "+14155550100",
"on_call_ended_url": "https://hooks.example.com/calls/ended"
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/agents/{id}/dispatch-call"
payload = {
"to": "+14155550123",
"from": "+14155550100",
"on_call_ended_url": "https://hooks.example.com/calls/ended"
}
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({
to: '+14155550123',
from: '+14155550100',
on_call_ended_url: 'https://hooks.example.com/calls/ended'
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/agents/{id}/dispatch-call', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"callId": "6f1a2b3c-4d5e-4f60-8172-839405a6b7c8",
"roomName": "dispatch-1a2b3c4d",
"status": "dialing",
"conversationId": "2b3c4d5e-6f70-4812-9a3b-4c5d6e7f8091"
}Dispatch an outbound call
Has the agent’s published version phone to. The request returns as soon as dialling starts (status: dialing); whether the callee answers is not known yet. Follow the call through the returned conversationId (GET .../conversations/{id}), or pass on_call_ended_url to receive the finished call record when it ends.
Caller ID: from, when given, must be a phone number registered in this project with outbound calling enabled; otherwise the call is refused (422) rather than placed from a different number. Without from, the agent’s own outbound number is used, then a number routed to the agent, then the platform default.
Needs the publish permission, which organization API keys carry. The agent must have been published at least once, and must be a voice agent (a Voice Assist agent cannot place calls).
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/agents/{id}/dispatch-call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": "+14155550123",
"from": "+14155550100",
"on_call_ended_url": "https://hooks.example.com/calls/ended"
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/agents/{id}/dispatch-call"
payload = {
"to": "+14155550123",
"from": "+14155550100",
"on_call_ended_url": "https://hooks.example.com/calls/ended"
}
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({
to: '+14155550123',
from: '+14155550100',
on_call_ended_url: 'https://hooks.example.com/calls/ended'
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/agents/{id}/dispatch-call', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"callId": "6f1a2b3c-4d5e-4f60-8172-839405a6b7c8",
"roomName": "dispatch-1a2b3c4d",
"status": "dialing",
"conversationId": "2b3c4d5e-6f70-4812-9a3b-4c5d6e7f8091"
}Authorizations
Your organization API key (it starts with anek_org_). The same key works on the Voice API and the Support API. See Authentication.
Body
The number to call, in international format (E.164), for example +14155550123.
1Caller ID to present. Must be a number registered in this project with outbound calling enabled, or the call is refused with 422. Omit it to use the agent's outbound number.
An https URL that receives a POST with the finished call record (vCon JSON) when the call ends.
Response
Dialling has started. The outcome of the call is reported asynchronously.