Voice API
The Voice API lets you create outbound calls, control in-progress calls and get information about historical calls. More information about the Voice API can be found at https://developer.nexmo.com/voice/voice-api/overview. To create IP calls please check the following page: https://developer.vonage.com/en/api/voice.v2.
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
Query Parameters
startedFilter by call status
startedringingansweredmachinecompletedbusycancelledfailedrejectedtimeoutunanswered2016-11-14T07:45:14ZReturn the records available after this point in time. Please use Reports API for older call information.
2016-11-14T07:45:14ZReturn the records that occurred before this point in time
110010Return this amount of records in the response
Return calls from this index in the response
ascEither ascending or descending order.
ascdescCON-f972836a-550f-45fa-956c-12a2ab5b7d22Return all the records associated with a specific conversation.
10010/calls?page_size=10&record_index=20&order=asc/calls?page_size=10&record_index=20&order=asc/calls?page_size=10&record_index=20&order=asc/calls?page_size=10&record_index=20&order=asc/calls?page_size=10&record_index=20&order=ascA list of call objects. See the get details of a specific call response fields for a description of the nested objects
/calls/63f61863-4a51-4f6b-86e1-46edebcf935663f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
CON-f972836a-550f-45fa-956c-12a2ab5b7d22The unique identifier for the conversation this call leg is part of.
phoneThe type of connection. Must be phone
71514155550100The phone number to connect to
p*123#Provide DTMF digits to send when the call is answered
The endpoint you called from. Possible values are the same as to.
phone447700900001completedThe status of the call. See possible values
outboundPossible values are outbound or inbound
outboundinbound0.39The price per minute for this call. This is only sent if status is completed.
23.40The total price charged for this call. This is only sent if status is completed.
60The time elapsed for the call to take place in seconds. This is only sent if status is completed.
2020-01-01 12:00:00The time the call started in the following format: YYYY-MM-DD HH:MM:SS. For example, 2020-01-01 12:00:00. This is only sent if status is completed.
2020-01-01 12:00:00The time the call started in the following format: YYYY-MM-DD HH:MM:SS. For xample, 2020-01-01 12:00:00. This is only sent if status is completed.
65512The Mobile Country Code Mobile Network Code (MCCMNC) for the carrier network used to make this call. This is only sent if status is completed.
Example Response
{
"count": 100,
"page_size": 10,
"record_index": 0,
"_links": {
"self": {
"href": "/calls?page_size=10&record_index=20&order=asc"
},
"first": {
"href": "/calls?page_size=10&record_index=20&order=asc"
},
"last": {
"href": "/calls?page_size=10&record_index=20&order=asc"
},
"next": {
"href": "/calls?page_size=10&record_index=20&order=asc"
},
"prev": {
"href": "/calls?page_size=10&record_index=20&order=asc"
}
},
"_embedded": {
"calls": [
{
"_links": {
"self": {
"href": "/calls/63f61863-4a51-4f6b-86e1-46edebcf9356"
}
},
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356",
"conversation_uuid": "CON-f972836a-550f-45fa-956c-12a2ab5b7d22",
"to": {
"type": "phone",
"number": "14155550100",
"dtmfAnswer": "p*123#"
},
"from": {
"type": "phone",
"number": "447700900001"
},
"status": "completed",
"direction": "outbound",
"rate": "0.39",
"price": "23.40",
"duration": "60",
"start_time": "2020-01-01 12:00:00",
"end_time": "2020-01-01 12:00:00",
"network": "65512"
}
]
}
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
phoneThe type of connection. Must be phone
71514155550100The phone number to connect to
p*123#Provide DTMF digits to send when the call is answered
Connect to a Phone (PSTN) number. This property is mutually exclusive with random_from_number: you must specify one (from) or the other (random_from_number: true).
phoneThe type of connection. Must be phone
71514155550100The phone number to connect to
Set to true to use random phone number as from. The number will be selected from the list of the numbers assigned to the current application. This property is mutually exclusive with from: you must specify one (random_from_number: true) or the other (from).
Required unless event_url is configured at the application level, see Create an Application
The webhook endpoint where call progress events are sent to. For more information about the values sent, see Event webhook.
POSTThe HTTP method used to send event information to event_url.
POSTGETcontinueConfigure the behavior when Vonage detects that the call is answered by voicemail. If continue, Vonage sends an HTTP request to event_url with the Call event machine. If hangup, Vonage ends the call.
continuehangupConfigure the behavior of Vonage's advanced machine detection. Overrides machine_detection if both are set. Note that this is a beta feature which will be chargeable; exact rates can be found on the Voice API Pricing page under 'Programmable Features'.
When hangup is used, the call will be terminated if a machine is detected. When continue is used, the call will continue even if a machine is detected.
continuehangupdetectDetect if machine answered and sends a human or machine status in the webhook payload. The modes are as follows:
default- async mode, the next NCCO action will be processed immediately in parallel with machine detection, the application will receive both machine detection status and beep events and can reply with new NCCO to any of them;detect- sync mode, the next NCCO action will be processed only when machine detection is finished, the application will receive only machine detection status event;detect_beep- sync mode, the next NCCO action will be processed only when machine detection is finished, the application will receive only a beep event.
defaultdetectdetect_beep45120Maximum time in seconds Vonage should wait for a machine beep to be detected. A machine event with sub_state set to beep_timeout will be sent if the timeout is exceeded.
172007200Set the number of seconds that elapse before Vonage hangs up after the call state changes to answered.
112060Set the number of seconds that elapse before Vonage hangs up after the call state changes to ‘ringing’.
Example Request
{
"ncco": [
{
"action": "talk",
"text": "Hello World"
}
],
"to": [
{
"type": "phone",
"number": "14155550100",
"dtmfAnswer": "p*123#"
}
],
"from": {
"type": "phone",
"number": "14155550100"
},
"random_from_number": false,
"event_url": [
"https://example.com/event"
],
"event_method": "POST",
"machine_detection": "continue",
"advanced_machine_detection": {
"behavior": "continue",
"mode": "default",
"beep_timeout": 45
},
"length_timer": 7200,
"ringing_timer": 60
}{
"ncco": [
{
"action": "talk",
"text": "Hello World"
}
],
"to": [
{
"type": "phone",
"number": "14155550100",
"dtmfAnswer": "p*123#"
}
],
"from": {
"type": "phone",
"number": "14155550100"
},
"random_from_number": false,
"event_url": [
"https://example.com/event"
],
"event_method": "POST",
"machine_detection": "continue",
"advanced_machine_detection": {
"behavior": "continue",
"mode": "default",
"beep_timeout": 45
},
"length_timer": 7200,
"ringing_timer": 60
}63f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
completedThe status of the call. See possible values
outboundPossible values are outbound or inbound
outboundinboundCON-f972836a-550f-45fa-956c-12a2ab5b7d22The unique identifier for the conversation this call leg is part of.
Example Response
{
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356",
"status": "completed",
"direction": "outbound",
"conversation_uuid": "CON-f972836a-550f-45fa-956c-12a2ab5b7d22"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
/calls/63f61863-4a51-4f6b-86e1-46edebcf935663f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
CON-f972836a-550f-45fa-956c-12a2ab5b7d22The unique identifier for the conversation this call leg is part of.
phoneThe type of connection. Must be phone
71514155550100The phone number to connect to
p*123#Provide DTMF digits to send when the call is answered
The endpoint you called from. Possible values are the same as to.
phone447700900001completedThe status of the call. See possible values
outboundPossible values are outbound or inbound
outboundinbound0.39The price per minute for this call. This is only sent if status is completed.
23.40The total price charged for this call. This is only sent if status is completed.
60The time elapsed for the call to take place in seconds. This is only sent if status is completed.
2020-01-01 12:00:00The time the call started in the following format: YYYY-MM-DD HH:MM:SS. For example, 2020-01-01 12:00:00. This is only sent if status is completed.
2020-01-01 12:00:00The time the call started in the following format: YYYY-MM-DD HH:MM:SS. For xample, 2020-01-01 12:00:00. This is only sent if status is completed.
65512The Mobile Country Code Mobile Network Code (MCCMNC) for the carrier network used to make this call. This is only sent if status is completed.
Example Response
{
"_links": {
"self": {
"href": "/calls/63f61863-4a51-4f6b-86e1-46edebcf9356"
}
},
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356",
"conversation_uuid": "CON-f972836a-550f-45fa-956c-12a2ab5b7d22",
"to": {
"type": "phone",
"number": "14155550100",
"dtmfAnswer": "p*123#"
},
"from": {
"type": "phone",
"number": "447700900001"
},
"status": "completed",
"direction": "outbound",
"rate": "0.39",
"price": "23.40",
"duration": "60",
"start_time": "2020-01-01 12:00:00",
"end_time": "2020-01-01 12:00:00",
"network": "65512"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
transferTransfer the call to a new NCCO
transfernccoAlways ncco
Example Request
{
"action": "transfer",
"destination": {
"type": "ncco",
"ncco": [
{
"action": "talk",
"text": "Hello World"
}
]
}
}{
"action": "transfer",
"destination": {
"type": "ncco",
"ncco": [
{
"action": "talk",
"text": "Hello World"
}
]
}
}Available Operations
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
1the number of times to play the file, 0 for infinite
00.4Set the audio level of the stream in the range -1 >= level <= 1 with a precision of 0.1. The default value is 0.
Example Request
{
"stream_url": [
"https://example.com/waiting.mp3"
],
"loop": 1,
"level": "0.4"
}{
"stream_url": [
"https://example.com/waiting.mp3"
],
"loop": 1,
"level": "0.4"
}Stream startedDescription of the action taken
63f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
Example Response
{
"message": "Stream started",
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
Stream stoppedDescription of the action taken
63f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
Example Response
{
"message": "Stream stopped",
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356"
}Available Operations
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
Hello. How are you today?The text to read
en-USThe language to use
arca-EScmn-CNcmn-TWcs-CZcy-GBda-DKde-DEel-GRen-AUen-GBen-GB-WLSen-INen-USen-ZAes-ESes-MXes-USeu-ESfi-FIfil-PHfr-CAfr-FRhe-ILhi-INhu-HUid-IDis-ISit-ITja-JPko-KRnb-NOnl-NLno-NOpl-PLpt-BRpt-PTro-ROru-RUsk-SKsv-SEth-THtr-TRuk-UAvi-VNyue-CNThe vocal style (vocal range, tessitura, and timbre) to use
falsetrueSet to true to use the premium version of the specified style if available, otherwise the standard version will be used. You can find more information about Premium Voices in the Text-To-Speech guide.
KimberlyDEPRECATED The voice & language to use
AditiAgnieszkaAlvaAmyAstridBiancaBrianCarlaCarmenCarmitCatarinaCelineCemChantalChipmunkConchitaCristianoDamayantiDoraEmmaEmparEnriqueEricEwaFelipeFilizGeraintGiorgioGwynethHansHenrikInesIoanaIvetaIvyJacekJanJenniferJoanaJoannaJoeyJordiJustinKanyaKarlKendraKimberlyLailaLauraLeaLekhaLivLotteLuciaLucianaMadsMagedMajaMariskaMarleneMathieuMatthewMaximMei-JiaMelinaMiaMiguelMirenMizukiMontserratNajaNicoleNikosNoraOskarPenelopeRaveenaRicardoRubenRussellSalliSatuSeoyeonSin-JiSoraTakumiTarikTatyanaTessaTian-TianVickiVitoriaYeldaZeinaZhiyuZuzana1The number of times to repeat the text the file, 0 for infinite
00.4The volume level that the speech is played. This can be any value between -1 to 1 in 0.1 increments, with 0 being the default.
Example Request
{
"text": "Hello. How are you today?",
"language": "ar",
"style": 0,
"premium": true,
"voice_name": "Aditi",
"loop": 1,
"level": "0.4"
}{
"text": "Hello. How are you today?",
"language": "ar",
"style": 0,
"premium": true,
"voice_name": "Aditi",
"loop": 1,
"level": "0.4"
}Talk startedDescription of the action taken
63f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
Example Response
{
"message": "Talk started",
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
Talk stoppedDescription of the action taken
63f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
Example Response
{
"message": "Talk stopped",
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
1713The digits to send
Example Request
{
"digits": 1713
}{
"digits": 1713
}DTMF sentDescription of the action taken
63f61863-4a51-4f6b-86e1-46edebcf9356The unique identifier for this call leg. The UUID is created when your call request is accepted by Vonage. You use the UUID in all requests for individual live calls
Example Response
{
"message": "DTMF sent",
"uuid": "63f61863-4a51-4f6b-86e1-46edebcf9356"
}Subscribe to real-time DTMF events
Register a listener to receive asynchronous DTMF inputs from a call. This is only applicable to Input NCCO events with the mode set to asynchronous. The payload delivered to this URL will be an Input webhook event with a single DTMF digit every time the callee enters DTMF into the call.
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |
[
"https://example.com/ivr"
]The URL (wrapped in an array) to send DTMF events to, as a POST request.
Example Request
{
"event_url": [
"https://example.com/ivr"
]
}{
"event_url": [
"https://example.com/ivr"
]
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Your JSON web token. | Headers | Bearer <JWT> |