Upload an audio
In this guide you will learn how to upload a media file as an audio to a space. This is a prerequisite to compute voiceprints or perform verifications.
If you are unfamiliar with these concepts, follow their links or read the API reference introduction.
✦ Goal: upload an audio
and store its reference
for future use.
Prerequisites
Set up your HTTP client
Use the playground or automatically generate requests from the OpenAPI definition.
Authenticate using your credentials or API keys
Your API requests must be authenticated using your credentials or API keys.
Gain access to a space
You can only operate in spaces that belong to your user or to one of your organizations. Review these relationships if your access is denied.
---> owner
 space
Obtain a valid media file
To upload a media file as an audio, it must meet the specified requirements.
---> file.mp3
Procedure
Encode the media file
You cannot directly upload the binary media file through the HTTP API. Instead, you must first encode it as a Base64 string. See the API reference.
<--- file.mp3
---> file.b64
The encoder showcased is the base64
CLI tool
available in most Linux distributions.
More encoding examples are provided in the API reference.
base64 -w 0 {file.mp3} >> {file.b64}
Upload the audio
Upload the Base64-encoded media file as an audio. See the API reference.
<--- owner
 space
 file.b64
Optionally, you may choose the alias
for the audio
.
---> ✦ audio
- Method — 
POST
- Path — 
/spaces/{owner}/{space}/audios
- Body — 
application/json
{
"file": "{file.b64}"
}
Validation
Validate the audio details
To validate that the audio has been correctly uploaded, retrieve and analyze its details. See the API reference.
<--- owner
 space
 audio
- Method — 
GET
- Path — 
/spaces/{owner}/{space}/audios/{audio}
Validate the binary file
To validate that the audio has been correctly uploaded, retrieve and listen to its binary file. See the API reference.
<--- owner
 space
 audio
---> file.wav
- Method — 
GET
- Path — 
/spaces/{owner}/{space}/audios/{audio}/file