---
type: api
title: Create a KnowledgeBase
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-createknowledgebase
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v8/operation/operation-createknowledgebase
products:
  - Kibana
---

# Create a KnowledgeBase

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/security_ai_assistant/knowledge_base/{resource}`
- `POST` `/s/{space_id}/api/security_ai_assistant/knowledge_base/{resource}`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v8/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v8/authentication#basicauth)

#### Path Parameters

- `resource` (string)
  The KnowledgeBase `resource` value.

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Create a KnowledgeBase

## Query String Parameters

- `modelId` (string)
  ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used.
- `ignoreSecurityLabs` (boolean · default: false)
  Indicates whether we should or should not install Security Labs docs when setting up the Knowledge Base. Defaults to `false`.

## Responses

#### `200`

Indicates a successful call.

`application/json`

- `success` (boolean)
  Identify the success of the method execution.
#### `400`

Generic Error

`application/json`

- `error` (string)
  A short description of the error.
- `message` (string)
  A detailed error message.
- `statusCode` (number)
  The HTTP status code of the error.
## Code Examples

#### Console

```console
POST /api/security_ai_assistant/knowledge_base/{resource}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/security_ai_assistant/knowledge_base/{resource}"
```

