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

# Audio

> Audio API documentation

> [!NOTE]
>
> You can use the following API to generate tts voice and voice clones.

> [!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.

### Get Voice List Result

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

**Request Headers**

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

**Query Attributes**

| **Parameter** | **Type** | **Value** | **Description** |
| - | - | - | - |
| from | Number | 3, 4 | 3 represents the official voice of Akool, 4 represents the voice created by the user themselves，If empty, returns all voice by office and users. |

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

**Example**

**Request**

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

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

url = "https://openapi.akool.com/api/open/v3/voice/list?from=3"

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

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

print(response.text)
```

**Response**

```json theme={null}
{
    "code": 1000,
    "msg": "ok",
    "data": [
        {
            "_id": "65e980d7af040969db5be863",
            "create_time": 1687181385319,
            "uid": 1,
            "from": 3,
            "voice_id": "piTKgcLEGmPE4e6mEKli",
            "gender": "Female",
            "accent":"american",
            "name": "Nicole",
            "description":"whisper",
            "useCase":"audiobook",
            "type": 1,
            "preview": "https://storage.googleapis.com/eleven-public-prod/premade/voices/piTKgcLEGmPE4e6mEKli/c269a54a-e2bc-44d0-bb46-4ed2666d6340.mp3",
            "__v": 0
        }
    ]
}
```

### Create TTS

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

**Request Headers**

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

**Body Attributes**

| **Parameter** | **Type** | **Value** | **Description** |
| - | - | - | - |
| input\_text | String | | Enter what talkingphoto to say, The text content is limited to 5000 words. |
| voice\_id | String | | Voice id: get from [Voice List API](https://docs.akool.com/ai-tools-suite/voiceLab.md#get-voice-list) api，the field is 【voice\_id】 |
| rate | String | | Voice speaking speed【field value ranges（0%-100%）】 |
| 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: "", status: 1 }` | \_id: Interface returns data, status: the status of audio: 【1:queueing, 2:processing, 3:completed, 4:failed】 |

**Example**

**Body**

```json theme={null}
{
    "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
    "voice_id": "LcfcDJNUP1GQjkzn1xUU",
    "rate": "100%",
   "webhookUrl":""
}
```

**Request**

```bash cURL theme={null}
curl --location 'https://openapi.akool.com/api/open/v3/audio/create' \
--header "x-api-key: {{API Key}}" \
--header 'Content-Type: application/json' \
--data '{
    "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
    "voice_id": "LcfcDJNUP1GQjkzn1xUU",
    "rate": "100%",
    "webhookUrl":""
}'
```

```java Java theme={null}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n    \"input_text\": \"Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from\",\n    \"voice_id\": \"LcfcDJNUP1GQjkzn1xUU\",\n    \"rate\": \"100%\",\n    \"webhookUrl\":\"\" \n}");
Request request = new Request.Builder()
  .url("https://openapi.akool.com/api/open/v3/audio/create")
  .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({
  "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
  "voice_id": "LcfcDJNUP1GQjkzn1xUU",
  "rate": "100%",
  "webhookUrl": ""
});

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

fetch("https://openapi.akool.com/api/open/v3/audio/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 = [
  'x-api-key' =>'{{API Key}}',
  'Content-Type' => 'application/json'
];
$body = '{
  "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
  "voice_id": "LcfcDJNUP1GQjkzn1xUU",
  "rate": "100%",
  "webhookUrl": ""
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v3/audio/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/audio/create"

payload = json.dumps({
  "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
  "voice_id": "LcfcDJNUP1GQjkzn1xUU",
  "rate": "100%",
  "webhookUrl": ""
})
headers = {
  'x-api-key':'{{API Key}}',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

**Response**

```json theme={null}
{
    "code": 1000,
    "msg": "OK",
    "data": {
        "_id": "65f8017f56559aa67f0ecde7",
        "create_time": 1710752127995,
        "uid": 101690,
        "from": 3,
        "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
        "rate": "100%",
        "voice_model_id": "65e980d7af040969db5be854",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3",
        "status": 3,
        "__v": 0
    }
}
```

### Create Voice Clone

```
POST https://openapi.akool.com/api/open/v3/audio/clone
```

**Request Headers**

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

**Body Attributes**

| **Parameter** | **Type** | **Required** | **Value** | **Description** |
| - | - | - | - | - |
| input\_text | String | true | | Enter what avatar in video to say, The text content is limited to 5000 words. |
| rate | String | true | | Voice speaking speed【field value ranges（0%-100%）】 |
| voice\_url | String | false | | Voice url address |
| webhookUrl | String | false | | Callback url address based on HTTP request |

> [!NOTE]
>
> voice\_id and voice\_url must provide one

**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: "", status: 1, url:"" }` | \_id: Interface returns data, status: the status of audio: 【1:queueing, 2:processing, 3:completed, 4:failed】, url: Links to the generated audio resources，You can use it in the interface [Create Talking Avatar API](https://docs.akool.com/ai-tools-suite/talking-avatar.md#create-talking-avatar) api. |

**Example**

**Body**

```json theme={null}
{
  "input_text": "Hello, this is Akool's AI platform!",
  "rate": "100%",
  "voice_url":"https://drz0f01yeq1cx.cloudfront.net/1713168740392-4022bc91-5502-4e79-a66a-8c45b31792e4-4867.mp3",
  "webhookUrl":""
}
```

**Request**

```bash cURL theme={null}
curl --location 'https://openapi.akool.com/api/open/v3/audio/clone' \
--header "x-api-key: {{API Key}}" \
--header 'Content-Type: application/json' \
--data '{
  "input_text": "Hello, this is Akool'\''s AI platform!",
  "rate": "100%",
  "voice_url":"https://drz0f01yeq1cx.cloudfront.net/1713168740392-4022bc91-5502-4e79-a66a-8c45b31792e4-4867.mp3",
  "webhookUrl":""
}'
```

```java Java theme={null}
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n  \"input_text\": \"Hello, this is Akool's AI platform!\",\n  \"rate\": \"100%\",\n  \"voice_url\":\"https://drz0f01yeq1cx.cloudfront.net/1713168740392-4022bc91-5502-4e79-a66a-8c45b31792e4-4867.mp3\",\n  \"webhookUrl\":\"\"  \n}");
Request request = new Request.Builder()
  .url("https://openapi.akool.com/api/open/v3/audio/clone")
  .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({
  "input_text": "Hello, this is Akool's AI platform!",
  "rate": "100%",
  "voice_url": "https://drz0f01yeq1cx.cloudfront.net/1713168740392-4022bc91-5502-4e79-a66a-8c45b31792e4-4867.mp3",
  "webhookUrl": ""
});

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

fetch("https://openapi.akool.com/api/open/v3/audio/clone", 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 = '{
  "input_text": "Hello, this is Akool's AI platform!",
  "rate": "100%",
  "voice_url": "https://drz0f01yeq1cx.cloudfront.net/1713168740392-4022bc91-5502-4e79-a66a-8c45b31792e4-4867.mp3",
  "webhookUrl": ""
}';
$request = new Request('POST', 'https://openapi.akool.com/api/open/v3/audio/clone', $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/audio/clone"

payload = json.dumps({
  "input_text": "Hello, this is Akool's AI platform!",
  "rate": "100%",
  "voice_url": "https://drz0f01yeq1cx.cloudfront.net/1713168740392-4022bc91-5502-4e79-a66a-8c45b31792e4-4867.mp3",
  "webhookUrl": ""
})
headers = {
  'x-api-key':'{{API Key}}',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

**Response**

```json theme={null}
{
  "code": 1000,
  "msg": "OK",
  "data": {
    "create_time": 1712113285547,
    "from": 3,
    "input_text": "Hello, this is Akool's AI platform!",
    "rate": "100%",
    "voice_model_id": "65e813955daad44c2267380d",
    "url": "https://drz0f01yeq1cx.cloudfront.net/1712113284451-fe73dd6c-f981-46df-ba73-0b9d85c1be9c-8195.mp3",
    "status": 3,
    "_id": "660cc685b0950b5bf9bf4b55"
  }
}
```

### Get Audio Info Result

```
GET https://openapi.akool.com/api/open/v3/audio/infobymodelid?audio_model_id=65f8017f56559aa67f0ecde7
```

**Request Headers**

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

**Query Attributes**

| **Parameter** | **Type** | **Value** | **Description** |
| - | - | - | - |
| audio\_model\_id | String | | audio db id：You can get it based on the `_id` field returned by [Create TTS API](https://docs.akool.com/ai-tools-suite/audio#create-tts) or [Create Voice Clone API](https://docs.akool.com/ai-tools-suite/audio#create-voice-clone) 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 | `{status:1,_id:"", url:""}` | status:  the status of audio：【1:queueing, 2:processing, 3:completed, 4:failed】`_id`: Interface returns data.url: Generated audio resource url |

**Example**

**Request**

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

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

url = "https://openapi.akool.com/api/open/v3/audio/infobymodelid?audio_model_id=65f8017f56559aa67f0ecde7"

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

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

print(response.text)
```

**Response**

```json theme={null}
{
    "code": 1000,
    "msg": "OK",
    "data": {
        "_id": "65f8017f56559aa67f0ecde7",
        "create_time": 1710752127995,
        "uid": 101690,
        "from": 3,
        "input_text": "Choose from male and female voices for various use-cases. For tailored options, refer to voice settings or read further.There are both male and female voices to choose from",
        "rate": "100%",
        "voice_model_id": "65e980d7af040969db5be854",
        "url": "https://drz0f01yeq1cx.cloudfront.net/1710752141387-e7867802-0a92-41d4-b899-9bfb23144929-4946.mp3", // Generated audio resource url
        "status": 3,   // current status of audio： 【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 audio details.）】
        "__v": 0
    }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.