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

> Talking Avatar API documentation

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

### Description

* First you need to generate the voice through the following method or directly provide a link to the available voice file
  * If you want to use the system's sound model to generate speech, you need to generate a link by calling the interface [Create TTS](https://docs.akool.com/ai-tools-suite/voiceLab#create-text-to-speech)
  * If you want to use the sound model you provide to generate speech, you need to generate a link by calling the interface [Create Voice Clone](https://docs.akool.com/ai-tools-suite/voiceLab#create-voice-clone)
* Secondly, you need to provide an avatar link, which can be a picture or video.
  * If you want to use the avatar provided by the system, you can obtain it through the interface [Get Avatar List](https://docs.akool.com/ai-tools-suite/talking-avatar#get-talking-avatar-list) .Or provide your own avatar url.
* Then, you need to generate an avatar video by calling the API [Create Talking Avatar](https://docs.akool.com/ai-tools-suite/talking-avatar#create-talking-avatar)
* Finally,The processing status will be returned promptly through the provided callback address, or you can also query it by calling the interface [Get Video Info](https://docs.akool.com/ai-tools-suite/talking-avatar#get-video-info)

### Get Talking Avatar List

```http theme={null}
GET https://openapi.akool.com/api/open/v3/avatar/list
```

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                                                    |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| Authorization | Bearer `{token}` | Your API Key used for request authorization. [getToken](https://docs.akool.com/authentication/usage#get-the-token) |

**Query Attributes**

| **Parameter** | **Type** | **Value** | **Description**                                                                                                                              |
| ------------- | -------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| from          | Number   | 2、3       | 2 represents the official avatar of Akool, 3 represents the avatar uploaded by the user themselves，If empty, returns all avatars by default. |
| type          | Number   | 1、2       | 1 represents the talking avatar of Akool, 2 represents the streaming avatar of Akool，If empty, returns all avatars by default.               |
| page          | Number   | 1         | Current number of pages，Default is 1.                                                                                                        |
| size          | Number   | 10        | Current number of returns per page，Default is 100.                                                                                           |

**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    | `[{ avatar_id: "xx", url: "" }]` | avatar\_id: Used by avatar interface and creating avatar interface. url: You can preview the avatar via the link. |

**Example**

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/avatar/list?from=2&page=1&size=100' \
  --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/avatar/list?from=2&page=1&size=100")
    .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/avatar/list?from=2&page=1&size=100",
    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/avatar/list?from=2&page=1&size=100', $headers);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

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

  url = "https://openapi.akool.com/api/open/v3/avatar/list?from=2&page=1&size=100"

  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": [
    {
      "name": "Yasmin in White shirt",  // avatar name
      "avatar_id": "Yasmin_in_White_shirt_20231121",  //  parameter values ​​required to create talkingavatar
      "url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png", // avatar url
      "gender": "female",   //  avatar gender
      "thumbnailUrl": "https://drz0f01yeq1cx.cloudfront.net/avatar/thumbnail/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png", //  avatar thumbnail
      "from": 2 //  parameter values ​​required to create talkingavatar
    }
  ]
}
```

### Create Talking avatar

```
POST https://openapi.akool.com/api/open/v3/talkingavatar/create
```

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                                                    |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| Authorization | Bearer `{token}` | Your API Key used for request authorization.[getToken](https://docs.akool.com/authentication/usage#get-the-token). |

**Body Attributes**

| Parameter               | Type      | Value  | Description                                                                                                                                                                                                                                                                                                                                                          |
| ----------------------- | --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| width                   | Number    | 3840   | Set the output video width,must be 3840                                                                                                                                                                                                                                                                                                                              |
| height                  | Number    | 2160   | Set the output video height,must be 2160                                                                                                                                                                                                                                                                                                                             |
| avatar\_from            | Number    | 2 or 3 | You use the avatar from of the avatar model, and you can get from [https://openapi.akool.com/api/open/v3/avatar/list](https://docs.akool.com/ai-tools-suite/talking-avatar#get-avatar-list) api, you will obtain the field 【from】 and pass it here. If you provide an avatar URL yourself, avatar\_from must be 3.                                                   |
| webhookUrl              | String    |        | Callback url address based on HTTP request.                                                                                                                                                                                                                                                                                                                          |
| elements                | \[Object] |        | Collection of elements passed in in the video                                                                                                                                                                                                                                                                                                                        |
| \[elements].url         | String    |        | Link to element(When type is equal to image, url can be either a link or a Hexadecimal Color Code). When avatar\_from =2, you don't need to pass this parameter. The image formats currently only support ".png", ".jpg", ".jpeg", ".webp", and the video formats currently only support ".mp4", ".mov", ".avi"                                                      |
| \[elements].scale\_x    | Number    | 1      | Horizontal scaling ratio(Required when type is equal to image or avatar)                                                                                                                                                                                                                                                                                             |
| \[elements].scale\_y    | Number    | 1      | Vertical scaling ratio (Required when type is equal to image or avatar)                                                                                                                                                                                                                                                                                              |
| \[elements].offset\_x   | Number    |        | Horizontal offset of the upper left corner of the element from the video setting area (in pixels)(Required when type is equal to image or avatar)                                                                                                                                                                                                                    |
| \[elements].offset\_y   | Number    |        | Vertical offset of the upper left corner of the element from the video setting area (in pixels)(Required when type is equal to image or avatar)                                                                                                                                                                                                                      |
| \[elements].height      | Number    |        | The height of the element                                                                                                                                                                                                                                                                                                                                            |
| \[elements].width       | Number    |        | The width of the element                                                                                                                                                                                                                                                                                                                                             |
| \[elements].type        | String    |        | Element type（avatar、image、audio）                                                                                                                                                                                                                                                                                                                                     |
| \[elements].avatar\_id  | String    |        | When type is equal to avatar, you use the avatar\_id of the avatar model, and you can get from [https://openapi.akool.com/api/open/v3/avatar/list](https://docs.akool.com/ai-tools-suite/talking-avatar#get-avatar-list) api, you will obtain the field 【avatar\_id】 and pass it here。 If you provide an avatar URL yourself, you don't need to pass this parameter. |
| \[elements].input\_text | String    |        | Audio element support, for input text, the per-request character limit depends on the subscription plan: Pro – 5,000, Pro Max – 10,000, Business – 50,000.   If both the URL and the input text fields are passed, the URL takes precedence.  The "input\_text" and "voice\_id" fields must both be present.                                                         |
| \[elements].voice\_id   | String    |        | Audio element support. [getVoiceId](https://docs.akool.com/ai-tools-suite/voiceLab#get-voice-list)                                                                                                                                                                                                                                                                   |

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

<Note>
  Please note that the generated video link can only be obtained when video\_status is equal to 3.
  We provide 2 methods:

  1. Obtain through [webhook](https://docs.akool.com/ai-tools-suite/webhook#encryption-and-decryption-technology-solution)
  2. Obtain by polling the following interface [Get Video Info](https://docs.akool.com/ai-tools-suite/avatar#get-video-info)
</Note>

**Example**

**Body**

```json theme={null}
{
    "width": 3840,
    "height": 2160,
    "avatar_from": 3,
    "elements": [
        {
            "type": "image",
            "url": "https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png",
            "width": 780,
            "height": 438,
            "scale_x": 1,
            "scale_y": 1,
            "offset_x": 1920,
            "offset_y": 1080
        },
        {
            "type": "avatar",
            "url": "https://drz0f01yeq1cx.cloudfront.net/1735009621724-7ce105c6-ed9a-4d13-9061-7e3df59d9798-7953.mp4",
            "scale_x": 1,
            "scale_y": 1,
            "width": 1080,
            "height": 1080,
            "offset_x": 1920,
            "offset_y": 1080
        },
        {
            "type": "audio",
            "url": "https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3",
            "input_text": "A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.",
            "voice_id": "6889b628662160e2caad5dbc"
        }
    ],
    "webhookUrl": ""
}
```

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/talkingavatar/create' \
  --header 'Authorization: Bearer token' \
  --header 'Content-Type: application/json' \
  --data '{
      "width": 3840,
      "height": 2160,
      "avatar_from": 3,
      "elements": [
          {
              "type": "image",
              "url": "https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png",
              "width": 780,
              "height": 438,
              "scale_x": 1,
              "scale_y": 1,
              "offset_x": 1920,
              "offset_y": 1080
          },
          {
              "type": "avatar",
              "url": "https://drz0f01yeq1cx.cloudfront.net/1735009621724-7ce105c6-ed9a-4d13-9061-7e3df59d9798-7953.mp4",
              "scale_x": 1,
              "scale_y": 1,
              "width": 1080,
              "height": 1080,
              "offset_x": 1920,
              "offset_y": 1080
          },
          {
              "type": "audio",
              "url": "https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3",
              "input_text": "A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.",
              "voice_id": "6889b628662160e2caad5dbc"
          }
      ]
  }'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\n    \"width\": 3840,\n    \"height\": 2160,\n    \"avatar_from\": 3,\n    \"elements\": [\n        {\n            \"type\": \"image\",\n            \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png\",\n            \"width\": 780,\n            \"height\": 438,\n            \"scale_x\": 1,\n            \"scale_y\": 1,\n            \"offset_x\": 1920,\n            \"offset_y\": 1080\n        },\n        {\n            \"type\": \"avatar\",\n            \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1735009621724-7ce105c6-ed9a-4d13-9061-7e3df59d9798-7953.mp4\",\n            \"scale_x\": 1,\n            \"scale_y\": 1,\n            \"width\": 1080,\n            \"height\": 1080,\n            \"offset_x\": 1920,\n            \"offset_y\": 1080\n        },\n        {\n            \"type\": \"audio\",\n            \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3\"\n        }\n    ]\n}");
  Request request = new Request.Builder()
    .url("https://openapi.akool.com/api/open/v3/talkingavatar/create")
    .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({
    "width": 3840,
    "height": 2160,
    "avatar_from": 3,
    "elements": [
      {
        "type": "image",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png",
        "width": 780,
        "height": 438,
        "scale_x": 1,
        "scale_y": 1,
        "offset_x": 1920,
        "offset_y": 1080
      },
      {
        "type": "avatar",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1735009621724-7ce105c6-ed9a-4d13-9061-7e3df59d9798-7953.mp4",
        "scale_x": 1,
        "scale_y": 1,
        "width": 1080,
        "height": 1080,
        "offset_x": 1920,
        "offset_y": 1080
      },
      {
        "type": "audio",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3",
        "input_text": "A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.A military parade is a formation of military personnels whose movement is restricted by close-order manoeuvering known as drilling or marching. Large military parades are today held on major holidays and military events around the world.",
        "voice_id": "6889b628662160e2caad5dbc"
      }
    ]
  });

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

  fetch("https://openapi.akool.com/api/open/v3/talkingavatar/create", 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 = '{
    "width": 3840,
    "height": 2160,
    "avatar_from": 3,
    "elements": [
      {
        "type": "image",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png",
        "width": 780,
        "height": 438,
        "scale_x": 1,
        "scale_y": 1,
        "offset_x": 1920,
        "offset_y": 1080
      },
      {
        "type": "avatar",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1735009621724-7ce105c6-ed9a-4d13-9061-7e3df59d9798-7953.mp4",
        "scale_x": 1,
        "scale_y": 1,
        "width": 1080,
        "height": 1080,
        "offset_x": 1920,
        "offset_y": 1080
      },
      {
        "type": "audio",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3"
      }
    ]
  }';
  $request = new Request('POST', 'https://openapi.akool.com/api/open/v3/talkingavatar/create', $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/talkingavatar/create"

  payload = json.dumps({
    "width": 3840,
    "height": 2160,
    "avatar_from": 3,
    "elements": [
      {
        "type": "image",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1729480978805-talkingAvatarbg.png",
        "width": 780,
        "height": 438,
        "scale_x": 1,
        "scale_y": 1,
        "offset_x": 1920,
        "offset_y": 1080
      },
      {
        "type": "avatar",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1735009621724-7ce105c6-ed9a-4d13-9061-7e3df59d9798-7953.mp4",
        "scale_x": 1,
        "scale_y": 1,
        "width": 1080,
        "height": 1080,
        "offset_x": 1920,
        "offset_y": 1080
      },
      {
        "type": "audio",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1729666642023-bd6ad5f1-d558-40c7-b720-ad729688f814-6403.mp3"
      }
    ]
  })
  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": "67491cdb4d9d1664a9782292",
        "uid": 100002,
        "video_id": "f1a489f4-0cca-4723-843b-e42003dc9f32",
        "task_id": "67491cdb1acd9d0ce2cc8998",
        "video_status": 1,
        "video": "",
        "create_time": 1732844763774
    }
}
```

### Get Video Info

```
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.[getToken](https://docs.akool.com/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 [https://openapi.akool.com/api/open/v3/talkingavatar/create](https://docs.akool.com/ai-tools-suite/talking-avatar#create-talking-avatar) . |

**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=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("https://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(
    "https://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', 'https://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 = "https://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": {
    "_id": "64dd92c1f0b6684651e90e09",
    "create_time": 1692242625334, //  content creation time
    "uid": 378337,
    "video_id": "0acfed62e24f4cfd8801c9e846347b1d", // video id
    "deduction_duration": 10,  // credits consumed by the final result
    "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.）】
    "video": "" //  Generated video resource url
  }
}
```

### Get Avatar Detail

```
GET https://openapi.akool.com/api/open/v3/avatar/detail
```

**Request Headers**

| **Parameter** | **Value**        | **Description**                                                                                                    |
| ------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------ |
| Authorization | Bearer `{token}` | Your API Key used for request authorization. [getToken](https://docs.akool.com/authentication/usage#get-the-token) |

**Query Attributes**

| **Parameter** | **Type** | **Value** | **Description**   |
| ------------- | -------- | --------- | ----------------- |
| id            | String   |           | avatar record id. |

**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    | `[{ avatar_id: "xx", url: "", status: "" }]` | avatar\_id: Used by avatar interface and creating avatar interface. url: You can preview the avatar via the link. status: 1-queueing 2-processing），3：completed 4-failed |

**Example**

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/avatar/detail?id=66a1a02d591ad336275eda62' \
  --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/avatar/detail?id=66a1a02d591ad336275eda62")
    .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/avatar/detail?id=66a1a02d591ad336275eda62,
    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/avatar/detail?66a1a02d591ad336275eda62', $headers);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

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

  url = "https://openapi.akool.com/api/open/v3/avatar/detail?id=66a1a02d591ad336275eda62"

  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": [
    {
      "_id": "66a1a02d591ad336275eda62",
        "uid": 100010,
        "type": 2,
        "from": 3,
        "status": 3,
        "name": "30870eb0",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1721868487350-6b4cc614038643eb9f842f4ddc3d5d56.mp4"
    }
  ]
}
```

### Upload Talking Avatar

```
POST https://openapi.akool.com/api/open/v3/avatar/create
```

**Request Headers**

| **Parameter** | **Value**    | **Description**                                                                                                    |
| ------------- | ------------ | ------------------------------------------------------------------------------------------------------------------ |
| Authorization | Bearer token | Your API Key used for request authorization. [getToken](https://docs.akool.com/authentication/usage#get-the-token) |

**Body Attributes**

| **Parameter** | **Type** | **Value** | **Description**                                                                                                                                                   |
| ------------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url           | String   |           | Avatar resource link. It is recommended that the video be about one minute long, and the avatar in the video content should rotate at a small angle and be clear. |
| avatar\_id    | String   |           | avatar unique ID，Can only contain /^a-zA-Z0-9/.                                                                                                                   |
| name          | String   |           | Avatar display name for easier identification and management.                                                                                                     |
| type          | String   | 1         | Avatar type, 1 represents talking avatar                                                                                                                          |

**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    | `[{ avatar_id: "xx", url: "", status: 1 }]` | avatar\_id: Used by creating live avatar interface. url: You can preview the avatar via the link. status: 1-queueing, 2-processing, 3-success, 4-failed |

**Example**

**Request**

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://openapi.akool.com/api/open/v3/avatar/create' \
  --header 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY0ZDk4NWM1NTcxNzI5ZDNlMjk5OTQ3NyIsInVpZCI6Mzc4MzM3LCJlbWFpbCI6Imh1Y2hlbkBha29vbC5jb20iLCJjcmVkZW50aWFsSWQiOiI2NjE1MGZmM2Q5MWRmYjc4OWYyNjFmNjEiLCJmaXJzdE5hbWUiOiJjaGVuIiwiZnJvbSI6InRvTyIsInR5cGUiOiJ1c2VyIiwiaWF0IjoxNzEyNzE0ODI4LCJleHAiOjIwMjM3NTQ4Mjh9.e050LbczNhUx-Gprqb1NSYhBCKKH2xMqln3cMnAABmE' \
  --header 'Content-Type: application/json' \
  --data '{
      "url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
      "avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
      "name": "My Talking Avatar",
      "type": 1
  }'
  ```

  ```java Java theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("text/plain");
  RequestBody body = RequestBody.create(mediaType, "{\n    \n    \"url\": \"https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4\",\n    \"avatar_id\": \"HHdEKhn7k7vVBlR5FSi0e\",\n    \"name\": \"My Talking Avatar\",\n    \"type\": 1\n}");
  Request request = new Request.Builder()
    .url("https://openapi.akool.com/api/open/v3/avatar/create")
    .method("POST", 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 raw = JSON.stringify({
    "url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
    "avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
    "name": "My Talking Avatar",
    "type": 1
  });

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

  fetch(
    "https://openapi.akool.com/api/open/v3/avatar/create",
    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}}'
  ];
  $body = '{
    "url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
    "avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
    "name": "My Talking Avatar",
    "type": 1
  }';
  $request = new Request('POST', 'https://openapi.akool.com/api/open/v3/avatar/create', $headers, $body);
  $res = $client->sendAsync($request)->wait();
  echo $res->getBody();
  ```

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

  url = "https://openapi.akool.com/api/open/v3/avatar/create"

  payload = json.dumps({
    "url": "https://drz0f01yeq1cx.cloudfront.net/1721197444322-leijun000.mp4",
    "avatar_id": "HHdEKhn7k7vVBlR5FSi0e",
    "name": "My Talking Avatar",
    "type": 1
  });
  headers = {
    'Authorization': 'Bearer {{Authorization}}'
  }

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

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

**Response**

```json theme={null}
{
  "code": 1000,
  "msg": "ok",
  "data": [
    {
      "_id": "655ffeada6976ea317087193",
      "disabled": false,
      "uid": 1,
      "type": 1,
      "from": 2,
      "status": 1,
      "sort": 12,
      "create_time": 1700788730000,
      "name": "Yasmin in White shirt",
      "avatar_id": "Yasmin_in_White_shirt_20231121",
      "url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
      "modify_url": "https://drz0f01yeq1cx.cloudfront.net/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
      "gender": "female",
      "thumbnailUrl": "https://drz0f01yeq1cx.cloudfront.net/avatar/thumbnail/1700786304161-b574407f-f926-4b3e-bba7-dc77d1742e60-8169.png",
      "crop_arr": []
    }
  ]
}
```

**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          | 1006      | Your quota is not enough                      |
| code          | 1109      | create avatar video error                     |
| code          | 1102      | Authorization cannot be empty                 |
| code          | 1200      | The account has been banned                   |
| code          | 1201      | Create audio error, please try again later    |
