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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/conversation-thread.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.
