> For the complete documentation index, see [llms.txt](https://anunzi-ai.gitbook.io/anunzi-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anunzi-ai.gitbook.io/anunzi-docs/api-widgets/trabajar-con-la-api-de-llamadas/knowledge-bases/attach-knowledge-base.md).

# Asignar base de conocimiento

**POST**\
`https://api.anunzi.net/v2/knowledge_base/{knowledge_base_id}/attach`

Attach a knowledge base to an AI assistant in your Anunzi environment. This allows the assistant to access predefined information when interacting with users.

***

#### **Path Parameters**

| Parameter           | Type   | Required | Description                                    |
| ------------------- | ------ | -------- | ---------------------------------------------- |
| `knowledge_base_id` | string | Yes      | The unique ID of the knowledge base to attach. |

***

#### **Body Parameters**

| Parameter  | Type   | Required | Description                                                                     |
| ---------- | ------ | -------- | ------------------------------------------------------------------------------- |
| `model_id` | string | Yes      | The unique ID of the AI assistant to which the knowledge base will be attached. |

***

#### **Example Request (cURL)**

```bash
curl --request POST \
     --url https://api.anunzi.net/v2/knowledge_base/1739253053024x397207388602947460/attach \
     --header 'accept: application/json' \
     --header 'Authorization: Bearer API_KEY' \
     --data '
{
  "model_id": "15161681x1651561"
}
'
```

***

#### **Example Response (200 OK)**

```json
{
  "status": "success",
  "response": {
    "body": "Knowledge Base attached",
    "knowledge_base_id": "1739253053024x397207388602947460",
    "model_id": "1738862886874x680573723187741300"
  }
}
```

***

#### **Response Fields**

| Field               | Type   | Description                                                  |
| ------------------- | ------ | ------------------------------------------------------------ |
| `body`              | string | Confirmation message that the knowledge base was attached.   |
| `knowledge_base_id` | string | The unique identifier of the attached knowledge base.        |
| `model_id`          | string | The AI assistant ID to which the knowledge base is attached. |

***

#### **Status Codes**

| Code | Description                                 |
| ---- | ------------------------------------------- |
| 200  | Knowledge base attached successfully.       |
| 400  | Bad Request. Invalid or missing parameters. |
