Extend Video
curl --request POST \
--url https://api.legnext.ai/api/v1/extend-video \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"videoNo": 1,
"prompt": "<string>",
"callback": "<string>"
}
'import requests
url = "https://api.legnext.ai/api/v1/extend-video"
payload = {
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"videoNo": 1,
"prompt": "<string>",
"callback": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jobId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
videoNo: 1,
prompt: '<string>',
callback: '<string>'
})
};
fetch('https://api.legnext.ai/api/v1/extend-video', 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.legnext.ai/api/v1/extend-video",
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([
'jobId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'videoNo' => 1,
'prompt' => '<string>',
'callback' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.legnext.ai/api/v1/extend-video"
payload := strings.NewReader("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"videoNo\": 1,\n \"prompt\": \"<string>\",\n \"callback\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.legnext.ai/api/v1/extend-video")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"videoNo\": 1,\n \"prompt\": \"<string>\",\n \"callback\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.legnext.ai/api/v1/extend-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"videoNo\": 1,\n \"prompt\": \"<string>\",\n \"callback\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"message": "Invalid request parameters",
"raw_message": "Invalid request parameters",
"detail": null
}{
"code": 401,
"message": "Failed to verify api key",
"raw_message": "",
"detail": null
}{
"code": 402,
"message": "insufficient quota",
"raw_message": "insufficient quota",
"detail": null
}{
"code": 403,
"message": "Forbidden - Sensitive content detected",
"raw_message": "Forbidden - Sensitive content detected",
"detail": null
}{
"code": 413,
"message": "File size exceeds maximum limit",
"raw_message": "file too large",
"detail": null
}{
"code": 422,
"message": "Invalid parameter values",
"raw_message": "Invalid parameter values",
"detail": null
}{
"code": 429,
"message": "rate limit exceeded, please retry later",
"raw_message": "rate limit exceeded, please retry later",
"detail": null
}{
"code": 500,
"message": "Internal server error",
"raw_message": "Internal server error",
"detail": null
}Video Generation
Extend Video
Extend video duration with new frames
POST
/
v1
/
extend-video
Extend Video
curl --request POST \
--url https://api.legnext.ai/api/v1/extend-video \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"videoNo": 1,
"prompt": "<string>",
"callback": "<string>"
}
'import requests
url = "https://api.legnext.ai/api/v1/extend-video"
payload = {
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"videoNo": 1,
"prompt": "<string>",
"callback": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jobId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
videoNo: 1,
prompt: '<string>',
callback: '<string>'
})
};
fetch('https://api.legnext.ai/api/v1/extend-video', 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.legnext.ai/api/v1/extend-video",
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([
'jobId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'videoNo' => 1,
'prompt' => '<string>',
'callback' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.legnext.ai/api/v1/extend-video"
payload := strings.NewReader("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"videoNo\": 1,\n \"prompt\": \"<string>\",\n \"callback\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.legnext.ai/api/v1/extend-video")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"videoNo\": 1,\n \"prompt\": \"<string>\",\n \"callback\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.legnext.ai/api/v1/extend-video")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jobId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"videoNo\": 1,\n \"prompt\": \"<string>\",\n \"callback\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 400,
"message": "Invalid request parameters",
"raw_message": "Invalid request parameters",
"detail": null
}{
"code": 401,
"message": "Failed to verify api key",
"raw_message": "",
"detail": null
}{
"code": 402,
"message": "insufficient quota",
"raw_message": "insufficient quota",
"detail": null
}{
"code": 403,
"message": "Forbidden - Sensitive content detected",
"raw_message": "Forbidden - Sensitive content detected",
"detail": null
}{
"code": 413,
"message": "File size exceeds maximum limit",
"raw_message": "file too large",
"detail": null
}{
"code": 422,
"message": "Invalid parameter values",
"raw_message": "Invalid parameter values",
"detail": null
}{
"code": 429,
"message": "rate limit exceeded, please retry later",
"raw_message": "rate limit exceeded, please retry later",
"detail": null
}{
"code": 500,
"message": "Internal server error",
"raw_message": "Internal server error",
"detail": null
}Each extension adds 4 seconds to the video duration, with a maximum of 4 extensions (creating up to 21-second videos).
Headers
| Header | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | Your API key |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
jobId | string | Yes | ID of the original video generation task |
videoNo | integer | Yes | Video number to extend (0/1/2/3) |
prompt | string | No | Text prompt to guide the extension (1-8192 characters) |
callback | string | No | Callback URL for task completion notifications |
Example Request
curl -X POST "https://api.legnext.ai/api/v1/extend-video" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jobId": "b24ffa07-7b76-49a2-963e-f6c527f7cec7",
"videoNo": 0,
"prompt": "Continue with more dynamic movement and effects",
"callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
}'
import requests
url = "https://api.legnext.ai/api/v1/extend-video"
headers = {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"jobId": "b24ffa07-7b76-49a2-963e-f6c527f7cec7",
"videoNo": 0,
"prompt": "Continue with more dynamic movement and effects",
"callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
const response = await fetch('https://api.legnext.ai/api/v1/extend-video', {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
jobId: 'b24ffa07-7b76-49a2-963e-f6c527f7cec7',
videoNo: 0,
prompt: 'Continue with more dynamic movement and effects',
callback: 'https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d'
})
});
const result = await response.json();
console.log(result);
Response
Returns a task object containing the task information.{
"job_id": "e41e5586-dcee-4659-ae56-dbf19d20051a",
"model": "midjourney",
"task_type": "extend_video",
"status": "pending",
"config": {
"service_mode": "public",
"webhook_config": {
"endpoint": "https://webhook.site/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"secret": ""
}
},
"input": null,
"output": {
"video_urls": null,
"seed": ""
},
"meta": {
"created_at": "",
"started_at": "",
"ended_at": "",
"usage": {
"type": "point",
"frozen": 480,
"consume": 0
}
},
"detail": null,
"logs": [],
"error": {
"code": 0,
"raw_message": "",
"message": "",
"detail": null
}
}
This is the initial success response. Use the
job_id to check the task status via the Get Task endpoint to retrieve the completed result with video URLs.Authorizations
API key for authentication
Body
application/json
Response
Video extend task created successfully
⌘I