# Text To Speech API

## API TTS (Text2Speech):

<mark style="color:green;">`POST`</mark> [`https://public-v1-stg.omicall.com/api/ai/text_to_speech`](https://public-v1-stg.omicall.com/api/ai/text_to_speech)

#### Headers

| Name                                     | Type   | Description                 |
| ---------------------------------------- | ------ | --------------------------- |
| apiKey<mark style="color:red;">\*</mark> | String | Token xác thực truy cập API |

#### Request Body

| Name                                   | Type    | Description                                                                                                                                                                                                                         |
| -------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| text<mark style="color:red;">\*</mark> | String  | Nội dung văn bản                                                                                                                                                                                                                    |
| speed                                  | Integer | Tốc độ đọc là giá trị thực trong khoảng \[0.8, 1.2]. Mặc định là 1                                                                                                                                                                  |
| speaker\_id                            | String  | <p>ID giọng đọc mặc định là 'northern\_female\_ngocanh'. </p><p></p><p>Danh sách ID các giọng đọc: </p><p>northern\_female\_ngocanh</p><p>southern\_male\_tienhuy</p><p>northern\_male\_anhkiet</p><p>southern\_female\_khangan</p> |

{% tabs %}
{% tab title="200: OK Thành công" %}
{% code overflow="wrap" %}

```json
{
    "instance_id": "stg",
    "payload": {
        "data": {
            "audioDuration": 13.47,// Thời lượng tính bằng giây của audio
            "sampleRate": 8000, // Tần số lấy mẫu 
            "url": ""//URL download
        }
    },
    "instance_version": "1.2.164",
    "key_enabled": false,
    "status_code": 9999
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.omicall.com/omicall-api/ai-api/text-to-speech-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
