> For the complete documentation index, see [llms.txt](https://40factory.gitbook.io/wilson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://40factory.gitbook.io/wilson/3.12/rest-api/bots/create-bot.md).

# Create bot

This endpoint allows to create a new bot.

## Request <a href="#request" id="request"></a>

### Url

```
POST https://wilson.40mat.com/apif/v2/company/<company_id>/bot
```

### Headers

<pre><code><strong>AUTH
</strong>Bearer "eyJ0eXAiOiJKV1QiLCJub25jZSI6IndUZXphSTNjdTNVYj..."
</code></pre>

### Parameters

```
No parameters are required for this endpoint.
```

### Body

```json
{
    "label": "Default bot label",
    "description": "Description to briefly explain the purpose of the bot",
    "auto_document_selector": "choose",
    "manual_filters": true,
    "data_scientist_mode": true,
    "icon": {
        "name": "smart_toy",
        "type": "material"
    },
    "locale": "en",
    "prompt": {
        "name": "Wilson",
        "prompt": "Act as an assistance for the usage of the industrial machines."
    },
    "filters": {
        "paths": [
            "/folder"
        ],
        "tags": [
            "demo",
            "test"
        ]
    }
}
```

* `label` (string) (Required): Label of bot.&#x20;
* `description` (string) (Required): Description to briefly explain the purpose of the bot.&#x20;
* `prompt` (string) (Required): Prompt of bot, to indicate to the bot how it should behave
* `auto_document_selector` (string) (Optional): Determinate if auto document selector is enabled; possible values:&#x20;
  * `hidden` to don't show option in UI, ignored through API.
  * `choose` allow user to chose if activate it in chat.
  * `always` always active.&#x20;
* `manual_filters` (boolean) (Optional): If true, user can indicate filters manually, based on the scope of bot.&#x20;
* `data_scientist_mode` (boolean) (Optional): If true, it can be used data scientist mode.
* `icon` (object) (Optional): Object with keys with string values: name and type.\
  Default type is "material", name the id of icon in material library.
* `locale` (string) (Optional): Identifier of default language of bot in ISO 639. Can also be "AUTOMATIC" to leave the bot to understand current language.
* `filters` (object) (Optional): Object with two attributes paths and tags, two array of strings. \
  In `paths` there are strings of folders path to include in retrieving procedure. In `tags` strings of tags.\
  Condition between paths and tags is "OR"

***

## Response&#x20;

The response is the created bot in JSON format, contain same properties in addition:

* `id` (string): The ID of the bot.&#x20;

```json
{
    "id": "668335e81ad9bc07e57b...",
    "label": "Default bot label",
    "description": "Description to briefly explain the purpose of the bot",
    "auto_document_selector": "choose",
    "manual_filters": true,
    "data_scientist_mode": true,
    "icon": {
        "name": "smart_toy",
        "type": "material"
    },
    "locale": "en",
    "prompt": {
        "name": "Wilson",
        "prompt": "Act as an assistance for the usage of the industrial machines."
    },
    "filters": {
        "paths": [
            "/folder"
        ],
        "tags": [
            "demo",
            "test"
        ]
    }
}
```

***

## Code example

{% tabs %}
{% tab title="Python" %}

```python
import requests

url = "https://wilson.40mat.com/apif/v2/company/<company_id>/bot"

payload = {
    "label": "Default bot label",
    "description": "Description to briefly explain the purpose of the bot",
    "prompt": {
        "name": "Wilson",
        "prompt": "Act as an assistance for the usage of the industrial machines."
    }
}

headers = {
  'Authorization': '••••••'
}

response = requests.request("POST", url, headers=headers, json=payload)

print(response.text)
```

{% endtab %}

{% tab title="cURL" %}

```powershell
curl --location 'https://wilson.40mat.com/apif/v2/company/<company_id>/bot' \
--header 'Authorization: ••••••' \
--data '{
    "label": "Default bot label",
    "description": "Description to briefly explain the purpose of the bot",
    "prompt": {
        "name": "Wilson",
        "prompt": "Act as an assistance for the usage of the industrial machines."
    }
}'
```

{% endtab %}
{% endtabs %}
