---
type: api
title: Create a KnowledgeBase
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v8/operation/operation-createknowledgebase
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/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}`

#### Path parameters

- `resource` (string) — required
  The KnowledgeBase `resource` value.
  Example: `kb12345`

## Description

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

Create a KnowledgeBase

## Authentication

- Api key: `Authorization: <value>`
  These APIs use key-based authentication. You must create an API key and use the encoded value in the request header. For example: `Authorization: ApiKey base64AccessApiKey`
- Basic: `Authorization: Basic <credentials>`

## Query string parameters

- `modelId` (string) — optional
  ELSER modelId to use when setting up the Knowledge Base. If not provided, a default model will be used.
  Example: `elser-model-001`
- `ignoreSecurityLabs` (boolean · default: false) — optional
  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 kbn:/api/security_ai_assistant/knowledge_base/kb12345
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/security_ai_assistant/knowledge_base/kb12345" \
  -H "Authorization: ApiKey ${API_KEY}"
```

