Downloading Tracks

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

Expected Response

{
path: "https://d1ombmsyi1byit.cloudfront.net/4/6/9/2/0/2/9/4692029-4.mp3",
params: "Expires=1471965144&Signature=nMya2p5fEcVqzqpBRmAxL3M2rK28ti0k-kAEAoDMBsUO1cXGAZZT0mv4ENRsDRXKw-e0uyK8THYcdlmE5gP18R-bFED0SgaheLsW9EZD6ENPiGe-B6p6jfJxH8U0R11~Hsf3dukNGIQng7FuCTfeGhtIpLRpHHHgKrGJfXYzc3IRrS~NcpZc7vESJE4SRIU4Zz2RSRtAaUOErIJSEXV1RI8ZWQqhCtKF1BdJyW5rnnCpjXhQQz8jo9jR~yOl6iu1SOr9JgNP0FfVu7jSsD7xkHOgkB9guEKwke-IMC1za5kb8f2QRe2SUlQFs6N~ccV5LQZB0db9uxOJ-Xv7tXM02w__&Key-Pair-Id=APKAJ7O34GU4D2LHPXGA",
fullPath: "https://d1ombmsyi1byit.cloudfront.net/4/6/9/2/0/2/9/4692029-4.mp3?Expires=1471965144&Signature=nMya2p5fEcVqzqpBRmAxL3M2rK28ti0k-kAEAoDMBsUO1cXGAZZT0mv4ENRsDRXKw-e0uyK8THYcdlmE5gP18R-bFED0SgaheLsW9EZD6ENPiGe-B6p6jfJxH8U0R11~Hsf3dukNGIQng7FuCTfeGhtIpLRpHHHgKrGJfXYzc3IRrS~NcpZc7vESJE4SRIU4Zz2RSRtAaUOErIJSEXV1RI8ZWQqhCtKF1BdJyW5rnnCpjXhQQz8jo9jR~yOl6iu1SOr9JgNP0FfVu7jSsD7xkHOgkB9guEKwke-IMC1za5kb8f2QRe2SUlQFs6N~ccV5LQZB0db9uxOJ-Xv7tXM02w__&Key-Pair-Id=APKAJ7O34GU4D2LHPXGA",
type: "mp3",
duration: 10
}

Get A Track Embed Code

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.

<iframe style="width:640px;height:112px;border:2px solid #000000;overflow:hidden;" 
src="https://yoursite.sourceaudio.com/embed.php?code={YOUR_EMBED_CODE_HERE}&art=1&backgroundColor=5698C8&borderColor=000000&textColor=5698C8"
scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>
/api/tracks/getEmbedCode
Param Required Description
track_id yes The id of the track you wish to get an embed code for