Video Translate
Video Translate by HeyGen provides a powerful solution for effortlessly translating videos, integrating natural voice cloning and authentic speaking styles seamlessly. Now you can harness its capabilities programmatically through the Video Translate API endpoint!
The video_translate endpoint is available to Scale and Enterprise-tier HeyGen API plan customers.
Quick Guide
Here's a quick guide on utilizing the Video Translate API:
1. List Supported Languages
See detailed API reference
Before translating a video, you can obtain a list of supported languages using the following API request:
curl --location 'https://api.heygen.com/v2/video_translate/target_languages' \
--header 'accept: application/json' \
--header 'x-api-key: <your-api-key>'
{
"error": null,
"data": {
"languages": [
"English",
"English - Your Accent",
...
]
}
}
This helps you identify the languages available for translation, which you'll use in the output_language
parameter in the next step.
2. Translate the Video
See detailed API reference
To translate a video, make a request to the video translate endpoint with the necessary parameters:
curl --location 'https://api.heygen.com/v2/video_translate' \
--header 'accept: application/json' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"video_url": "<video_url>",
"output_language": "<output_language>",
"title": "New Video"
}'
{
"error": null,
"data": {
"video_translate_id": "<video_translate_id>"
}
}
Ensure to replace <your-api-key>
, <video_url>
and <output_language>
with your API key, the URL of the video you want to translate, and the desired output language, respectively. This request returns a video_translate_id
that you'll use to check the video status.
3. Check the Video Translation Status
See detailed API reference
To monitor the status of the video translation, make the following request:
curl --location 'https://api.heygen.com/v2/video_translate/<video_translate_id>' \
--header 'accept: application/json' \
--header 'x-api-key: <your-api-key>'
{
"error": null,
"data": {
"video_translate_id": "<video_translate_id>",
"title": "New Video",
"status": "success",
"url": "<url>",
"message": null
}
}
{
"error": null,
"data": {
"video_translate_id": "<video_translate_id>",
"title": "New Video",
"status": "failed",
"url": null,
"message": "<message>"
}
}
{
"error": null,
"data": {
"video_translate_id": "<video_translate_id>",
"title": "New Video",
"status": "pending",
"url": null,
"message": null
}
}
{
"error": null,
"data": {
"video_translate_id": "<video_translate_id>",
"title": "New Video",
"status": "running",
"url": null,
"message": null
}
}
Based on the response, you can determine whether the translation is successful, failed, pending, or still running. If successful, you'll receive the URL of the translated video file.
The video file URL you get will expire in 7 days. 📆
You can observe this expiration in the URL parameters. Every time you call the video status endpoint, the
Expires
and other queries are regenerated accordingly.
Conclusion
The Video Translate API streamlines the process of translating videos programmatically, opening up possibilities for reaching global audiences with content in their native languages. Whether you're creating multilingual content or enhancing accessibility, this API provides a robust and efficient solution. Visit HeyGen's Video Translate page for more details and to explore the capabilities of this service.
Updated 22 days ago