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

# LipSync

<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>

### Create lipSync

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

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                                                                                                 |
| ------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-api-key     | API Key          | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[Get Token](/authentication/usage#get-the-token).                                                                   |

**Body Attributes**

| **Parameter** | **Type** | **Value** | **Description**                                                                                                                                       |
| ------------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| video\_url    | String   |           | The video url address you want to lipsync, fps greater than 25 will affect the generated effect. It is recommended that the video fps be below 25.    |
| audio\_url    | String   |           | resource address of the audio,It is recommended that the audio length and video length be consistent, otherwise it will affect the generation effect. |
| webhookUrl    | String   |           | Callback url address based on HTTP request.                                                                                                           |

**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}
{
  "video_url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4",
  "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav",
  "webhookUrl": ""
}
```

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/content/video/lipsync' \
  --header "x-api-key: {{API Key}}" \
  --header 'content-type: application/json' \
  --data '{
      "video_url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4",
      "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav",
      "webhookUrl":""
  }'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\n    \"video_url\": \"https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4\",\n    \"audio_url\": \"https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav\",\n    \"webhookUrl\":\"\"\n}");
  Request request = new Request.Builder()
    .url("https://openapi.akool.com/api/open/v3/content/video/lipsync")
    .method("POST", body)
    .addHeader("x-api-key", "{{API Key}}")
    .addHeader("content-type", "application/json")
    .build();
  Response response = client.newCall(request).execute();
  ```

  ```js Javascript theme={null}
  const myHeaders = new Headers();
  myHeaders.append("x-api-key", "{{API Key}}");
  myHeaders.append("content-type", "application/json");

  const raw = JSON.stringify({
    video_url:
      "https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4",
    audio_url:
      "https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav",
    webhookUrl: "",
  });

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

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

  ```php PHP theme={null}
  <?php
  $client = new Client();
  $headers = [
    'x-api-key' =>'{{API Key}}',
    'content-type' => 'application/json'
  ];
  $body = '{
    "video_url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4",
    "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav",
    "webhookUrl": ""
  }';
  $request = new Request('POST', 'https://openapi.akool.com/api/open/v3/content/video/lipsync', $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/lipsync"

  payload = json.dumps({
    "video_url": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4",
    "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav",
    "webhookUrl": ""
  })
  headers = {
    'x-api-key':'{{API Key}}',
    '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": {
    "create_time": 1712720702523,
    "uid": 100002,
    "type": 9,
    "from": 2,
    "target_video": "https://d11fbe263bhqij.cloudfront.net/agicontent/video/global_reach/Global_reach_EN_01.mp4",
    "faceswap_quality": 2,
    "video_id": "8ddc4a27-d173-4cf5-aa37-13e340fed8f3",
    "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": 11.7,
    "deduction_lock_duration": 20,
    "external_video": "",
    "video": "", // the url of Generated video
    "storage_loc": 1,
    "input_audio": "https://drz0f01yeq1cx.cloudfront.net/1712719410293-driving_audio_2.wav",
    "webhookUrl": "",
    "task_id": "66160b3ee3ef778679dfd30f",
    "lipsync": true,
    "_id": "66160f989dfc997ac289037b",
    "__v": 0
  }
}
```

### Get Video Info Result

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

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                                                                                                 |
| ------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| x-api-key     | API Key          | Your API Key used for request authorization. If both Authorization and x-api-key have values, Authorization will be used first and x-api-key will be discarded. |
| 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 [Lip Sync API](/ai-tools-suite/lip-sync#create-lipsync) |

**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=66160f989dfc997ac289037b' \
  --header "x-api-key: {{API Key}}"
  ```

  ```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=66160f989dfc997ac289037b")
    .method("GET", body)
    .addHeader("x-api-key", "{{API Key}}")
    .build();
  Response response = client.newCall(request).execute();
  ```

  ```js Javascript theme={null}
  const myHeaders = new Headers();
  myHeaders.append("x-api-key", "{{API Key}}");

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

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

  ```php PHP theme={null}
  <?php
  $client = new Client();
  $headers = [
    'x-api-key' =>'{{API Key}}'
  ];
  $request = new Request('GET', 'http://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=66160f989dfc997ac289037b', $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=66160f989dfc997ac289037b"

  payload = {}
  headers = {
    'x-api-key':'{{API Key}}'
  }

  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": "66160f989dfc997ac289037b",
    "create_time": 1692242625334,
    "uid": 378337,
    "type": 2,
    "from": 1,
    "video_id": "788bcd2b-09bb-4e9c-b0f2-6d41ee5b2a67",
    "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": "",
    "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 beempty                                      |
| code          | 1008      | The content you get does not exist                                                |
| code          | 1009      | Youdo not have permission to operate                                              |
| code          | 1101      | Invalid authorization or Therequest token has expired                             |
| code          | 1102      | Authorization cannot be empty                                                     |
| code          | 1200      | The account has been banned                                                       |
| code          | 1201      | create audio error, pleasetry again later                                         |
| code          | 1202      | The same video cannot be translated lipSync inthe same language more than 1 times |
| code          | 1203      | video should be with audio                                                        |
| code          | 1204      | Your video duration is exceed 60s!                                                |
| code          | 1205      | Create videoerror, please try again later                                         |
| code          | 1207      | The video you are using exceeds thesize limit allowed by the system by 300M       |
| code          | 1209      | Please upload a videoin another encoding format                                   |
| code          | 1210      | The video you are using exceeds thevalue allowed by the system by 60fp            |
| code          | 1211      | Create lipsync error, pleasetry again later                                       |
