> For the complete documentation index, see [llms.txt](https://safidocs.insolify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://safidocs.insolify.com/conversation-thread.md).

# Conversation Thread

### 1. Start a new Conversation.

&#x20;Note: chats saving needs save to be set to true, it is false by default.

```
POST  /conversation/new
```

#### Headers

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

#### Body

| Name           | Type    | Description                                                                    |
| -------------- | ------- | ------------------------------------------------------------------------------ |
| title          | string  | title or topic for the chat.                                                   |
| inlanguage     | string  | The language to begin with, can be switched updated mid conversation           |
| outputLanguage | string  | The language to get response in                                                |
| responsetype   | string  | Can be voice, image, video or text. If you need voice and text use voice,text. |
| agentId        | string  | If you are referring to a specific agent. Its ID                               |
| stream         | boolean |                                                                                |
| save           | number  | Chats are not saved by default.                                                |
| message        | string  | The message to begin w                                                         |
| messagetype    | string  | The message type                                                               |

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

```
{
    "title":"Testing you", 
    "inlanguage":"hausa",
    "outputlanguage":"english", 
    "responsetype":"text", 
    "agentId":"", 
    "stream":false,
    "save":true,
    "message":"Hello Bro", 
    "messagetype":"text",
 
}
```

{% endtab %}

{% tab title="Response" %}

{% endtab %}
{% endtabs %}

### 2. Fetch Conversations

Fetch the list of all your saved conversations.

<mark style="color:green;">`GET`</mark> `/conversations`

Headers

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

{% tabs %}
{% tab title="Request" %}
GET /conversations
{% endtab %}

{% tab title="Response" %}

```json
{
  "data": [Array]
}
```

{% endtab %}
{% endtabs %}

***

### 2. Fetch a specific conversation

This fetches a conversation using the specified ID number

<mark style="color:green;">`GET`</mark> `/conversation/{id}`

Headers

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

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

```json
GET /conversation/id
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "data": {}
}
```

{% endtab %}
{% endtabs %}

***

### 4. Continue a saved conversation or thread.

description

<mark style="color:yellow;">`POST`</mark>  `/conversation/{id}`

Headers

|              |                  |
| ------------ | ---------------- |
| Content-Type | application/json |
| apiKey       | string           |
| secret       | string           |

Body

| Name         | Type             | Description                                                        |
| ------------ | ---------------- | ------------------------------------------------------------------ |
| id           | string           |                                                                    |
| inlanguage   |                  | The language for the newest message to be updated mid conversation |
| outlanguage  | string           | The language to get response in                                    |
| responsetype | string           | what you need as response. Can be voice, image, video or text.     |
| agentId      | number           | If you are referring to a specific agent. Its ID                   |
| stream       | boolean          |                                                                    |
| messages     | Array\[messages] | Array of messages, the one on top is the latest one                |

{% hint style="info" %}
Message data sample
{% endhint %}

Message

| Name        | Type   | Description                                                                         |
| ----------- | ------ | ----------------------------------------------------------------------------------- |
| message     | string | The message can be text or url of voice or video                                    |
| messagetype | string | The message type, if voice specify and supply in message.                           |
| owner       | string | user or machine.                                                                    |
| topic       | string | optional. instruction(to tell the machine who it is), change topic, refresh memory. |

***

### 5. Delete a saved conversation or thread.

<mark style="color:red;">`DELETE`</mark> `/conversation/{id}`

Headers&#x20;

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

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

```json
DELETE /conversation/id
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "status":"success"
}
```

{% endtab %}
{% endtabs %}
