When you submit a video generation task to the Runway API, you can use the callBackUrl parameter to set a callback URL. The system will automatically push the results to your specified address when the task is completed. Callback Mechanism Overview# The callback mechanism eliminates the need to poll the API for task status. The system will proactively push task completion results to your server.
Callback Timing# The system will send callback notifications in the following situations: AI video generation task completed successfully
AI video generation task failed
Errors occurred during task processing
Callback Method# Content Type : application/json
Timeout Setting : 15 seconds
When the task is completed, the system will send a POST request to your callBackUrl in the following format: {
"code" : 200 ,
"msg" : "All generated successfully." ,
"data" : {
"task_id" : "ee603959-debb-48d1-98c4-a6d1c717eba6" ,
"video_id" : "485da89c-7fca-4340-8c04-101025b2ae71" ,
"video_url" : "https://file.com/k/xxxxxxx.mp4" ,
"image_url" : "https://file.com/m/xxxxxxxx.png"
}
} Status Code Description# Parameter Description# Parameter Type Required Description codeinteger Yes Callback status code indicating task processing result msgstring Yes Status message providing detailed status description data.task_idstring Yes Task ID, consistent with the taskId returned when you submitted the task data.video_idstring Yes Generated video ID for identification and tracking data.video_urlstring No Accessible video URL, valid for 14 days . Empty on failure data.image_urlstring No Cover image URL of the generated video. Empty on failure
Status Code Details# Status Code Description 200 Success - Video generation completed successfully 400 Client Error - Inappropriate content, format error, quota limit, or other client-side issues 500 Server Error - Internal server error during video generation
Common Error Messages# Common error messages include: "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."
"Your prompt was caught by our AI moderator. Please adjust it and try again!"
Callback Reception Examples# Here are example codes for receiving callbacks in popular programming languages: Best Practices# Callback URL Configuration Recommendations
1.
Use HTTPS : Ensure your 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 a 200 status code as quickly as possible to avoid timeout
5.
Asynchronous Processing : Complex business logic should be processed asynchronously to avoid blocking callback response
6.
Immediate Download : Video URLs are valid for only 14 days, download and save files immediately upon success
Callback URL must be a publicly accessible address
Server must respond within 15 seconds, otherwise it will be considered a timeout
If 3 consecutive retries fail, the system will stop sending callbacks
Video URLs expire after 14 days - download immediately upon receiving callback
Please ensure the stability of callback processing logic to avoid callback failures due to exceptions
Handle both video_url and image_url fields for complete media management
Pay attention to error messages for specific failure reasons (content moderation, format issues, quotas)
Troubleshooting# If you do not receive callback notifications, please check the following: Alternative Solution# If you cannot use the callback mechanism, you can also use polling:
Poll Query Results
Use the get AI video details endpoint to regularly query task status. We recommend querying every 30 seconds.