Getting IVR recordings

This method allows you to get audio files recorded by Record actions in IVR scenarios.

Resource

https://api.infobip.com//voice/ivr/1/files

Parameters

Property name Type Description
page number Page number you want to see.
pageSize number Size of the page you want to see.
messageId string The message ID to search by.
number string The called phone number to search by.

Request Example

					GET /voice/ivr/1/files HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
					
				

Response

					{
  "files": [
    {
      "messageId": "453e161a-fe4f-4f3c-80c0-ab520de9a969",
      "from": "12345",
      "to": "38712345678",
      "scenarioId": "C9CE33CF130511D8E333C1260BABA309",
      "groupId": "#/script/1",
      "url": "/voice/ivr/1/files/3C67336FA555A606C85FA9637906A6AB98436B7AFC65D857A416F6521D39F8F0E1D3D2469FF580D8968D3DD89A2DB561",
      "recordedAt": "2018-04-30T07:25:32.920+0000"
    },
    {
      "messageId": "05b2859d-85c6-4068-9347-2e563b5c9cf4",
      "from": "12345",
      "to": "38712345678",
      "scenarioId": "4A6177C9B92039306F1F091708851A2E",
      "groupId": "#/script/1",
      "url": "/voice/ivr/1/files/305DE72BA11D81D1BAED75BFC46706761580BDEC2218C22628447FD3814E7913D3058E4ECBFD6F55C80E976235EEB111",
      "recordedAt": "2017-11-15T20:07:05.180+0000"
    },
    {
      "messageId": "4e7b0e56-03cb-46e0-a997-c4df4a8863d5",
      "from": "12345",
      "to": "38712345678",
      "scenarioId": "4A6177C9B92039306F1F091708851A2E",
      "groupId": "#/script/1",
      "url": "/voice/ivr/1/files/C8E770E36C23DC088B4BF9F1B636D07C1428AA1C4CF7B18B21DC165235F3FCA97D3D297971FEE427ADC9D5E0F0E0EF6C",
      "recordedAt": "2017-11-15T20:04:00.500+0000"
    }
  ]
}
					
				

Response format

If successful, the response header HTTP status code will be 200 OK and recorded files in the response body.

If you try to send a message without authorization, you will get a response with the HTTP status code 401 Unauthorized.

IVR Recordings Response

Parameter Type Description
results Recording Collection of recorded files.

Recording

Parameter Type Description
messageId String Message ID.
from String Source address.
to String Destination address.
scenarioId String Scenario ID.
groupId String Differentiates recordings made by separate Record actions.
url String Relative URL path to the recorded file.
recordedAt int The time the recording took place.

Getting the audio

To download the audio, just perform a GET request using the relative URL of a specific file. The returned audio data is encoded as PCM 16bit 8kHz WAVE audio. The files are available on Infobip servers for 2 months.

Additional examples

Getting recorded files without any query parameters

Request:

GET /voice/ivr/1/files HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET /voice/ivr/1/files HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml
curl -X GET \
-H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
"http://api.infobip.com/voice/ivr/1/files"
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.infobip.com/voice/ivr/1/files",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
require 'uri'
require 'net/http'

url = URI("http://api.infobip.com/voice/ivr/1/files")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["content-type"] = 'application/json'
request["accept"] = 'application/json'

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPConnection("api.infobip.com")

payload = ""

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("GET", "/voice/ivr/1/files", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("http://api.infobip.com/voice/ivr/1/files")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .asString();
var client = new RestClient("http://api.infobip.com/voice/ivr/1/files");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "http://api.infobip.com/voice/ivr/1/files");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "files": [
    {
      "messageId": "453e161a-fe4f-4f3c-80c0-ab520de9a969",
      "from": "12345",
      "to": "38712345678",
      "scenarioId": "C9CE33CF130511D8E333C1260BABA309",
      "groupId": "#/script/1",
      "url": "/voice/ivr/1/files/3C67336FA555A606C85FA9637906A6AB98436B7AFC65D857A416F6521D39F8F0E1D3D2469FF580D8968D3DD89A2DB561",
      "recordedAt": "2018-04-30T07:25:32.920+0000"
    },
    {
      "messageId": "05b2859d-85c6-4068-9347-2e563b5c9cf4",
      "from": "12345",
      "to": "38712345678",
      "scenarioId": "4A6177C9B92039306F1F091708851A2E",
      "groupId": "#/script/1",
      "url": "/voice/ivr/1/files/305DE72BA11D81D1BAED75BFC46706761580BDEC2218C22628447FD3814E7913D3058E4ECBFD6F55C80E976235EEB111",
      "recordedAt": "2017-11-15T20:07:05.180+0000"
    },
    {
      "messageId": "4e7b0e56-03cb-46e0-a997-c4df4a8863d5",
      "from": "12345",
      "to": "38712345678",
      "scenarioId": "4A6177C9B92039306F1F091708851A2E",
      "groupId": "#/script/1",
      "url": "/voice/ivr/1/files/C8E770E36C23DC088B4BF9F1B636D07C1428AA1C4CF7B18B21DC165235F3FCA97D3D297971FEE427ADC9D5E0F0E0EF6C",
      "recordedAt": "2017-11-15T20:04:00.500+0000"
    }
  ]
}
HTTP/1.1 200 OK
Content-Type: application/xml

