> ## Documentation Index
> Fetch the complete documentation index at: https://docstest.akool.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Video Translation

<Warning>
  The resources (image, video, voice) generated by our API are valid for 7 days.
  Please save the relevant resources as soon as possible to prevent expiration.
</Warning>

<Info>
  Experience our video translation technology in action by exploring our interactive demo on GitHub: [AKool Video Translation Demo](https://github.com/AKOOL-Official/akool-video-translation-demo).
</Info>

### Get Language List Result

```
GET https://openapi.akool.com/api/open/v3/language/list
```

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                               |
| ------------- | ---------------- | --------------------------------------------------------------------------------------------- |
| Authorization | Bearer `{token}` | Your API Key used for request authorization. [Get Token](/authentication/usage#get-the-token) |

**Response Attributes**

| **Parameter** | **Type** | **Value**                                                      | **Description**                                      |
| ------------- | -------- | -------------------------------------------------------------- | ---------------------------------------------------- |
| code          | int      | 1000                                                           | Interface returns business status code(1000:success) |
| msg           | String   | OK                                                             | Interface returns status information                 |
| data          | Array    | `{ lang_list:[ {"lang_code":"en", "lang_name": "English" } ]}` | lang\_code: Lang code supported by video translation |

**Example**

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/language/list' \
  --header 'Authorization: Bearer {{Authorization}}'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("text/plain");
  RequestBody body = RequestBody.create(mediaType, "");
  Request request = new Request.Builder()
    .url("https://openapi.akool.com/api/open/v3/language/list")
    .method("GET", body)
    .addHeader("Authorization", "Bearer {{Authorization}}")
    .build();
  Response response = client.newCall(request).execute();
  ```

  ```js Javascript theme={null}
  const myHeaders = new Headers();
  myHeaders.append("Authorization", "Bearer {{Authorization}}");

  const requestOptions = {
    method: "GET",
    headers: myHeaders,
    redirect: "follow",
  };

  fetch("https://openapi.akool.com/api/open/v3/language/list", requestOptions)
    .then((response) => response.text())
    .then((result) => console.log(result))
    .catch((error) => console.error(error));
  ```

  ```php PHP theme={null}
  <?php
  $client = new Client();
  $headers = [
    'Authorization' => '{{Authorization}}'
  ];
  $request = new Request('GET', 'https://openapi.akool.com/api/open/v3/language/list', $headers);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

  ```python Python theme={null}
  import requests

  url = "https://openapi.akool.com/api/open/v3/language/list"

  payload = {}
  headers = {
    'Authorization': 'Bearer {{Authorization}}'
  }

  response = requests.request("GET", url, headers=headers, data=payload)

  print(response.text)
  ```
</CodeGroup>

**Response**

```json theme={null}
{
    "code": 1000,
    "msg": "OK",
    "data": {
        "lang_list": [
            {
                "lang_code": "en",
                "lang_name": "English",
                "url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/icons/En.png"
            },
            {
                "lang_code": "fr",
                "lang_name": "French",
                "url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/icons/Fr.png"
            },
            {
                "lang_code": "zh",
                "lang_name": "Chinese (Simplified)",
                "url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/icons/Zh.png"
            }
    ]
}
```

### Create video translation

```
POST https://openapi.akool.com/api/open/v3/content/video/createbytranslate
```

**Request Headers**

| **Parameter**       | **Value**        | **Description**                                                                               |
| ------------------- | ---------------- | --------------------------------------------------------------------------------------------- |
| Authorization       | Bearer `{token}` | Your API Key used for request authorization. [Get Token](/authentication/usage#get-the-token) |
| **Body Attributes** |                  |                                                                                               |

| **Parameter**       | **Type** | **Value**  | **Description**                                                                                                                |
| ------------------- | -------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------ |
| url                 | String   |            | The video url address you want to translate.                                                                                   |
| source\_language    | String   |            | The original language of the video.                                                                                            |
| language            | String   |            | The language you want to translate into.                                                                                       |
| lipsync             | Boolean  | true/false | Get synchronized mouth movements with the audio track in a translated video.                                                   |
| ~~merge\_interval~~ | Number   | 1          | The segmentation interval of video translation, the default is 1 second. ***This field is deprecated***                        |
| ~~face\_enhance~~   | Boolean  | true/false | Whether to facial process the translated video, this parameter only works when lipsync is true. ***This field is deprecated*** |
| webhookUrl          | String   |            | Callback url address based on HTTP request.                                                                                    |
| speaker\_num        | Number   | 0          | Number of speakers in the video, the default is 0 (Auto Detect).                                                               |

**Response Attributes**

| **Parameter** | **Type** | **Value**                                       | **Description**                                                                                                                                         |
| ------------- | -------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| code          | int      | 1000                                            | Interface returns business status code(1000:success)                                                                                                    |
| msg           | String   |                                                 | Interface returns status information                                                                                                                    |
| data          | Object   | `{ "_id": "", "video_status": 1, "video": "" }` | `id`: Interface returns data, video\_status: the status of video： \[1:queueing, 2:processing, 3:completed, 4:failed], video: the url of Generated video |

**Example**

**Body**

```json theme={null}
{
  "url": "https://drz0f01yeq1cx.cloudfront.net/1710470596011-facebook.mp4", //  The video address you want to translate
  "language": "hi", // The language you want to translate into
  "source_language": "zh", // The original language of the video.
  "lipsync": true, //  Get synchronized mouth movements with the audio track in a translated video.
  //"merge_interval": 1, // This field is deprecated
  //"face_enhance": true, //  Whether to facial process the translated video, this parameter only works when lipsync is true. This field is deprecated
  "webhookUrl": "", //  Callback url address based on HTTP request
  "speaker_num": 1
}
```

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/content/video/createbytranslate' \
  --header 'Authorization: Bearer token' \
  --header 'Content-Type: application/json' \
  --data '{
      "url": "https://drz0f01yeq1cx.cloudfront.net/1710470596011-facebook.mp4",
      "source_language": "zh",
      "language": "hi",
      "lipsync":true,
      "speaker_num": 1,
      "webhookUrl":""
  }'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\n    \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1710470596011-facebook.mp4\", \n    \"language\": \"hi\", \n    \"source_language\": \"zh\", \n    \"lipsync\":true, \n    \"speaker_num\":1, \n    \"webhookUrl\":\"\"   \n}");
  Request request = new Request.Builder()
    .url("https://openapi.akool.com/api/open/v3/content/video/createbytranslate")
    .method("POST", body)
    .addHeader("Authorization", "Bearer token")
    .addHeader("Content-Type", "application/json")
    .build();
  Response response = client.newCall(request).execute();
  ```

  ```js Javascript theme={null}
  const myHeaders = new Headers();
  myHeaders.append("Authorization", "Bearer token");
  myHeaders.append("Content-Type", "application/json");

  const raw = JSON.stringify({
    url: "https://drz0f01yeq1cx.cloudfront.net/1710470596011-facebook.mp4",
    language: "hi",
    source_language: "zh",
    lipsync: true,
    webhookUrl: "",
    speaker_num: 1,
  });

  const requestOptions = {
    method: "POST",
    headers: myHeaders,
    body: raw,
    redirect: "follow",
  };

  fetch(
    "https://openapi.akool.com/api/open/v3/content/video/createbytranslate",
    requestOptions
  )
    .then((response) => response.text())
    .then((result) => console.log(result))
    .catch((error) => console.error(error));
  ```

  ```php PHP theme={null}
  <?php
  $client = new Client();
  $headers = [
    'Authorization' => 'Bearer token',
    'Content-Type' => 'application/json'
  ];
  $body = '{
    "url": "https://drz0f01yeq1cx.cloudfront.net/1710470596011-facebook.mp4",
    "language": "hi",
    "source_language": "zh",
    "lipsync": true,
    "speaker_num": 1,
    "webhookUrl": ""
  }';
  $request = new Request('POST', 'https://openapi.akool.com/api/open/v3/content/video/createbytranslate', $headers, $body);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://openapi.akool.com/api/open/v3/content/video/createbytranslate"

  payload = json.dumps({
    "url": "https://drz0f01yeq1cx.cloudfront.net/1710470596011-facebook.mp4",
    "language": "hi",
    "source_language": "zh",
    "lipsync": true,
    "speaker_num": 1,
    "webhookUrl": ""
  })
  headers = {
    'Authorization': 'Bearer token',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  ```
</CodeGroup>

**Response**

```json theme={null}
{
    "code": 1000,
    "msg": "OK",
    "data": {
        "_id": "68ccee42e267570255824ab5",
        "create_time": 1758260802773,
        "uid": 101400,
        "team_id": "6805fb69e92d9edc7ca0b409",
        "target_video": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/translate/cut3_content_create_EN_01.mp4",
        "language": "zh",
        "source_language": "en",
        "video_id": "68ccee42f392598dae31999b",
        "video_status": 1, // current status of video： 【1：queueing（The requested operation is being processed），2：processing（The requested operation is being processing），3：completed（The request operation has been processed successfully），4：failed（The request operation processing failed, the reason for the failure can be viewed in the video translation details.）】
        "video_lock_duration": 16.44,
        "deduction_lock_duration": 4,
        "video": "",
        "credentialId": "6823024be0c8e98471611c72",
        "task_id": "68ccee42f392598dae31999b",
        "target_video_md5": "md5_1758260802301",
        "lipsync": false,
        "lipSyncType": 0,
        "speaker_num": 1,
        "webhookUrl": ""
    }
}
```

### Get Video Info Result

```
GET https://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64dd838cf0b6684651e90217
```

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                              |
| ------------- | ---------------- | -------------------------------------------------------------------------------------------- |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[Get Token](/authentication/usage#get-the-token) |

**Query Attributes**

| **Parameter**    | **Type** | **Value** | **Description**                                                                                                                                          |
| ---------------- | -------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| video\_model\_id | String   | NULL      | video db id: You can get it based on the `_id` field returned by [Create By Translate API](/ai-tools-suite/video-translation#create-video-translation) . |

**Response Attributes**

| **Parameter** | **Type** | **Value**                              | **Description**                                                                                                                                       |
| ------------- | -------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| code          | int      | 1000                                   | Interface returns business status code(1000:success)                                                                                                  |
| msg           | String   | OK                                     | Interface returns status information                                                                                                                  |
| data          | Object   | `{ video_status:1, _id:"", video:"" }` | video\_status: the status of video：【1:queueing, 2:processing, 3:completed, 4:failed】 video: Generated video resource url \_id: Interface returns data |

**Example**

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'http://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64b126c4a680e8edea44f02b' \
  --header 'Authorization: Bearer token'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("text/plain");
  RequestBody body = RequestBody.create(mediaType, "");
  Request request = new Request.Builder()
    .url("http://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64b126c4a680e8edea44f02b")
    .method("GET", body)
    .addHeader("Authorization", "Bearer token")
    .build();
  Response response = client.newCall(request).execute();
  ```

  ```js Javascript theme={null}
  const myHeaders = new Headers();
  myHeaders.append("Authorization", "Bearer token");

  const requestOptions = {
    method: "GET",
    headers: myHeaders,
    redirect: "follow",
  };

  fetch(
    "http://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64b126c4a680e8edea44f02b",
    requestOptions
  )
    .then((response) => response.text())
    .then((result) => console.log(result))
    .catch((error) => console.error(error));
  ```

  ```php PHP theme={null}
  <?php
  $client = new Client();
  $headers = [
    'Authorization' => 'Bearer token'
  ];
  $request = new Request('GET', 'http://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64b126c4a680e8edea44f02b', $headers);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

  ```python Python theme={null}
  import requests

  url = "http://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64b126c4a680e8edea44f02b"

  payload = {}
  headers = {
    'Authorization': 'Bearer token'
  }

  response = requests.request("GET", url, headers=headers, data=payload)

  print(response.text)
  ```
</CodeGroup>

**Response**

```json theme={null}
{
  "code": 1000,
  "msg": "OK",
  "data": {
    "faceswap_quality": 2,
    "storage_loc": 1,
    "_id": "64dd92c1f0b6684651e90e09",
    "create_time": 1692242625334,
    "uid": 378337,
    "type": 2,
    "from": 1,
    "video_id": "0acfed62e24f4cfd8801c9e846347b1d",
    "video_lock_duration": 7.91,
    "deduction_lock_duration": 10,
    "video_status": 2, // current status of video： 【1：queueing（The requested operation is being processed），2：processing（The requested operation is being processing），3：completed（The request operation has been processed successfully），4：failed（The request operation processing failed, the reason for the failure can be viewed in the video translation details.）】
    "external_video": "",
    "lipsync_video_url": "", //if you set lipsync = true, you can use lipsync_video_url
    "video": "" //  Generated video resource url
  }
}
```

**Response Code Description**

<Note>
  {" "}

  Please note that if the value of the response code is not equal to 1000, the request
  is failed or wrong
</Note>

| **Parameter** | **Value** | **Description**                                                                    |
| ------------- | --------- | ---------------------------------------------------------------------------------- |
| code          | 1000      | Success                                                                            |
| code          | 1003      | Parameter error or Parameter can not be empty                                      |
| code          | 1008      | The content you get does not exist                                                 |
| code          | 1009      | You do not have permission to operate                                              |
| code          | 1101      | Invalid authorization or The request token has expired                             |
| code          | 1102      | Authorization cannot be empty                                                      |
| code          | 1200      | The account has been banned                                                        |
| code          | 1201      | create audio error, please try again later                                         |
| code          | 1202      | The same video cannot be translated lipSync in the same language more than 1 times |
| code          | 1203      | video should be with audio                                                         |
| code          | 1204      | Your video duration is exceed 60s!                                                 |
| code          | 1205      | Create video error, please try again later                                         |
| code          | 1207      | The video you are using exceeds the size limit allowed by the system by 300M       |
| code          | 1209      | Please upload a video in another encoding format                                   |
| code          | 1210      | The video you are using exceeds the value allowed by the system by 30fp            |
