---
type: api
title: Update a Knowledge Base Entry
description: Update an existing Knowledge Base Entry by its unique `id`.
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-updateknowledgebaseentry
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v0/operation/operation-updateknowledgebaseentry
products:
  - Kibana
---

# Update a Knowledge Base Entry

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

## Paths

- `PUT` `/api/security_ai_assistant/knowledge_base/entries/{id}`

- [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

- `id` (string · min: 1)
  The unique identifier (`id`) of the Knowledge Base Entry to update.

## Description

Update an existing Knowledge Base Entry by its unique `id`.

## Request Body

`application/json`

Any of:
- **DocumentEntryCreateFields** (`type: document`)
  - `global` (boolean) — optional
    Whether this Knowledge Base Entry is global, defaults to false.
  - `name` (string) — required
    Name of the Knowledge Base Entry.
  - `namespace` (string) — optional
    Kibana Space, defaults to 'default' space.
  - `users` ([] object) — optional
    Users who have access to the Knowledge Base Entry, defaults to current user. Empty array provides access to all users.
    - `id` (string) — optional
      User id.
    - `name` (string) — optional
      User name.
  - `kbResource` (enum) — required
    Knowledge Base resource name for grouping entries, e.g. 'security_labs', 'user', etc.
    Values: `security_labs`, `defend_insights`, `user`
  - `source` (string) — required
    Source document name or filepath.
  - `text` (string) — required
    Knowledge Base Entry content.
  - `type` (enum) — required
    Entry type.
    Values: `document`
  - `required` (boolean) — optional
    Whether this resource should always be included, defaults to false.
  - `vector` ({}) — optional
    Object containing Knowledge Base Entry text embeddings and modelId used to create the embeddings.
    - `modelId` (string) — required
      ID of the model used to create the embeddings.
    - `tokens` (map string to number) — required
      Tokens with their corresponding values.
- **IndexEntryCreateFields** (`type: index`)
  - `global` (boolean) — optional
    Whether this Knowledge Base Entry is global, defaults to false.
  - `name` (string) — required
    Name of the Knowledge Base Entry.
  - `namespace` (string) — optional
    Kibana Space, defaults to 'default' space.
  - `users` ([] object) — optional
    Users who have access to the Knowledge Base Entry, defaults to current user. Empty array provides access to all users.
    - `id` (string) — optional
      User id.
    - `name` (string) — optional
      User name.
  - `description` (string) — required
    Description for when this index or data stream should be queried for Knowledge Base content. Passed to the LLM as a tool description.
  - `field` (string) — required
    Field to query for Knowledge Base content.
  - `index` (string) — required
    Index or Data Stream to query for Knowledge Base content.
  - `queryDescription` (string) — required
    Description of query field used to fetch Knowledge Base content. Passed to the LLM as part of the tool input schema.
  - `type` (enum) — required
    Entry type.
    Values: `index`
  - `inputSchema` ([] object) — optional
    Array of objects defining the input schema, allowing the LLM to extract structured data to be used in retrieval.
    - `description` (string) — required
      Description of the field.
    - `fieldName` (string) — required
      Name of the field.
    - `fieldType` (string) — required
      Type of the field.
  - `outputFields` ([] string) — optional
    Fields to extract from the query result, defaults to all fields if not provided or empty.

## Responses

#### `200`

Successful request returning the updated Knowledge Base Entry.

`application/json`

Any of:
- **DocumentEntry** (`type: document`)
  - `global` (boolean)
    Whether this Knowledge Base Entry is global, defaults to false.
  - `name` (string)
    Name of the Knowledge Base Entry.
  - `namespace` (string)
    Kibana Space, defaults to 'default' space.
  - `users` ([] object)
    Users who have access to the Knowledge Base Entry, defaults to current user. Empty array provides access to all users.
    - `id` (string)
      User id.
    - `name` (string)
      User name.
  - `createdAt` (string)
    Time the Knowledge Base Entry was created.
  - `createdBy` (string)
    User who created the Knowledge Base Entry.
  - `id` (string · min: 1)
    A string that does not contain only whitespace characters.
  - `updatedAt` (string)
    Time the Knowledge Base Entry was last updated.
  - `updatedBy` (string)
    User who last updated the Knowledge Base Entry.
  - `kbResource` (enum)
    Knowledge Base resource name for grouping entries, e.g. 'security_labs', 'user', etc.
    Values: `security_labs`, `defend_insights`, `user`
  - `source` (string)
    Source document name or filepath.
  - `text` (string)
    Knowledge Base Entry content.
  - `type` (enum)
    Entry type.
    Values: `document`
  - `required` (boolean)
    Whether this resource should always be included, defaults to false.
  - `vector` ({})
    Object containing Knowledge Base Entry text embeddings and modelId used to create the embeddings.
    - `modelId` (string)
      ID of the model used to create the embeddings.
    - `tokens` (map string to number)
      Tokens with their corresponding values.
- **IndexEntry** (`type: index`)
  - `global` (boolean)
    Whether this Knowledge Base Entry is global, defaults to false.
  - `name` (string)
    Name of the Knowledge Base Entry.
  - `namespace` (string)
    Kibana Space, defaults to 'default' space.
  - `users` ([] object)
    Users who have access to the Knowledge Base Entry, defaults to current user. Empty array provides access to all users.
    - `id` (string)
      User id.
    - `name` (string)
      User name.
  - `createdAt` (string)
    Time the Knowledge Base Entry was created.
  - `createdBy` (string)
    User who created the Knowledge Base Entry.
  - `id` (string · min: 1)
    A string that does not contain only whitespace characters.
  - `updatedAt` (string)
    Time the Knowledge Base Entry was last updated.
  - `updatedBy` (string)
    User who last updated the Knowledge Base Entry.
  - `description` (string)
    Description for when this index or data stream should be queried for Knowledge Base content. Passed to the LLM as a tool description.
  - `field` (string)
    Field to query for Knowledge Base content.
  - `index` (string)
    Index or Data Stream to query for Knowledge Base content.
  - `queryDescription` (string)
    Description of query field used to fetch Knowledge Base content. Passed to the LLM as part of the tool input schema.
  - `type` (enum)
    Entry type.
    Values: `index`
  - `inputSchema` ([] object)
    Array of objects defining the input schema, allowing the LLM to extract structured data to be used in retrieval.
    - `description` (string)
      Description of the field.
    - `fieldName` (string)
      Name of the field.
    - `fieldType` (string)
      Type of the field.
  - `outputFields` ([] string)
    Fields to extract from the query result, defaults to all fields if not provided or empty.
#### `400`

Bad Request response.

`application/json`

- `error` (string)
  Error type or category.
- `message` (string)
  Detailed error message.
- `statusCode` (number)
  HTTP status code of the error.
## Code Examples

#### curl

```curl
curl \
 --request PUT 'http://localhost:5601/api/security_ai_assistant/knowledge_base/entries/12345' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"name":"How to reset a password (updated)","type":"document","kbResource":"user","source":"manual","text":"Updated: go to settings and click Reset Password, then follow the on-screen instructions."}'
```

## Request Examples

#### Update knowledge base entry

```json
{
  "kbResource": "user",
  "name": "How to reset a password (updated)",
  "source": "manual",
  "text": "Updated: go to settings and click Reset Password, then follow the on-screen instructions.",
  "type": "document"
}
```

## Response Examples

#### Update knowledge base entry response200

```json
{
  "createdAt": "2024-01-15T10:00:00.000Z",
  "createdBy": "user@example.com",
  "global": false,
  "id": "12345",
  "kbResource": "user",
  "name": "How to reset a password (updated)",
  "namespace": "default",
  "source": "manual",
  "text": "Updated: go to settings and click Reset Password, then follow the on-screen instructions.",
  "type": "document",
  "updatedAt": "2024-01-15T10:05:00.000Z",
  "updatedBy": "user@example.com"
}
```

#### Update knowledge base entry response400

```json
{
  "error": "Invalid input",
  "message": "The \u0027text\u0027 field cannot be empty."
}
```

