When you submit a video extension task to the Runway API, you can set a callback address through the callBackUrl parameter. After the task is completed, the system will automatically push the results to your specified address.

Callback Mechanism Overview

The callback mechanism eliminates the need to poll the API for task status. The system proactively pushes task completion results to your server.

Callback Timing

The system sends callback notifications in the following situations:
  • Video extension task successfully completed
  • Video extension task failed
  • Errors occurred during task processing

Callback Method

  • HTTP Method: POST
  • Content Type: application/json
  • Timeout: 15 seconds
  • Retry Mechanism: Retry 3 times after failure, with intervals of 1 minute, 5 minutes, and 15 minutes

Callback Request Format

After task completion, the system will send a POST request to your callBackUrl in the following format:
{
  "code": 200,
  "msg": "All generated successfully.",
  "data": {
    "image_url": "https://file.com/m/xxxxxxxx.png",
    "task_id": "ee603959-debb-48d1-98c4-a6d1c717eba6",
    "video_id": "485da89c-7fca-4340-8c04-101025b2ae71",
    "video_url": "https://file.com/k/xxxxxxx.mp4"
  }
}

Status Code Description

code
integer
required
Callback status code indicating task processing result:
Status CodeDescription
200Success - Request has been processed successfully
400Client Error - Request parameters are incorrect or content is inappropriate
500Server Error - An unexpected error occurred while processing the request
msg
string
required
Status message providing detailed status description. When code is 400, possible error messages include:
  • Get image info failed
  • Inappropriate content detected. Please replace the image or video
  • Incorrect image format
  • Please try again later. You can upgrade to Standard membership to start generating now
  • Reached the limit for concurrent generations
  • Unsupported width or height. Please adjust the size and try again
  • Upload failed due to network reasons, please re-enter
  • Your prompt was caught by our AI moderator. Please adjust it and try again!
  • Your prompt/negative prompt cannot exceed 2048 characters. Please check if your input is too long
  • Your video creation prompt contains NSFW content, which isn’t allowed under our policy. Kindly revise your prompt and generate again
data.task_id
string
required
Task ID, consistent with the taskId returned when you submitted the task
data.video_id
string
Video unique identifier (returned only on success)
data.video_url
string
Accessible video URL, valid for 14 days (returned only on success)
data.image_url
string
Cover image URL of the generated video (returned only on success)

Callback Reception Examples

Here are example codes for receiving callbacks in popular programming languages:
const express = require('express');
const fs = require('fs');
const https = require('https');
const app = express();

app.use(express.json());

app.post('/runway-extend-callback', (req, res) => {
  const { code, msg, data } = req.body;
  
  console.log('Received Runway video extension callback:', {
    taskId: data.task_id,
    status: code,
    message: msg
  });
  
  if (code === 200) {
    // Video extension successful
    const { task_id, video_id, video_url, image_url } = data;
    
    console.log('Video extension successful!');
    console.log(`Task ID: ${task_id}`);
    console.log(`Video ID: ${video_id}`);
    console.log(`Video URL: ${video_url}`);
    console.log(`Cover URL: ${image_url}`);
    
    // Download video file
    if (video_url) {
      downloadFile(video_url, `runway_extend_${task_id}.mp4`)
        .then(() => console.log('Video download successful'))
        .catch(err => console.error('Video download failed:', err));
    }
    
    // Download cover image
    if (image_url) {
      downloadFile(image_url, `runway_extend_cover_${task_id}.png`)
        .then(() => console.log('Cover download successful'))
        .catch(err => console.error('Cover download failed:', err));
    }
    
  } else {
    // Video extension failed
    console.log('Runway video extension failed:', msg);
    
    // Handle specific error types
    if (code === 400) {
      console.log('Client error - Check input parameters and content');
    } else if (code === 500) {
      console.log('Server error - Please try again later');
    }
  }
  
  // Return 200 status code to confirm callback received
  res.status(200).json({ code: 200, msg: 'success' });
});

// Helper function: Download file
function downloadFile(url, filename) {
  return new Promise((resolve, reject) => {
    const file = fs.createWriteStream(filename);
    
    https.get(url, (response) => {
      if (response.statusCode === 200) {
        response.pipe(file);
        file.on('finish', () => {
          file.close();
          resolve();
        });
      } else {
        reject(new Error(`HTTP ${response.statusCode}`));
      }
    }).on('error', reject);
  });
}

app.listen(3000, () => {
  console.log('Callback server running on port 3000');
});

Best Practices

Callback URL Configuration Recommendations

  1. Use HTTPS: Ensure callback URL uses HTTPS protocol for secure data transmission
  2. Verify Source: Verify the legitimacy of the request source in callback processing
  3. Idempotent Processing: The same task_id may receive multiple callbacks, ensure processing logic is idempotent
  4. Quick Response: Callback processing should return 200 status code promptly to avoid timeout
  5. Asynchronous Processing: Complex business logic should be processed asynchronously to avoid blocking callback response
  6. Timely Download: Video URLs are valid for only 14 days, please download and save promptly
  7. Extension Management: Properly manage extended video files and cover images

Important Reminders

  • Callback URL must be publicly accessible
  • Server must respond within 15 seconds, otherwise it will be considered timeout
  • After 3 consecutive retry failures, the system will stop sending callbacks
  • Video URLs are valid for only 14 days, please download and save to your storage system promptly
  • Ensure the stability of callback processing logic to avoid callback failures due to exceptions
  • Properly handle content moderation errors to ensure input content complies with platform policies
  • Extended videos are usually longer than original videos
  • Pay attention to concurrent generation limits to avoid submitting too many tasks simultaneously

Troubleshooting

If you don’t receive callback notifications, please check the following:

Extension-Specific Considerations

AI Video Extension Features

AI video extension functionality continues generation based on existing videos with the following characteristics:
  1. Duration Increase: Extended videos will be longer than original videos
  2. Style Continuation: The system tries to maintain the visual style and motion patterns of the original video
  3. Smooth Transition: Extended portions will naturally connect with the original video
  4. Quality Preservation: Extended video quality should be comparable to the original video
  5. Motion Coherence: Object movement and scene changes will maintain logical coherence
  6. URL Validity: Generated video URLs are valid for only 14 days

Alternative Approach

If you cannot use the callback mechanism, you can also use polling:

Poll Query Results

Use the Get AI Video Details interface to periodically query task status, recommended every 30 seconds.