# Text Synthesis

### 1. Text to Speech

{% hint style="info" %}
Use Case: Used for creating voice overs, voice translation to other languages and much more.
{% endhint %}

&#x20;<mark style="color:yellow;">`POST`</mark>  `/text`

Headers&#x20;

| Name         | Value            |
| ------------ | ---------------- |
| Content-Type | application/json |
| apikey       | string           |
| secret       | string           |

Body

| Name         | Type    | Description                                                                     |
| ------------ | ------- | ------------------------------------------------------------------------------- |
| text         | string  |                                                                                 |
| voice        | string  |                                                                                 |
| responsetype | string  | Can be voice, image, video or text.  If you need voice and text use voice,text. |
| inlanguage   | string  | input language                                                                  |
| outlanguage  | string  | Ignore if you want to get same language                                         |
| speed        | number  | 0-100. 50 is usually moderate. Its optional. "stream":false                     |
| stream       | boolean |                                                                                 |

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

```json
{
    "text":"Good morning Here",
    "voice":"khadie",
    "responsetype":"voice", //Can be voice, image, video or text. If you need voice and text use voice,text.
    "inlanguage":"hausa",
    "outlanguage":"igbo", //Ignore if you want to get same language
    "speed":50, //0-100. 50 is usually moderate. Its optional.
    "stream":false
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

***

### 2. Text to Text

{% hint style="info" %}
Use Case:  For translation, sentence correction and more.
{% endhint %}

<mark style="color:green;">`POST`</mark> `/text`

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name   | Type   | Description      |
| ------ | ------ | ---------------- |
| `name` | string | Name of the user |
| `age`  | number | Age of the user  |

**Response**

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

```json
{
  "id": 1,
  "name": "John",
  "age": 30
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}
