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

# Train APIs

<Badge icon="arrow-left" color="gray">[Back to API List](/ai-for-service/apis/searchai/api-list)</Badge>

## Initiate Training

This API trains the Search AI application with all ingested content or with specific content. Training may take a while depending on the amount of content. Use the Training Status API to check the training status.

| Field             | Value                                    |
| ----------------- | ---------------------------------------- |
| **Method**        | POST                                     |
| **Endpoint**      | `<host_url>/api/public/bot/:botId/train` |
| **Content-Type**  | `application/json`                       |
| **Authorization** | `auth: <JWT Token>`                      |
| **API Scope**     | Train                                    |

### Query Parameters

| Parameter | Description                       | Mandatory |
| --------- | --------------------------------- | --------- |
| Bot ID    | Provide your application ID here. | Yes       |

### Request Parameters

| Parameter    | Description                                                                                               | Mandatory |
| ------------ | --------------------------------------------------------------------------------------------------------- | --------- |
| `contentIds` | Array of unique content IDs to train with. If omitted, the application trains with all available content. | No        |

### Sample Request

```json theme={null}
{
  "contentIds": ["fc-3f8d7001-6480-528a-9158-9d9791555726"]
}
```

### Sample Response

The `_id` field is a unique identifier you can use to check training status via the Training Status API. The `status` field indicates the current state, and `opType` specifies whether training was initiated manually or automatically.

```json theme={null}
{
  "_id": "fjg-a9ee651e-ab49-54e6-899c-35d0fbadba0f",
  "opType": "Manual",
  "searchIndexId": "sidx-6fee87f7-7817-577d-88c5-ee5d9f560327",
  "extractionSourceId": null,
  "contentId": [],
  "status": "running",
  "executionLog": {
    "extraction": {
      "jobId": "fj-52c36b29-d462-5e05-b942-aaa6675971e4",
      "type": "EXTRACTION",
      "status": "running"
    }
  },
  "isHide": false,
  "createdBy": "u-33eb7a56-3406-5a16-9e6a-bf14a785c25c",
  "lModBy": "u-33eb7a56-3406-5a16-9e6a-bf14a785c25c",
  "lMod": "2024-10-14T10:37:05.013Z",
  "createdOn": "2024-10-14T10:37:05.013Z",
  "__v": 0
}
```

***

## Get Training Status

This API returns the current status of the training process.

| Field             | Value                                              |
| ----------------- | -------------------------------------------------- |
| **Method**        | GET                                                |
| **Endpoint**      | `<host_url>/api/public/bot/:botId/job-group/jobId` |
| **Content-Type**  | `application/json`                                 |
| **Authorization** | `auth: <JWT Token>`                                |
| **API Scope**     | Answer Generation                                  |

### Query Parameters

| Parameter    | Description                                          | Mandatory |
| ------------ | ---------------------------------------------------- | --------- |
| Bot ID       | Provide your application ID here.                    | Yes       |
| Job Group ID | The unique ID generated when training was initiated. | Yes       |

### Sample Request

```bash theme={null}
curl --location 'https://your-domain.com/api/public/bot/st-c6cxxxxxxxx-553e-bd8f-a490389b3222/job-group/fjg-ba81546b-3b57-xxxx-xxxx-9b890eebbf13' \
--header 'Accept: application/json, text/plain, */*' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json;charset=UTF-8' \
--header 'auth: <your-auth-key>'
```

### Sample Response

The `status` field shows the current training state: `success`, `in progress`, or `failed`. The `opType` field indicates whether training was initiated automatically by Search AI or manually.

```json theme={null}
{
  "_id": "fjg-ba81546b-3b57-5116-a78d-9b890eebbf13",
  "opType": "Auto",
  "searchIndexId": "sidx-03dd1dc4-c077-568d-b0c1-b67cc194592b",
  "extractionSourceId": "fs-27cf487f-34df-5810-a3b4-3adbfe55261a",
  "contentId": [],
  "status": "success",
  "executionLog": {
    "parsing": {
      "jobId": "fj-5b00d294-aace-5682-a218-cd7db7b9848f",
      "type": "PARSING",
      "status": "success",
      "errMsg": "",
      "timeTook": 215
    },
    "extraction": {
      "jobId": "fj-64d846f9-687c-55d1-bca7-5ed01b9a96b9",
      "type": "EXTRACTION",
      "status": "success",
      "errMsg": "",
      "timeTook": 196
    },
    "indexing": {
      "jobId": "fj-e110d0a4-a99d-5449-bb11-f5fbca8dfd31",
      "type": "INDEXING",
      "status": "success",
      "timeTook": 2827
    }
  },
  "isHide": false,
  "createdBy": "u-d762cdc1-55a0-5cef-8e2d-90a8ff1e5dc5",
  "lModBy": "u-d762cdc1-55a0-5cef-8e2d-90a8ff1e5dc5",
  "trackEventLogs": true,
  "lMod": "2025-10-21T13:43:31.315Z",
  "createdOn": "2025-10-21T13:43:28.441Z",
  "__v": 0
}
```
