How to Upload Media Files to the AudioStack API

Let's say you want to upload a media file to our API. In this example we're going to assume you have two mp3 files locally in a folder called mp3_files:

import audiostack
import os

BASE_URL = "http://v2.api.audio"
KEY = os.environ['AUDIOSTACK_API_KEY']
audiostack.api_base = BASE_URL
audiostack.api_key = KEY

file_1 = audiostack.Content.File.create(
    "mp3_files/file_1.mp3",
    uploadPath="audiofiles/file_1.mp3",
    fileType="audio",
)
file_2 = audiostack.Content.File.create(
    "mp3_files/file_2.mp3",
    uploadPath="audiofiles/file_2.mp3",
    fileType="audio",
)

You can now see all of your uploaded files in the AudioStack Platform.


What’s Next

Check out your files in the AudioStack Platform, and find out more about what you can do with them: