> ## 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 Functions API

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

This API allows you to import bot functions from a specified file.

| Field             | Value                                                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Method**        | POST                                                                                                                            |
| **Endpoint**      | `https://{{host}}/api/public/bot/botId/import/botfunctions`                                                                     |
| **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 | Required | Description                                                                                                                                   |
| --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `host`    | Required | The environment URL. For example, `https://platform.kore.ai`                                                                                  |
| `botID`   | Required | The Bot ID or Stream ID of the bot into which you want to import the functions. You can get it under **General Settings** on the App Builder. |

## Sample Request

```json theme={null}
curl -X POST \
'https://{{host}}/api/public/bot/botId/import/botfunctions' \
--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
--header 'content-type: application/json' \
--data '[{"fileName":"BotFunctions.js","fileId":"6565d8fea4fa7f2827b225f3"}]'
```

## Body Parameters

| Parameter  | Required | Description                                                                                                                                                                                                     |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fileId`   | Required | The unique identifier (ID) of the file to be imported. This ID can be retrieved from the response of the [Upload File API](/ai-for-service/apis/automation/upload-file) after uploading the Bot Functions file. |
| `fileName` | Required | The name of the file containing the bot functions to import.                                                                                                                                                    |

## Sample Response

**Success:**

```json theme={null}
{
    "requestType": "BotImport",
    "status": "Success",
    "createdOn": "2023-11-28T12:14:59.215Z",
    "_id": "6565d9c378438bc41a6cfxxx",
    "createdBy": "u-37bc3853-76fd-5a25-b307-1af2e8f1bxxx",
    "__v": 0,
    "fileId": "6565d8fea4fa7f2827b225f3",
    "fileName": "BotFunctions.js"
}
```

**Failure:**

```json theme={null}
{
    "errors": [
        {
            "msg": "Invalid file id",
            "code": 400
        }
    ]
}
```
