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

# Bot Variables Import API

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

Import environment and content (locale) variables into a bot.

| Field             | Value                                                                                                                           |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Method**        | POST                                                                                                                            |
| **Endpoint**      | `https://{{host}}/api/{{version}}/public/builder/bot/{{botId}}/variables/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: Import Variables; Admin Console: Not Applicable                                                                    |

## Path Parameters

| Parameter        | Required | Description                                                         |
| ---------------- | -------- | ------------------------------------------------------------------- |
| `host`           | Required | The environment URL, for example: `https://platform.kore.ai`.       |
| `botId/streamId` | Required | App ID or Bot ID. Access it via **App Settings** → **App Profile**. |
| `version`        | Required | API version, for example: `1.1`.                                    |

## Sample Request

```json theme={null}
curl --location 'https://{{host}}/api/1.1/public/builder/bot/{{botId}}/variables/import' \
--header 'Content-Type: application/json' \
--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
--data '[
   {
       "key": "Global",
       "value": "Globalkey-prePopulated",
       "hint": "",
       "variableType": "env",
       "scope": "prePopulated"
   },
   {
       "key": "Lang",
       "variableType": "locale",
       "scope": "prePopulated",
       "localeData": {
         "en": {
           "value": "english language prompt",
           "hint": ""
         }
       }
   }
]'
```

## Body Parameters

| Parameter                     | Required                   | Description                                                                               |
| ----------------------------- | -------------------------- | ----------------------------------------------------------------------------------------- |
| `key`                         | Required                   | Name of the variable.                                                                     |
| `value`                       | Required                   | Value for the variable.                                                                   |
| `hint`                        | Required                   | Description of the variable.                                                              |
| `variableType`                | Required                   | Type of the variable: `env` (Environment/Global variable) or `locale` (Content variable). |
| `scope`                       | Required                   | Scope of the variable: `prePopulated`, `askOnInstall`, or `hidden`.                       |
| `localeData`                  | Required (for locale type) | Applicable only when `variableType = locale`. Contains language-specific data.            |
| `localeData.localeCode`       | Required (for locale type) | Locale identifier, for example `en`, `fr`, `ja`.                                          |
| `localeData.localeCode.hint`  | Optional                   | Optional hint for the localized value.                                                    |
| `localeData.localeCode.value` | Required (for locale type) | Localized message or text for the locale.                                                 |

## Sample Request When Collections Are Enabled

```json theme={null}
curl -X POST \
  https://{{host}}/api/1.1/public/builder/bot/{{botId}}/variables/import \
--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "botVariables": [
        {
            "key": "CVar",
            "value": "Cvar1",
            "variableType": "locale",
            "scope": "prePopulated",
            "localeData": {
                "en": {
                    "value": "Cvar1",
                    "hint": ""
                }
            }
        }
    ],
    "botCollections": [
        {
            "name": "Default",
            "description": "Default Collection",
            "refId": "8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx"
        }
    ],
    "botCollectionVariables": [
        {
            "key": "GKey1",
            "value": "GValue1-C",
            "refId": "8xxxxxxa-exxc-5xx1-bxxd-56xxxxxxxxxx"
        }
    ]
}'
```

<Note>
  The `botCollections` and `botCollectionVariables` fields are required only when importing bot collection variables.
</Note>

### Body Parameters (Collections)

| Parameter                      | Type   | Description                                                                                         |
| ------------------------------ | ------ | --------------------------------------------------------------------------------------------------- |
| `botVariables`                 | array  | List of bot-level variables to create or import.                                                    |
| `botCollections`               | array  | Required only when importing bot collection variables. Defines available bot collections.           |
| `botCollections.name`          | string | Name of the bot collection.                                                                         |
| `botCollections.description`   | string | Description of the bot collection.                                                                  |
| `botCollections.refId`         | string | Unique identifier of the bot collection.                                                            |
| `botCollectionVariables`       | array  | Required only when importing bot collection variables. Defines collection-specific variable values. |
| `botCollectionVariables.key`   | string | Name of the variable within the bot collection.                                                     |
| `botCollectionVariables.value` | string | Value assigned to the variable for the specified collection.                                        |
| `botCollectionVariables.refId` | string | Reference ID of the bot collection.                                                                 |

## Sample Response

```json theme={null}
{
  "message": "2 Variables imported/updated successfully."
}
```
