If your media is local rather than a public URL, upload it first to create an Asset. Then reference the returned assetId when creating a Task.
Upload and create a Task
import requests
API_KEY = "your_api_key"
# 1. Upload the file
upload_res = requests.post(
"https://api.audioshake.ai/assets",
headers={"x-api-key": API_KEY},
files={"file": open("song.mp3", "rb")}
)
asset_id = upload_res.json()["id"]
print(f"Asset created: {asset_id}")
# 2. Create a Task using the assetId
task_res = requests.post(
"https://api.audioshake.ai/tasks",
headers={"Content-Type": "application/json", "x-api-key": API_KEY},
json={
"assetId": asset_id,
"targets": [
{"model": "vocals", "formats": ["wav"]},
{"model": "instrumental", "formats": ["wav"]}
]
}
)
task_id = task_res.json()["id"]
print(f"Task created: {task_id}")
const API_KEY = "your_api_key";
// 1. Upload the file
const formData = new FormData();
formData.append("file", fileBlob, "song.mp3");
const uploadRes = await fetch("https://api.audioshake.ai/assets", {
method: "POST",
headers: { "x-api-key": API_KEY },
body: formData
});
const { id: assetId } = await uploadRes.json();
console.log(`Asset created: ${assetId}`);
// 2. Create a Task using the assetId
const taskRes = await fetch("https://api.audioshake.ai/tasks", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": API_KEY
},
body: JSON.stringify({
assetId,
targets: [
{ model: "vocals", formats: ["wav"] },
{ model: "instrumental", formats: ["wav"] }
]
})
});
const { id: taskId } = await taskRes.json();
console.log(`Task created: ${taskId}`);
# 1. Upload the file
curl -X POST "https://api.audioshake.ai/assets" \
-H "x-api-key: $AUDIOSHAKE_API_KEY" \
-F 'file=@song.mp3'
# 2. Create a Task with the returned assetId
curl -X POST "https://api.audioshake.ai/tasks" \
-H "Content-Type: application/json" \
-H "x-api-key: $AUDIOSHAKE_API_KEY" \
-d '{
"assetId": "your_asset_id",
"targets": [
{ "model": "vocals", "formats": ["wav"] },
{ "model": "instrumental", "formats": ["wav"] }
]
}'
Then check Task status to monitor progress and download results.
Maximum file size is 2GB. Uploaded Assets expire after 72 hours.
See the Formats page for supported input file types.