<?xml version='1.0' encoding='UTF-8'?>
<recordedAudioFilesResponse>
    <files>
        <file>
            <messageId>453e161a-fe4f-4f3c-80c0-ab520de9a969</messageId>
            <from>12345</from>
            <to>38712345678</to>
            <scenarioId>C9CE33CF130511D8E333C1260BABA309</scenarioId>
            <groupId>#/script/1</groupId>
            <url>/voice/ivr/1/files/3C67336FA555A606C85FA9637906A6AB98436B7AFC65D857A416F6521D39F8F0E1D3D2469FF580D8968D3DD89A2DB561</url>
            <recordedAt>2018-04-30T07:25:32.920+0000</recordedAt>
        </file>
        <file>
            <messageId>05b2859d-85c6-4068-9347-2e563b5c9cf4</messageId>
            <from>12345</from>
            <to>38712345678</to>
            <scenarioId>4A6177C9B92039306F1F091708851A2E</scenarioId>
            <groupId>#/script/1</groupId>
            <url>/voice/ivr/1/files/305DE72BA11D81D1BAED75BFC46706761580BDEC2218C22628447FD3814E7913D3058E4ECBFD6F55C80E976235EEB111</url>
            <recordedAt>2017-11-15T20:07:05.180+0000</recordedAt>
        </file>
        <file>
            <messageId>4e7b0e56-03cb-46e0-a997-c4df4a8863d5</messageId>
            <from>12345</from>
            <to>38712345678</to>
            <scenarioId>4A6177C9B92039306F1F091708851A2E</scenarioId>
            <groupId>#/script/1</groupId>
            <url>/voice/ivr/1/files/C8E770E36C23DC088B4BF9F1B636D07C1428AA1C4CF7B18B21DC165235F3FCA97D3D297971FEE427ADC9D5E0F0E0EF6C</url>
            <recordedAt>2017-11-15T20:04:00.500+0000</recordedAt>
        </file>
    </files>
</recordedAudioFilesResponse>

Getting recorded files for a message to a destination

Request:

GET /voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/json
GET /voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678 HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Accept: application/xml
curl -X GET 
-H "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" 
-H "Content-Type: application/json" 
-H "Accept: application/json" 
"http://api.infobip.com/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678"
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://api.infobip.com/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_POSTFIELDS => "",
  CURLOPT_HTTPHEADER => array(
    "accept: application/json",
    "authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    "content-type: application/json"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
require 'uri'
require 'net/http'

url = URI("http://api.infobip.com/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["authorization"] = 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
request["content-type"] = 'application/json'
request["accept"] = 'application/json'

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPConnection("api.infobip.com")

payload = ""

headers = {
    'authorization': "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==",
    'content-type': "application/json",
    'accept': "application/json"
    }

conn.request("GET", "/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse<String> response = Unirest.get("http://api.infobip.com/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678")
  .header("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .asString();
var client = new RestClient("http://api.infobip.com/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678");
var request = new RestRequest(Method.GET);
request.AddHeader("accept", "application/json");
request.AddHeader("content-type", "application/json");
request.AddHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
IRestResponse response = client.Execute(request);
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "http://api.infobip.com/voice/ivr/1/files?page=1&pageSize=2&messageId=453e161a-fe4f-4f3c-80c0-ab520de9a969&number=38712345678");
xhr.setRequestHeader("authorization", "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);

Response:

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "messageId": "453e161a-fe4f-4f3c-80c0-ab520de9a969",
    "from": "12345",
    "to": "38712345678",
    "scenarioId": "C9CE33CF130511D8E333C1260BABA309",
    "groupId": "#/script/1",
    "url": "/voice/ivr/1/files/3C67336FA555A606C85FA9637906A6AB98436B7AFC65D857A416F6521D39F8F0E1D3D2469FF580D8968D3DD89A2DB561",
    "recordedAt": "2018-04-30T07:25:32.920+0000"
  }
]
HTTP/1.1 200 OK
Content-Type: application/xml

<recordedAudioFilesResponse>
    <files>
        <file>
            <messageId>453e161a-fe4f-4f3c-80c0-ab520de9a969</messageId>
            <from>12345</from>
            <to>38712345678</to>
            <scenarioId>C9CE33CF130511D8E333C1260BABA309</scenarioId>
            <groupId>#/script/1</groupId>
            <url>/voice/ivr/1/files/3C67336FA555A606C85FA9637906A6AB98436B7AFC65D857A416F6521D39F8F0E1D3D2469FF580D8968D3DD89A2DB561</url>
            <recordedAt>2018-04-30T07:25:32.920+0000</recordedAt>
        </file>
    </files>
</recordedAudioFilesResponse>