Skip to main content
POST
/
api
/
v1
/
midi
/
generate
Generate MIDI from Audio
curl --request POST \
  --url https://api.kie.ai/api/v1/midi/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "taskId": "5c79****be8e",
  "callBackUrl": "https://example.callback"
}'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "5c79****be8e"
  }
}

Usage Guide

  • Convert separated audio tracks into structured MIDI data containing pitch, timing, and velocity information
  • Requires a completed vocal separation task ID (from the Vocal Removal API)
  • Generates MIDI note data for multiple detected instruments including drums, bass, guitar, keyboards, and more
  • Ideal for music transcription, notation, remixing, or educational analysis
  • Best results on clean, well-separated audio tracks with clear instrument parts

Prerequisites

You must first use the Vocal & Instrument Stem Separation API to separate your audio before generating MIDI.

Parameter Reference

NameTypeDescription
taskIdstringRequired. Task ID from a completed vocal separation
callBackUrlstringRequired. URL to receive MIDI generation completion notifications

Developer Notes

  • The callback will contain detailed note data for each detected instrument
  • Each note includes: pitch (MIDI note number), start (seconds), end (seconds), velocity (0-1)
  • Not all instruments may be detected - depends on audio content
  • Billing: Check current per-call credit costs at https://kie.ai/billing

Authorizations

Authorization
string
header
required

All APIs require authentication via Bearer Token.

Get API Key:

  1. Visit API Key Management Page to get your API Key

Usage: Add to request header: Authorization: Bearer YOUR_API_KEY

Note:

  • Keep your API Key secure and do not share it with others
  • If you suspect your API Key has been compromised, reset it immediately in the management page

Body

application/json
taskId
string
required

Task ID from a completed vocal separation. This should be the taskId returned from the Vocal & Instrument Stem Separation endpoint.

Example:

"5c79****be8e"

callBackUrl
string<uri>
required

The URL to receive MIDI generation task completion updates. Required for all MIDI generation requests.

  • System will POST task status and MIDI note data to this URL when generation completes
  • Callback includes detailed note information for each detected instrument with pitch, timing, and velocity
  • Your callback endpoint should accept POST requests with JSON payload containing MIDI data
  • For detailed callback format and implementation guide, see MIDI Generation Callbacks
  • Alternatively, use the Get MIDI Generation Details endpoint to poll task status
Example:

"https://example.callback"

Response

MIDI generation task created successfully

code
integer

Response status code

Example:

200

msg
string

Response message

Example:

"success"

data
object

Response data containing task information

I