curl --request POST \
--url https://api.kie.ai/api/v1/mp4/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"taskId": "taskId_774b9aa0422f",
"audioId": "e231****-****-****-****-****8cadc7dc",
"callBackUrl": "https://api.example.com/callback",
"author": "DJ Electronic",
"domainName": "music.example.com"
}
'import requests
url = "https://api.kie.ai/api/v1/mp4/generate"
payload = {
"taskId": "taskId_774b9aa0422f",
"audioId": "e231****-****-****-****-****8cadc7dc",
"callBackUrl": "https://api.example.com/callback",
"author": "DJ Electronic",
"domainName": "music.example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
taskId: 'taskId_774b9aa0422f',
audioId: 'e231****-****-****-****-****8cadc7dc',
callBackUrl: 'https://api.example.com/callback',
author: 'DJ Electronic',
domainName: 'music.example.com'
})
};
fetch('https://api.kie.ai/api/v1/mp4/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kie.ai/api/v1/mp4/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'taskId' => 'taskId_774b9aa0422f',
'audioId' => 'e231****-****-****-****-****8cadc7dc',
'callBackUrl' => 'https://api.example.com/callback',
'author' => 'DJ Electronic',
'domainName' => 'music.example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kie.ai/api/v1/mp4/generate"
payload := strings.NewReader("{\n \"taskId\": \"taskId_774b9aa0422f\",\n \"audioId\": \"e231****-****-****-****-****8cadc7dc\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"author\": \"DJ Electronic\",\n \"domainName\": \"music.example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kie.ai/api/v1/mp4/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"taskId_774b9aa0422f\",\n \"audioId\": \"e231****-****-****-****-****8cadc7dc\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"author\": \"DJ Electronic\",\n \"domainName\": \"music.example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kie.ai/api/v1/mp4/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"taskId\": \"taskId_774b9aa0422f\",\n \"audioId\": \"e231****-****-****-****-****8cadc7dc\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"author\": \"DJ Electronic\",\n \"domainName\": \"music.example.com\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "",
"data": {
"taskId": ""
}
}Create Music Video
Create a video with visualizations based on your generated music track.
curl --request POST \
--url https://api.kie.ai/api/v1/mp4/generate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"taskId": "taskId_774b9aa0422f",
"audioId": "e231****-****-****-****-****8cadc7dc",
"callBackUrl": "https://api.example.com/callback",
"author": "DJ Electronic",
"domainName": "music.example.com"
}
'import requests
url = "https://api.kie.ai/api/v1/mp4/generate"
payload = {
"taskId": "taskId_774b9aa0422f",
"audioId": "e231****-****-****-****-****8cadc7dc",
"callBackUrl": "https://api.example.com/callback",
"author": "DJ Electronic",
"domainName": "music.example.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
taskId: 'taskId_774b9aa0422f',
audioId: 'e231****-****-****-****-****8cadc7dc',
callBackUrl: 'https://api.example.com/callback',
author: 'DJ Electronic',
domainName: 'music.example.com'
})
};
fetch('https://api.kie.ai/api/v1/mp4/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kie.ai/api/v1/mp4/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'taskId' => 'taskId_774b9aa0422f',
'audioId' => 'e231****-****-****-****-****8cadc7dc',
'callBackUrl' => 'https://api.example.com/callback',
'author' => 'DJ Electronic',
'domainName' => 'music.example.com'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.kie.ai/api/v1/mp4/generate"
payload := strings.NewReader("{\n \"taskId\": \"taskId_774b9aa0422f\",\n \"audioId\": \"e231****-****-****-****-****8cadc7dc\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"author\": \"DJ Electronic\",\n \"domainName\": \"music.example.com\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.kie.ai/api/v1/mp4/generate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"taskId_774b9aa0422f\",\n \"audioId\": \"e231****-****-****-****-****8cadc7dc\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"author\": \"DJ Electronic\",\n \"domainName\": \"music.example.com\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.kie.ai/api/v1/mp4/generate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"taskId\": \"taskId_774b9aa0422f\",\n \"audioId\": \"e231****-****-****-****-****8cadc7dc\",\n \"callBackUrl\": \"https://api.example.com/callback\",\n \"author\": \"DJ Electronic\",\n \"domainName\": \"music.example.com\"\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "",
"data": {
"taskId": ""
}
}Usage Guide
- Use this endpoint to turn your audio tracks into visually appealing videos
- Add artist attribution and branding to your music videos
- Videos can be shared on social media or embedded in websites
Parameter Details
taskIdidentifies the original music generation taskaudioIdspecifies which audio track to visualize when multiple variations exist- Optional
authoranddomainNameadd customized branding to the video
Developer Notes
- Generated video files are retained for 14 days
- Videos are optimized for social media sharing
- Processing time varies based on audio length and server load
Authorizations
All APIs require authentication via Bearer Token.
Get API Key:
- 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
Unique identifier of the music generation task. This should be a taskId returned from either the "Generate Music" or "Extend Music" endpoints.
"taskId_774b9aa0422f"
Unique identifier of the specific audio track to visualize. This ID is returned in the callback data after music generation completes.
"e231****-****-****-****-****8cadc7dc"
The URL to receive music video generation task completion updates. Required for all music video generation requests.
- System will POST task status and results to this URL when video generation completes
- Callback includes the generated music video file URL with visual effects and branding
- Your callback endpoint should accept POST requests with JSON payload containing the video file location
- For detailed callback format and implementation guide, see Music Video Callbacks
- Alternatively, use the Get Music Video Details endpoint to poll task status
- To ensure callback security, see Webhook Verification Guide for signature verification implementation
"https://api.example.com/callback"
Artist or creator name to display as a signature on the video cover. Maximum 50 characters. This creates attribution for the music creator.
50"DJ Electronic"
Website or brand to display as a watermark at the bottom of the video. Maximum 50 characters. Useful for promotional branding or attribution.
50"music.example.com"
