> ## 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.

# Training Items

> Learn how to train your AI with the Support AI training items API endpoints.

Your training items are at the heart of a good AI chatbot. Leverage the training items API to keep your AI chatbot informed of the latest information about your business.

### Properties

<ParamField body="id" type="integer">
Unique identifier for the training item.
</ParamField>

<ParamField body="source" type="string">
The source of the training item.
</ParamField>

<ParamField body="type" type="string">
The type of training item. (URL, File, Text, etc.)
</ParamField>

<ParamField body="date" type="string">
The date which the training item was created.
</ParamField>

<ParamField body="content" type="string">
For text type training items, this will contain the training text.
</ParamField>

***

**GET** /listLinks/:chatbot_id

## List all links

Get the list of all training links of a specific chatbot.

### Required attributes

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

### Request

**GET** /listLinks/:chatbot_id

```bash
curl -G https://api.supportai.com/listLinks/:chatbot_id \
  -H "Authorization: Bearer IDZFdfiD..." \
```

### Response

```json
{
  "success": true,
  "data": [
    {
      "id": 123456,
      "source": "https://...",
      "type": "url",
      "date": "2023-12-22T16:01:26"
    }
    ...
  ]
}
```

***

**POST** /addLink/:chatbot_id

## Add link

Add a new training link to a specific chatbot of your account. The advantage of using this request over adding multiple links is that you will get the document ID in the response.

### Required attributes

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

#### Request

**POST** /addLink/:chatbot_id

```bash
curl https://api.supportai.com/addLink/:chatbot_id \
  -H "Authorization: Bearer IDZFdfiD..."
```

#### Response

```json
{
  "success": true,
  "id": 123456
}
```

***

**POST** /addLinks/:chatbot_id

## Add multiple links

Add new training links to a specific chatbot of your account. **Send the links as a JSON string in the request body**.

### Required attributes

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

<ParamField body="links" type="string">
An array of the links you want to get trained.
</ParamField>

#### Request

**POST** /addLinks/:chatbot_id

```bash
curl --request POST \
  --url https://api.supportai.com/addLinks/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...' \
  --header 'Content-Type: application/json' \
  --data '{"links":["https://...","https://...",...]}'
```

#### Response

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

***

**POST** /updateLink/:chatbot_id

## Update a link

Update a training link of a specific chatbot of your account. You can either update a link using a URL or a link ID (received when adding a new link).

### Required attributes

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

<ParamField body="link or id" type="string">
The link url or the ID of the training item.
</ParamField>

#### Request

**POST** /updateLink/:chatbot_id

```bash
curl --request POST \
  --url https://api.supportai.com/updateLink/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...' \
  --header 'Content-Type: application/json' \
  --data '{"link":"https://..."}' or '{"id":123456}'
```

#### Response

```json
{
  "success": true,
  "id": 123456
}
```

***

**GET** /listTexts/:chatbot_id

## List all texts

Get the list of all training texts 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 texts for.
</ParamField>

#### Request

**GET** /listTexts/:chatbot_id

```bash
curl -G https://api.supportai.com/listTexts/:chatbot_id \
  -H "Authorization: Bearer IDZFdfiD..." \
```

button: Copy Copied!

#### Response

```json
{
  "success": true,
  "data": [
    {
      "id": 123456,
      "content": "Hello world...",
      "type": "text",
      "date": "2023-12-22T16:01:26"
    }
    ...
  ]
}
```

***

**POST** /addText/:chatbot_id

## Add text

Add a new training text to 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="text" type="string">
The text you want to add to be trained.
</ParamField>

#### Request

**POST** /addText/:chatbot_id

```bash
curl --request POST \
  --url https://api.supportai.com/addText/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...' \
  --header 'Content-Type: application/json' \
  --data '{"text":"Hello world"}'
```

#### Response

```json
{
  "success": true,
  "id": 123456
}
```

***

**GET** /listFiles/:chatbot_id

## List all files

Get the list of all training files 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 texts for.
</ParamField>

### Request

**GET** /listFiles/:chatbot_id

```bash
curl -G https://api.supportai.com/listFiles/:chatbot_id \
  -H "Authorization: Bearer IDZFdfiD..." \
```

#### Response

```json
{
  "success": true,
  "data": [
    {
      "id": 123456,
      "source": "hello_world.pdf",
      "type": "file",
      "date": "2023-12-22T16:01:26"
    }
    ...
  ]
}
```

***

**POST** /deleteItem/:chatbot_id

## Delete training item

Training items include links, texts, and files. You can delete any training item using this endpoint.

### Required attributes

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

<ParamField body="id" type="string">
The ID of the training item that you want to delete.
</ParamField>

#### Request

**POST** /deleteItem/:chatbot_id

```bash
curl --request POST \
  --url https://api.supportai.com/deleteItem/:chatbot_id \
  --header 'Authorization: Bearer IDZFdfiD...' \
  --header 'Content-Type: application/json' \
  --data '{"id":123456}'
```

### Response

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

---

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