# Speech To Text API

## Bước 1: Đăng ký webhook url để nhận kết quả ASR

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

#### 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            |
| ------------------------------------- | ------ | ---------------------- |
| url<mark style="color:red;">\*</mark> | String | Đường dẫn nhận dữ liệu |

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

{% endtab %}
{% endtabs %}

Kết Quả Từ Hook

<figure><img src="/files/lt7Luz1KivsYKyGHajBh" alt=""><figcaption></figcaption></figure>

| Name            | Type   | Description                                                                |
| --------------- | ------ | -------------------------------------------------------------------------- |
| from            | String | thời gian bắt đầu của đoạn text                                            |
| to              | String | thời gian kết thúc của đoạn text                                           |
| word\_alignment | String | mảng các từ được cắt theo thời gian                                        |
| text            | String | Chuỗi text được dịch từ speech                                             |
| tracking\_id    | String | ID truyền vào lúc gửi request phân tích qua để Mapping kết quả với request |

##

## Bước 2: Upload audio, kết quả ASR sẽ được trả về webhook url&#x20;

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

#### Headers

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

#### Request Body ( Form Data)

| Name                                           | Type   | Description                                                            |
| ---------------------------------------------- | ------ | ---------------------------------------------------------------------- |
| file<mark style="color:red;">\*</mark>         | String | audio file (định dạng hỗ trợ  .wav/ . mp3/.m4a ) muốn chuyển sang text |
| tracking\_id<mark style="color:red;">\*</mark> | String | String chứa ID để khi nhận Webhook client biết kết quả của request nào |

{% tabs %}
{% tab title="200: OK " %}

{% 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/speech-to-text-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.
