Create instrumental music
May 15, 2025
Table of contents
This endpoint generates instrumental music based on a text prompt and optional musical parameters.
https://api.useapi.net/v1/tempolor/music/instrumental
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"prompt": "A relaxing lo-fi beat with piano and soft drums",
"tonality": "C:major",
"bpm": 80,
"chords": "C F G Am"
}
-
prompt
is required, a text description of the desired instrumental music.
Maximum length 2000 characters. model_instrumental
is optional, the model to use for generation.
Supported values:i3
- Superior music structure, max 2 mini3.5 beta
- Richer arrangements, max 4.5 mins (default)
-
tonality
is optional, the musical key for the composition.
Supported values:A:major
,A:minor
,Ab:major
,Ab:minor
,B:major
,B:minor
,Bb:major
,Bb:minor
,C#:major
,C#:minor
,C:major
,C:minor
,D:major
,D:minor
,E:major
,E:minor
,Eb:major
,Eb:minor
,F#:major
,F#:minor
,F:major
,F:minor
,G:major
,G:minor
-
bpm
is optional, the tempo in beats per minute.
Valid range: 50…190. -
chords
is optional, chord progression for the composition.
Maximum length 200 characters. -
user_id
is optional, if not specified, the API will use the account from your request. -
replyUrl
is optional, a callback URL that will be called with generation progress updates.
Maximum length 1024 characters.
We recommend using sites like webhook.site to test callback URL functionality. -
replyRef
is optional, a reference ID that will be included in the callback requests.
Maximum length 1024 characters. maxJobs
is optional; it specifies the maximum number of concurrent jobs for this request. If not provided, the value will be taken from the account configuration set in POST accounts.
Responses
-
Use the returned
jobs
values to retrieve generation status and results using GET music/job_id
.If you specify the optional parameter
replyUrl
, the API will call the providedreplyUrl
with generation progress updates until the generation is complete or fails.{ "result": true, "itemIds": [ "abcdef123456789", "fedcba987654321" ], "jobs": [ "user:12345-tempolor:user_id-job:abcdef123456789", "user:12345-tempolor:user_id-job:fedcba987654321", ], "remainSeconds": 21533, "maxGenCountAtOnce": 10, "unlimited": false, "remainNum": 1534, "totalNum": 3000 }
-
{ "error": "Parameter prompt is required", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Subscription required", "code": 402 }
-
Wait in a loop for at least 30 seconds and retry again.
There are two possible cases for API response 429:
- API query is full and cannot accept new instrumental music generation requests. Size of queue defined by the
maxJobs
value from either the request body or the default from the account configuration set in POST accounts.{ "error": "Account <user_id> is busy executing X jobs", "runningJobs": { "<user_id>": [ { "user_id": "<user_id>", "job_id": "<job_id>", "started": 1715791234567, "replyUrl": "call back URL here, if provided", "replyRef": "reference id here, if provided" } ] }, "code": 429 }
- The API received an HTTP response status 429 from TemPolor.
{ "error": "please wait for current Generations to finish or upgrade your plan", "code": 429 }
- API query is full and cannot accept new instrumental music generation requests. Size of queue defined by the
Model
{ // TypeScript, all fields are optional
result: boolean
itemIds: string[]
jobs: string[]
remainSeconds: number
maxGenCountAtOnce: number
unlimited: boolean
remainNum: number
totalNum: number
}
Examples
-
curl -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -X POST https://api.useapi.net/v1/tempolor/music/instrumental \ -d '{"prompt": "A relaxing lo-fi beat with piano and soft drums"}'
-
const apiUrl = `https://api.useapi.net/v1/tempolor/music/instrumental`; const api_token = "API token"; const prompt = "A relaxing lo-fi beat with piano and soft drums"; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${api_token}`, 'Content-Type': 'application/json' } }; data.body = JSON.stringify({ prompt }); const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", {response, result});
-
import requests apiUrl = f"https://api.useapi.net/v1/tempolor/music/instrumental" api_token = "API token" prompt = "A relaxing lo-fi beat with piano and soft drums" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {api_token}" } body = { "prompt": f"{prompt}" } response = requests.post(apiUrl, headers=headers, json=body) print(response, response.json())