> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supportai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Conversations

> Learn how to managed your AI chatbot conversations with the Support AI conversations API endpoints.

Leverage the following Conversations API to view and delete the different conversations that your AI chatbot is having with your contacts and customers.

### Properties

<ParamField body="id" type="string">
Unique identifier for the conversation.
</ParamField>

<ParamField body="thread_id" type="string">
Unique identifier for the conversation thread.
</ParamField>

<ParamField body="message" type="string">
The conversation message contents.
</ParamField>

<ParamField body="date" type="string">
The date the conversation took place.
</ParamField>

<ParamField body="lead" type="string">
If there was a lead, this will contain the details about the lead.
</ParamField>

<ParamField body="type" type="string">
Whether the message was from a user or a bot.
</ParamField>

***

**POST** /fetchConversations/:chatbot_id

## Fetch conversations

Get the list of last conversations of a specific chatbot of your account. The default number of conversations is 100. The message from the response is the last message received from the user in the thread.

### Required attributes

<ParamField body="chatbot_id" type="string">
The Chatbot ID that you want to get the training links for.
</ParamField>

### Optional attributes

<ParamField body="limit" type="integer">
Limit the number of conversations returned. Defaults to last 10 conversations.
</ParamField>

### Request

**POST** /fetchConversations/:chatbot_id

```bash
curl --request POST \
  --url https://api.supportai.com/fetchConversations/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...'
  --data '{"limit":100}'
```

### Response

```json
{
  "success": true,
  "data": [
    {
      "thread_id": "6906efee...",
      "message": "What is your pricing?",
      "date": "2024-01-20T01:02:34.609757+00:00",
      "lead": "{json string}"
    }
    ...
  ]
}
```

***

**POST** /fetchMessages/:chatbot_id

## Fetch conversation messages

Get the list of messages of a specific conversation of a specific chatbot of your account. Messages are sorted by ID, the last message in the response is the most recent.

### Required attributes

<ParamField body="chatbot_id" type="string">
The Chatbot ID that you want to get the training links for.
</ParamField>

<ParamField body="thread_id" type="string">
The Conversation thread ID that you want to get the messages for. Can be obtained from the Fetch conversations endpoint.
</ParamField>

#### Request

**POST** /fetchMessages/:chatbot_id

```bash
curl --request POST \
  --url https://api.supportai.com/fetchMessages/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...' \
  --data '{"thread_id":"fdbe104a..."}'
```

### Response

```json
{
  "success": true,
  "data": [
    {
      "id": 123456,
      "message": "What is your pricing?",
      "date": "2024-01-19T19:15:55.666419+00:00",
      "type": "user" (or bot)
    }
    ...
  ]
}
```

***

**GET** /deleteConversation/:chatbot_id

## Delete a conversation

Delete a conversation and its messages of a specific chatbot of your account.

### Required attributes

<ParamField body="chatbot_id" type="string">
The Chatbot ID that you want to get the training links for.
</ParamField>

<ParamField body="thread_id" type="string">
The Conversation thread ID that you want to get the messages for. Can be obtained from the Fetch conversations endpoint.
</ParamField>

#### Request

**GET** /deleteConversation/:chatbot_id

```bash
curl --request GET \
  --url https://api.supportai.com/deleteConversation/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...'
  --data '{"thread_id":"18407402..."}'
```

#### Response

```json
{
  "success": true
}
```

---

This knowledge base is built and hosted on [Weav](https://weav.com).
