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

# Import Bot as a New Bot API

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

To create a new bot in the account owner's Builder Tool using the File IDs generated when uploading the files to the local server. You can import a bot using either individual Definition, Config, Functions and Icon files, or you can directly use the zip file that's created while performing bot export. In this case you need to upload the zip file and use the File ID thus generated.

Refer to [Upload File API](/ai-for-service/apis/automation/upload-file) for uploading and obtaining the File ID.

<Note>
  This API requires the JWT generated by an application created only from the Admin Console.
</Note>

| Field             | Value                                                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Method**        | POST                                                                                                                            |
| **Endpoint**      | `https://{{host}}/api/public/bot/import`                                                                                        |
| **Content Type**  | `application/json`                                                                                                              |
| **Authorization** | `auth: {{JWT}}` See [How to generate the JWT Token](/ai-for-service/apis/automation/api-introduction#generating-the-jwt-token). |
| **API Scope**     | App Builder: Not Applicable; Admin Console: Bot Definition > Bot Import                                                         |

## Query Parameters

| Parameter | Description                                                  | Required |
| --------- | ------------------------------------------------------------ | -------- |
| `host`    | The environment URL. For example, `https://platform.kore.ai` | Required |

## Sample Request

Case 1: JSON

```json theme={null}
curl -X POST \
  https://{{host}}/api/public/bot/import \
  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
   -H 'content-type: application/json' \
   -d '{
  "botDefinition" : "5bxxxxxxxxxxx4f9",
  "configInfo" : "5bxxxxxxxxxxxxx4fa",
  "botFunctions":["5bxxxxxxxxxxxxxea6"],
  "icon":"5bxxxxxxxxxxxxxxxx4fb",
  "name":"gallahad4",
  "uploadMode":"JSON"
}'
```

Case 2: ZIP file

```json theme={null}
curl -X POST \
  https://{{host}}/api/public/bot/import \
  -H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
   -H 'content-type: application/json' \
   -d '{
  "zipInfo" : "661e717xxxx890b3844xxxxx",
  "name":"volkihar",
  "uploadMode":"ZIP"
}'
```

## Body Parameters

| Parameter           | Description                                                                           | Required                         |
| ------------------- | ------------------------------------------------------------------------------------- | -------------------------------- |
| **`uploadMode`**    | Mode of Upload (`JSON` or `ZIP`).                                                     | Required                         |
| **`botDefinition`** | Bot definition file ID.                                                               | Required (if uploadMode is JSON) |
| **`configInfo`**    | Bot configuration file ID.                                                            | Required (if uploadMode is JSON) |
| **`botFunctions`**  | Bot functions file ID.                                                                | Optional (if uploadMode is JSON) |
| **`icon`**          | Bot icon file ID.                                                                     | Required (if uploadMode is JSON) |
| **`zipInfo`**       | Zip file ID.                                                                          | Required (if uploadMode is ZIP)  |
| **`name`**          | Bot name. If not provided, it's fetched from the existing bot's copy.                 | Optional                         |
| **`purpose`**       | `customer` or `employee`. If not provided, it's fetched from the existing bot's copy. | Optional                         |

## Sample Response

```json theme={null}
{
    "_id": "bir-034fc180-4f84-xxxx-xxxx-5d85b76a36dc",
    "streamRefId": "46d82741-1edc-xxxx-xxxx-7e58ead9deed",
    "status": "pending",
    "statusLogs": [
        {
            "taskType": "importRequest",
            "taskName": "volkihar",
            "status": "success"
        }
    ],
    "requestType": "Botimport",
    "createdBy": "u-ed453f8f-131a-xxxx-xxxx-03405203199d",
    "createdOn": "2024-04-29T11:09:25.312Z",
    "__v": 0
}
```
