Stream a sound file's audio (user, pbx)
Stream the raw audio bytes of a sound file. The response is sent inline (not as
an attachment) so it can be played directly, for example as the src of an
HTML <audio> element. The Content-Type reflects the stored format
(commonly audio/mpeg, but audio/wav, audio/flac or audio/aac may also
be returned), falling back to audio/mpeg.
This endpoint accepts EITHER of two authentication methods:
- A temporary signed URL. This is the
audio_urlreturned by the sound file resource (it embedsexpiresandsignaturequery parameters and expires roughly one hour after it is minted). NoAuthorizationheader is required, which lets it be used directly in an<audio src>. - A bearer token carrying the
sound-filesability. Used for durable or programmatic access; the stream is scoped to the token principal's PBX.
When neither a valid signature nor a token is present the request is rejected
with 401. A token that lacks the sound-files ability is rejected with 403.
User bearer token. Default authentication for customer-facing endpoints.
Obtain a token by calling POST /login with your credentials, then send it
on every subsequent request as Authorization: Bearer <token>. The token
inherits the permissions and PBX scope of the authenticated user.
- HTTP Authorization Scheme
bearer- Bearer format
Bearer <token>
audio/mpegResponses
Authorization Token is missingmessagearray<string>
https://cockpit.voxbi.com/api/v1/sound-files/{soundFile}/audio
curl -X GET 'https://cockpit.voxbi.com/api/v1/sound-files/{soundFile}/audio' \
-H 'Authorization: Bearer YOUR_TOKEN'
const response = await fetch('https://cockpit.voxbi.com/api/v1/sound-files/{soundFile}/audio', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${YOUR_TOKEN}`,
},
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://cockpit.voxbi.com/api/v1/sound-files/{soundFile}/audio',
headers={'Authorization': f'Bearer {YOUR_TOKEN}'}
)
response.raise_for_status()
data = response.json()
print(data)
<?php
$context = stream_context_create([
'http' => [
'method' => 'GET',
'header' => "Content-Type: application/json\r\nAuthorization: Bearer YOUR_TOKEN",
],
]);
$response = file_get_contents('https://cockpit.voxbi.com/api/v1/sound-files/{soundFile}/audio', false, $context);
$data = json_decode($response, true);
print_r($data);
audio/mpeginline; filename="Welcome announcement"{ … }
private, must-revalidatekeep-aliveapplication/jsonOrigin6057{ … }
"message": [ … ]
private, must-revalidatekeep-aliveapplication/jsonOrigin6057