---
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/4371/api/doc/kibana/v0/operation/operation-createknowledgebase
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/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}`

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

#### Path Parameters

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

## Description

Create a knowledge base with a specific resource identifier.

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

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

