Typically the ability to download files from your site is governed by user permissions to ensure that your music is safe. With the API, however, you can download any of your files automatically. That means that anyone with access to your API key can download your whole site, so do not share it. If you think your key has been compromised, please reset it.
There are two types of downloading we support in the API. Direct calls to the API which return the file itself, which is suitable for downloading to your own servers for backup. However, if you wish your users to be able to download your files from SourceAudio, you don’t want them to have your authentication token, so we also support the ability to create an authorized download link, that will stay active for a specified time (10s default, 24h max). The usage here is that we expect you to generate this link server-side when requested, then forward your user to the result. You can also generate longer timed links on page load.
/api/tracks/download
Param
Required
Description
track_id
yes
The id of the track you wish to download
format
no
The format you wish to download, defaults to mp3
includeNested
no
Flag (0/1) indicating whether you’d like to download all alternate versions of the specified track. Defaults to 0, i.e. download only the track with the specified track_id
* The expected response is the file itself.
/api/tracks/downloadAuth
Param
Required
Description
track_id
yes
The id of the track you wish to download
format
no
The format you wish to download, defaults to mp3
duration
no
The time in seconds that the link should remain active. Default is 10, max is 86400
Get an embed code to be used to embed a track using our URL standard. It can be used to replace {YOUR_EMBED_CODE_HERE} in the src attribute of the below iframe HTML to embed a SourceAudio track in a web page. Also remember to replace yoursite.sourceaudio.com with your own SourceAudio domain.