Download generated music
May 15, 2025
Table of contents
This endpoint retrieves a download URL for a completed music generation job. The job_id
must be from a successfully completed generation job that can be verified with GET music/job_id
.
https://api.useapi.net/v1/tempolor/music/download/
job_id
Request Headers
Authorization: Bearer {API token}
API token
is required, see Setup useapi.net for details.
Path Parameters
job_id
is required. The job ID returned from a previous POST music/song or POST music/instrumental request.
Query Parameters
file_format
is optional. Specifies the format of the generated music to download.
Supported values:mp3
- MP3 format (default)wav
- WAV format (higher quality)stems
- ZIP archive containing separated stems (vocals, instruments, etc.)
Responses
-
{ "url": "https://ugc-cdn.api.instabeat.ai/ai_material/ai_material/mp3/abcdef123456789.mp3?auth_key=1747536678-0-0-9c67b3d5f8a2c41e0d7f6eab3f82fb45", "remainSeconds": 0 }
The download URL expires after
remainSeconds
seconds. -
{ "error": "Generation is not completed yet (0)", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "No record found for user:12345-tempolor:user_id-job:abcdef123456789", "code": 404 }
Model
{ // TypeScript, all fields are optional
url: string
remainSeconds: number
error: string
code: number
}
Examples
-
# Download in MP3 format (default) curl -H "Authorization: Bearer …" \ https://api.useapi.net/v1/tempolor/music/download/user:12345-tempolor:user_id-job:abcdef123456789 # Download in WAV format (higher quality) curl -H "Authorization: Bearer …" \ "https://api.useapi.net/v1/tempolor/music/download/user:12345-tempolor:user_id-job:abcdef123456789?file_format=wav" # Download stems (separated vocal, instruments, etc.) curl -H "Authorization: Bearer …" \ "https://api.useapi.net/v1/tempolor/music/download/user:12345-tempolor:user_id-job:abcdef123456789?file_format=stems"
-
const job_id = "user:12345-tempolor:user_id-job:abcdef123456789"; const token = "API token"; const file_format = "mp3"; // or "wav" or "stems" const apiUrl = `https://api.useapi.net/v1/tempolor/music/download/${job_id}?file_format=${file_format}`; const response = await fetch(apiUrl, { method: "GET", headers: { "Authorization": `Bearer ${token}` } }); const result = await response.json(); console.log("Download URL:", result.url); // Example of downloading the file async function downloadFile(downloadUrl, fileName) { const fileResponse = await fetch(downloadUrl); const blob = await fileResponse.blob(); // For browser environments const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.style.display = 'none'; a.href = url; a.download = fileName; document.body.appendChild(a); a.click(); window.URL.revokeObjectURL(url); // For Node.js environments // const fs = require('fs'); // const buffer = Buffer.from(await blob.arrayBuffer()); // fs.writeFileSync(fileName, buffer); } // If the request was successful, download the file if (result.url) { const fileName = `tempolor-music-${Date.now()}.${file_format === 'stems' ? 'zip' : file_format}`; await downloadFile(result.url, fileName); }
-
import requests import os job_id = "user:12345-tempolor:user_id-job:abcdef123456789" token = "API token" file_format = "mp3" # or "wav" or "stems" apiUrl = f"https://api.useapi.net/v1/tempolor/music/download/{job_id}?file_format={file_format}" headers = { "Authorization": f"Bearer {token}" } response = requests.get(apiUrl, headers=headers) result = response.json() print("Download URL:", result.get("url")) # Example of downloading the file def download_file(download_url, file_name): file_response = requests.get(download_url) with open(file_name, 'wb') as f: f.write(file_response.content) print(f"File downloaded as {file_name}") # If the request was successful, download the file if result.get("url"): if file_format == "stems": file_name = f"tempolor-music-{job_id.split(':')[-1]}.zip" else: file_name = f"tempolor-music-{job_id.split(':')[-1]}.{file_format}" download_file(result.get("url"), file_name)