List MIDI files
May 15, 2025
Table of contents
This endpoint retrieves a list of MIDI files that you’ve previously uploaded using POST music/midi. These MIDI files can be used as templates for music generation with POST music/song.
https://api.useapi.net/v1/tempolor/music/midi/?…
Request Headers
Authorization: Bearer {API token}
API token
is required, see Setup useapi.net for details.
Query Parameters
-
user_id
is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required. -
cursor
is optional. Pagination cursor for fetching additional pages of results.
Responses
-
{ "records": [ { "opType": "upload", "ucid": "user_id", "midiItemId": "user:12345-tempolor:user_id-midi:abcdef123456789", "name": "Piano Composition", "midiUrl": "https://ugc-cdn.api.instabeat.ai/midi/file/abcdef123456789.mid" }, { "opType": "upload", "ucid": "user_id", "midiItemId": "user:12345-tempolor:user_id-midi:fedcba987654321", "name": "Guitar Progression", "midiUrl": "https://ugc-cdn.api.instabeat.ai/midi/file/fedcba987654321.mid" } ], "hasNext": false, "cursor": "" }
-
{ "error": "Unauthorized", "code": 401 }
Model
{ // TypeScript, all fields are optional
records: {
opType: string
ucid: string
midiItemId: string
name: string
midiUrl: string
midiType?: string
midiValue?: string
}[]
hasNext: boolean
cursor: string
error: string
code: number
}
Examples
-
# List all MIDI files curl -H "Authorization: Bearer …" \ https://api.useapi.net/v1/tempolor/music/midi/?user_id=user_id # Paginate through results using cursor curl -H "Authorization: Bearer …" \ "https://api.useapi.net/v1/tempolor/music/midi/?user_id=user_id&cursor=next_page_cursor_token"
-
const token = "API token"; const user_id = "user_id"; const cursor = ""; // for pagination // Build the URL with query parameters let apiUrl = `https://api.useapi.net/v1/tempolor/music/midi/?user_id=${user_id}`; if (cursor) apiUrl += `&cursor=${cursor}`; const response = await fetch(apiUrl, { method: "GET", headers: { "Authorization": `Bearer ${token}` } }); const result = await response.json(); console.log(`Found ${result.records?.length || 0} MIDI files`); // Example of fetching all pages async function fetchAllMidiFiles(userId) { let allRecords = []; let nextCursor = ""; let hasMore = true; while (hasMore) { let url = `https://api.useapi.net/v1/tempolor/music/midi/?user_id=${userId}`; if (nextCursor) url += `&cursor=${nextCursor}`; const response = await fetch(url, { method: "GET", headers: { "Authorization": `Bearer ${token}` } }); const data = await response.json(); if (data.records && data.records.length > 0) { allRecords = [...allRecords, ...data.records]; } hasMore = data.hasNext; nextCursor = data.cursor; // Break if no more pages or no cursor if (!hasMore || !nextCursor) break; } return allRecords; }
-
import requests token = "API token" user_id = "user_id" cursor = "" # for pagination # Build the URL with query parameters apiUrl = f"https://api.useapi.net/v1/tempolor/music/midi/?user_id={user_id}" if cursor: apiUrl += f"&cursor={cursor}" headers = { "Authorization": f"Bearer {token}" } response = requests.get(apiUrl, headers=headers) result = response.json() print(f"Found {len(result.get('records', []))} MIDI files") # Example of fetching all pages def fetch_all_midi_files(user_id): all_records = [] next_cursor = "" has_more = True while has_more: url = f"https://api.useapi.net/v1/tempolor/music/midi/?user_id={user_id}" if next_cursor: url += f"&cursor={next_cursor}" response = requests.get(url, headers=headers) data = response.json() if data.get('records'): all_records.extend(data.get('records')) has_more = data.get('hasNext', False) next_cursor = data.get('cursor', "") # Break if no more pages or no cursor if not has_more or not next_cursor: break return all_records