---
type: api
title: Create a KnowledgeBase for a resource
description: Create a knowledge base with a specific resource identifier.
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-createknowledgebase
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/kibana/v0/operation/operation-createknowledgebase
products:
  - Kibana
---

# Create a KnowledgeBase for a resource

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

## Paths

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

#### Path parameters

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

## Description

Create a knowledge base with a specific resource identifier.

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

Bad Request response.

`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

#### curl

```curl
curl \
 --request POST 'http://localhost:5601/api/security_ai_assistant/knowledge_base/kb12345?ignoreSecurityLabs=false' \
 --header "Authorization: $API_KEY"
```

## Response examples

#### A response that indicates that the request was successful.

```json
{
  "success": true
}
```

#### A response for a request that failed due to an invalid query parameter value.

```json
statusCode: 400 error: Bad Request message: "[request query]: ignoreSecurityLabs: Invalid enum value. Expected 'true' | 'false', received 'yes', ignoreSecurityLabs: Expected boolean, received string"
```

