Extend the video by 4 seconds
August 8, 2024 (October 18, 2024)
Table of contents
Runway AI Tools » Audio tools » Text/Image to Video » Gen-2 » Extend Video.
https://api.useapi.net/v1/runwayml/gen2/extend
Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
# Alternatively you can use multipart/form-data
# Content-Type: multipart/form-data
API token
is required, see Setup useapi.net for details.
Request Body
{
"assetId": "Required assetId of video asset you want to extend",
"interpolate": true,
"motion": 10,
"horizontal": -10,
"vertical": -5,
"roll": -1,
"zoom": 2,
"pan": 5,
"tilt": 10,
"seed": 12345678,
"exploreMode": true,
"replyUrl": "Place your call back URL here",
"replyRef": "Place your reference id here",
"maxJobs": 5,
}
-
assetId
is required. Specify the video assetId you want extend. Use GET /assets/?mediaType=video to see the list of video assets. To upload a new video asset use POST /assets. -
interpolate
is optional.
Supported values:true
(default),false
. -
motion
is optional. Increase or decrease the intensity of motion in your video. Higher values result in more motion. This parameter is not compatible with other motion parameters below.
Supported values: 1…10. -
horizontal
is optional. Specify horizontal motion.
Supported values: -10…10. -
vertical
is optional. Specify vertical motion.
Supported values: -10…10. -
roll
is optional. Specify roll motion.
Supported values: -10…10. -
zoom
is optional. Specify zoom motion.
Supported values: -10…10. -
pan
is optional. Specify pan motion.
Supported values: -10…10. -
tilt
is optional. Specify tilt motion.
Supported values: -10…10. -
seed
is optional.
Valid range 1…4294967294. -
exploreMode
is optional. Set totrue
if you have a Runway Unlimited plan and wish to execute relaxed generation. You are not charged credits for Explore mode generations. -
replyUrl
is optional, if not provided value from account will be used.
Place here your callback URL. API will call the providedreplyUrl
once Runway task completed or failed.
Maximum length 1024 characters.
We recommend using sites like webhook.site to test callback URL functionality. -
replyRef
is optional, place here your reference id which will be stored and returned along with this Runway task response / result.
Maximum length 1024 characters. -
maxJobs
is optional, if not provided value for referenced by video assetId account will be used.
Valid range: 1…10.
Responses
-
Use returned
taskId
to retrieve task status and results using GET /tasks/taskId
. The generated videourl
can be found in theartifacts
array of the task with the statusSUCCEEDED
.If you specify the optional parameter
replyUrl
the API will call the providedreplyUrl
with task progress updates until the task is complete or fails.{ "taskId": "user:user_id-runwayml:account_email-task:task_uuid", "id": "<uuid>", "name": "<name>", "image": null, "createdAt": "2024-08-01T01:02:03.456Z", "updatedAt": "2024-08-01T01:02:03.456Z", "taskType": "gen2", "options": { "name": "<name>", "seconds": 4, "gen2Options": { "mode": "gen2", "seed": 12345678, "interpolate": true, "upscale": true, "watermark": false, "motion_score": 22, "use_motion_score": true, "use_motion_vectors": false, "init_video": "<original video url>", "extended_from_task_id": "<user:user_id-runwayml:account_email-task:parent_task_uuid>" }, "exploreMode": false, "assetGroupName": "Generative Video", "recordingEnabled": true }, "status": "PENDING", "error": null, "progressText": null, "progressRatio": null, "estimatedTimeToStartSeconds": 0, "artifacts": [], "sharedAsset": null, "features": { "storageGB": 500, "numPlanCredits_permitted": 2250, "numPlanCredits_used": 1315 }, "replyUrl": "https://webhook.site/abc", "replyRef": "<your optional reference id>", "code": 200 }
-
{ "error": "<Error message>", "code": 400 }
-
{ "error": "Unauthorized", "code": 401 }
-
{ "error": "Unable to retrieve assetId <uuid> (Not found.)", "code": 404 }
-
You do not have enough credits to run this task.
{ "error": "You do not have enough credits to run this task." }
-
Wait in a loop for at least 10..30 seconds and retry again.
There are two possible cases for API response 429:
- API query is full and can not accept new gen2/extend requests. Size of query defined by
maxJobs
optional parameter.
{ "error": "Account <Runway account email> is busy executing <Account maxJobs> tasks", "runningTasks": { "<Runway account email>": [ { "email": "<Runway account email>", "taskId": "user:user_id-runwayml:account_email-task:task_#1_uuid", "id": "<uuid>", "replyUrl": "<replyUrl if provided>", "replyRef": "<replyRef if provided>" }, { "email": "<Runway account email>", "taskId": "user:user_id-runwayml:account_email-task:task_#N_uuid", "id": "<uuid>", "replyUrl": "<replyUrl if provided>", "replyRef": "<replyRef if provided>" } ] }, "code": 429 }
- The API received an HTTP response status 429 from Runway. Runway has dynamic query management and may limit the number of simultaneously executed tasks based on internal service load and policies.
{ "error": "You have too many tasks running or pending. Please wait for some of them to finish before starting more." }
- API query is full and can not accept new gen2/extend requests. Size of query defined by
Model
{ // TypeScript, all fields are optional
taskId: string,
id: string,
name: string,
image: any,
createdAt: string,
updatedAt: string,
taskType: string,
options: {
name: string,
seconds: number,
gen2Options: {
mode: string,
seed: number,
interpolate: boolean,
upscale: boolean,
watermark: boolean,
motion_score: number,
use_motion_score: boolean,
use_motion_vectors: boolean,
motion_vector: {
x: number,
y: number,
r: number,
z: number,
bg_x_pan: number,
bg_y_pan: number
},
init_video: string,
extended_from_task_id: string
},
exploreMode: boolean,
assetGroupName: string,
recordingEnabled: boolean
},
status: string,
progressText: any,
progressRatio: any,
estimatedTimeToStartSeconds: number,
artifacts: any[],
sharedAsset: any,
features: {
storageGB: number,
numPlanCredits_permitted: number,
numPlanCredits_used: number
},
error: {
errorMessage: string,
reason: string,
message: string,
moderation_category: string,
tally_asimov: boolean
},
code: number,
replyUrl: string,
replyRef: string
}
Examples
-
curl -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer …" \ -X POST "https://api.useapi.net/v1/runwayml/gen2/extend" \ -d '{"assetId": "…" }'
-
const assetId = "assetId of video asset"; const apiUrl = `https://api.useapi.net/v1/runwayml/gen2/extend`; const token = "API token"; const data = { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }; data.body = JSON.stringify({ assetId }); const response = await fetch(apiUrl, data); const result = await response.json(); console.log("response", {response, result});
-
import requests assetId = "assetId of video asset" apiUrl = f"https://api.useapi.net/v1/runwayml/gen2/extend" token = "API token" headers = { "Content-Type": "application/json", "Authorization" : f"Bearer {token}" } body = { "assetId": f"{assetId}" } response = requests.post(apiUrl, headers=headers, json=body) print(response, response.json())