# 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 %}


---

# 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://safidocs.insolify.com/text-synthesis.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.
