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

# Talking Photo

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

### Talking Photo

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

**Request Headers**

| **Parameter** | **Value**    | **Description**                                                                                                                                                     |
| ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization | Bearer token | Your API Key used for request authorization. You can get from [https://openapi.akool.com/api/open/v3/getToken](https://openapi.akool.com/api/open/v3/getToken) api. |

**Body Attributes**

| Parameter           | Type   | Value | Description                                |
| ------------------- | ------ | ----- | ------------------------------------------ |
| talking\_photo\_url | String |       | resource address of the talking picture    |
| audio\_url          | String |       | resource address of the talking audio      |
| 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:3, video:"" }` | `_id`: Interface returns data status: the status of video: \[1:queueing, 2:processing, 3:completed, 4:failed], `video`: the url of Generated video |

**Example**

**Body**

```json theme={null}
{
    "talking_photo_url":"https://drz0f01yeq1cx.cloudfront.net/1688098804494-e7ca71c3-4266-4ee4-bcbb-ddd1ea490e75-9907.jpg",
    "audio_url":"https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3",
    "webhookUrl":"http://localhost:3007/api/open/v3/test/webhook"  
}
```

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/content/video/createbytalkingphoto' \
  --header 'Authorization: Bearer token' \
  --header 'Content-Type: application/json' \
  --data '{
      "talking_photo_url":"https://drz0f01yeq1cx.cloudfront.net/1688098804494-e7ca71c3-4266-4ee4-bcbb-ddd1ea490e75-9907.jpg",
       "audio_url":"https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3",
       "webhookUrl":"http://localhost:3007/api/open/v3/test/webhook"  
  }'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\n    \"talking_photo_url\":\"https://drz0f01yeq1cx.cloudfront.net/1688098804494-e7ca71c3-4266-4ee4-bcbb-ddd1ea490e75-9907.jpg\",\n     \"audio_url\":\"https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3\",\n     \"webhookUrl\":\"http://localhost:3007/api/open/v3/test/webhook\"  \n}");
  Request request = new Request.Builder()
    .url("https://openapi.akool.com/api/open/v3/content/video/createbytalkingphoto")
    .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({
    "talking_photo_url": "https://drz0f01yeq1cx.cloudfront.net/1688098804494-e7ca71c3-4266-4ee4-bcbb-ddd1ea490e75-9907.jpg",
    "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3",
    "webhookUrl": "http://localhost:3007/api/open/v3/test/webhook"
  });

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

  fetch("https://openapi.akool.com/api/open/v3/content/video/createbytalkingphoto", 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 = '{
    "talking_photo_url": "https://drz0f01yeq1cx.cloudfront.net/1688098804494-e7ca71c3-4266-4ee4-bcbb-ddd1ea490e75-9907.jpg",
    "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3",
    "webhookUrl": "http://localhost:3007/api/open/v3/test/webhook"
  }';
  $request = new Request('POST', 'https://openapi.akool.com/api/open/v3/content/video/createbytalkingphoto', $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/createbytalkingphoto"

  payload = json.dumps({
    "talking_photo_url": "https://drz0f01yeq1cx.cloudfront.net/1688098804494-e7ca71c3-4266-4ee4-bcbb-ddd1ea490e75-9907.jpg",
    "audio_url": "https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3",
    "webhookUrl": "http://localhost:3007/api/open/v3/test/webhook"
  })
  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,   // API code
    "msg": "OK",
    "data": {
        "faceswap_quality": 2,
        "storage_loc": 1,
        "_id": "64dd90f9f0b6684651e90d60",
        "create_time": 1692242169057,
        "uid": 378337,
        "type": 5,
        "from": 2,
        "video_lock_duration": 0.8,
        "deduction_lock_duration": 10,
        "external_video": "",
        "talking_photo": "https://***.cloudfront.net/1692242161763-4fb8c3c2-018b-4b84-82e9-413c81f26b3a-6613.jpeg",
        "video": "",    // the url of Generated video
        "__v": 0,
        "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 talkingphoto details.）】
    }
}
```

### 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. You can get from [https://openapi.akool.com/api/open/v3/getToken](https://openapi.akool.com/api/open/v3/getToken) api. |

**Query Attributes**

| **Parameter**    | **Type** | **Value** | **Description**                                                                                                                                                                                                          |
| ---------------- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| video\_model\_id | String   |           | video db id：You can get it based on the \_id field returned by [https://openapi.akool.com/api/open/v3/content/video/createbytalkingphoto](https://openapi.akool.com/api/open/v3/content/video/createbytalkingphoto) api. |

**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 'https://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64dd838cf0b6684651e90217' \
  --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("https://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64dd838cf0b6684651e90217")
    .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("https://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64dd838cf0b6684651e90217", 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', 'https://openapi.akool.com/api/open/v3/content/video/infobymodelid?video_model_id=64dd838cf0b6684651e90217', $headers);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

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

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

  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 talkingphoto 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 be empty         |
| code          | 1008      | The content you get does not exist                     |
| code          | 1009      | You do not have permission to operate                  |
| code          | 1015      | Create video error, please try again later             |
| 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             |
