> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.videogen.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.videogen.io/_mcp/server.

# Translate a video's speech

POST https://api.videogen.io/v1/tools/dub-video
Content-Type: application/json

Translate the speech in a video into another language, keeping the original speakers' voices. Returns one translated video file. To build an editable project with one video per language, use `POST /v1/workflows/translate-video` instead.

Reference: https://docs.videogen.io/rest-api-reference/tools/dub-video

## Authentication

- `Authorization` header (bearer token, required) — API key from [app.videogen.io/api](https://app.videogen.io/api). The full key is only shown once when you create it.

## Request

### Body (application/json)

This endpoint expects a DubVideoRequest.

- `videoFileId` (string, required) — File id of the source video (e.g. `vg_file_...`), up to 8 minutes long. Upload a file first via `POST /v1/files/upload`, then pass the returned id here.
- `targetLanguage` (string, required) — Language to translate the speech into, as a language code (e.g. `es`, `fr`, `ja`). Must differ from `sourceLanguage`.
- `sourceLanguage` (string, optional, nullable) — Language spoken in the source video, as a language code (e.g. `en`). Omit or pass `null` to detect it automatically.
- `isOutputTemporary` (boolean, optional, default: false) — When true, generated files are temporary. Temporary files are guaranteed to be available for 24 hours, after which they may be archived at any time. Temporary files are not analyzed (no description, transcript, or embedding will be generated), so they will not appear in search results. Defaults to false.

## Response

### 202

Execution accepted; poll until complete.

- `toolExecutionId` (string, required) — Execution id (e.g. `vg_tool_...`).

## Examples

**Request**

```json
{
  "videoFileId": "vg_file_jzosm31OGi-bPE1eb3qLnA",
  "targetLanguage": "es"
}
```

**Response**

```json
{
  "toolExecutionId": "vg_tool_ccm3abc123defcm3xyz789ghi"
}
```

**SDK Code**

```typescript
import { VideoGen } from "@videogen/sdk";

const client = new VideoGen({ apiKey: "sk_videogen_live_..." });

await client.tools.dubVideo({
  videoFileId: "vg_file_jzosm31OGi-bPE1eb3qLnA",
  targetLanguage: "es",
});
```

```python
from videogen import VideoGen

client = VideoGen(api_key="sk_videogen_live_...")

client.tools.dub_video(
    video_file_id="vg_file_jzosm31OGi-bPE1eb3qLnA",
    target_language="es",
)
```