Upload MIDI file
May 15, 2025 (November 16, 2026)
Table of contents
This endpoint uploads a MIDI file that can be used as a base for music generation in the POST music/song endpoint.
POST raw content using Make.com and similar nocode tools.
https://api.useapi.net/v1/tempolor/music/midi/?…
Request Headers
Authorization: Bearer {API token}
Content-Type: audio/midi or audio/x-midi
API tokenis required, see Setup useapi.net for details.Content-Typeis required, must beaudio/midioraudio/x-midi.
Query Parameters
-
user_idis optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required. -
nameis required. Specify a name for your MIDI file.
Responses
-
The MIDI file is immediately available to use in POST music/song by providing the returned
midiItemId.{ "isFirst": false, "midiRenderVO": { "opType": "upload", "ucid": "100198329", "midiItemId": "user:12345-tempolor:user_id-midi:abcdef123456789", "name": "my background music", "midiUrl": "https://..." } } -
{ "error": "Content-Type must be audio/midi or audio/x-midi", "code": 400 } -
{ "error": "Unauthorized", "code": 401 } -
596 Account signed out
TemPolor signed the account out, so its session ticket no longer works. The API stops using the account until you add it again with fresh credentials at POST accounts, see Setup TemPolor. Requests without
user_iduse your other accounts in the meantime.{ "error": "TemPolor signed out account 101441809 (You are currently logged out (400006)). Add it again with POST /v1/tempolor/accounts using fresh credentials, see https://useapi.net/docs/start-here/setup-tempolor", "code": 596 }If every account you have is in this state, a request without
user_idreturns 596 as well.
Model
The uploaded MIDI file, with the midiItemId to pass to POST music/song, its name and midiUrl.
The uploaded MIDI file, field by field
{ // TypeScript, all fields are optional
isFirst: boolean
midiRenderVO: {
opType: string
ucid: string
midiItemId: string
name: string
midiUrl: string
}
error: string
code: number
}
Examples
-
curl "https://api.useapi.net/v1/tempolor/music/midi/?name=my-background-music&user_id=<user_id>" \ -H "Authorization: Bearer …" \ -H "Content-Type: audio/midi" \ --data-binary @/path/to/your/background-music.mid -
const token = "API token"; const user_id = "Previously configured account"; const name = "my-background-music"; const apiUrl = `https://api.useapi.net/v1/tempolor/music/midi/?name=${name}&user_id=${user_id}`; let blob; /* // Example 1: Fetch MIDI from URL const midiUrl = "https://example.com/midi-files/background-music.mid"; const responseMidi = await fetch(midiUrl); blob = await responseMidi.blob(); */ /* // Example 2: Load MIDI from local file (Node.js) const fs = require('fs'); const midiFileName = "./background-music.mid"; blob = new Blob([fs.readFileSync(midiFileName)], { type: "audio/midi" }); */ /* // Example 3: Load from input file html element // <input id="midi-file" type="file" accept=".mid,.midi"> const midiFile = document.getElementById(`midi-file`); if (midiFile.files[0]) blob = midiFile.files[0]; */ const response = await fetch(apiUrl, { method: "POST", headers: { "Authorization": `Bearer ${token}`, "Content-Type": "audio/midi" }, body: blob }); const result = await response.json(); console.log("response", {response, result}); -
import requests token = "API token" user_id = "Previously configured account" name = "my-background-music" apiUrl = f"https://api.useapi.net/v1/tempolor/music/midi/?name={name}&user_id={user_id}" headers = { 'Authorization': f'Bearer {token}', 'Content-Type': 'audio/midi' } # # Example 1: Fetch MIDI from URL # midi_url = "https://example.com/midi-files/background-music.mid" # response_midi = requests.get(midi_url) # file_content = response_midi.content # # Example 2: Load MIDI from local file midi_file_path = "./background-music.mid" with open(midi_file_path, 'rb') as midi_file: file_content = midi_file.read() response = requests.post(apiUrl, headers=headers, data=file_content) print(response, response.json())