---
title: "Asynchronous operation to modify a knowledgebase."
method: PATCH
path: "/knowledgebases/{kbId}"
tags: ["Knowledgebases"]
---

# Asynchronous operation to modify a knowledgebase.

`PATCH /knowledgebases/{kbId}`

## Path parameters

- `kbId` string, required

## Request body

- UpdateKbOperationDTO — Contains list of QnAs to be updated
  - `add` CreateKbInputDTO — Input to create KB.
    - `qnaList` QnADTO[] — List of QNA to be added to the index. Ids are generated by the service and should be omitted.
      - `id` integer — Unique id for the Q-A.
      - `answer` string, required — Answer text
      - `source` string — Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
      - `questions` string[], required — List of questions associated with the answer.
      - `metadata` MetadataDTO[] — List of metadata associated with the answer.
        - `name` string, required — Metadata name.
        - `value` string, required — Metadata value.
      - `context` ContextDTO — Context associated with Qna.
        - `isContextOnly` boolean — To mark if a prompt is relevant only with a previous question or not. true - Do not include this QnA as search result for queries without context false - ignores context and includes this QnA in search result
        - `prompts` PromptDTO[] — List of prompts associated with the answer.
          - `displayOrder` integer — Index of the prompt - used in ordering of the prompts
          - `qnaId` integer — Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.
          - `qna` QnADTO — recursive
          - `displayText` string — Text displayed to represent a follow up question prompt
    - `urls` string[] — List of URLs to be added to knowledgebase.
    - `files` FileDTO[] — List of files to be added to knowledgebase.
      - `fileName` string, required — File name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx".
      - `fileUri` string, required — Public URI of the file.
  - `delete` DeleteKbContentsDTO — PATCH body schema of Delete Operation in UpdateKb
    - `ids` integer[] — List of Qna Ids to be deleted
    - `sources` string[] — List of sources to be deleted from knowledgebase.
  - `update` UpdateKbContentsDTO — PATCH body schema for Update operation in Update Kb
    - `name` string — Friendly name for the knowledgebase.
    - `qnaList` UpdateQnaDTO[] — List of Q-A (UpdateQnaDTO) to be added to the knowledgebase.
      - `id` integer — Unique id for the Q-A
      - `answer` string — Answer text
      - `source` string — Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
      - `questions` UpdateQuestionsDTO — PATCH Body schema for Update Kb which contains list of questions to be added and deleted
        - `add` string[] — List of questions to be added
        - `delete` string[] — List of questions to be deleted.
      - `metadata` UpdateMetadataDTO — PATCH Body schema to represent list of Metadata to be updated
        - `delete` MetadataDTO[] — List of Metadata associated with answer to be deleted
          - `name` string, required — Metadata name.
          - `value` string, required — Metadata value.
        - `add` MetadataDTO[] — List of metadata associated with answer to be added
          - `name` string, required — Metadata name.
          - `value` string, required — Metadata value.
      - `context` UpdateContextDTO — Update Body schema to represent context to be updated
        - `promptsToDelete` integer[] — List of prompts associated with qna to be deleted
        - `promptsToAdd` PromptDTO[] — List of prompts to be added to the qna.
          - `displayOrder` integer — Index of the prompt - used in ordering of the prompts
          - `qnaId` integer — Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.
          - `qna` QnADTO — Q-A object.
            - `id` integer — Unique id for the Q-A.
            - `answer` string, required — Answer text
            - `source` string — Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
            - `questions` string[], required — List of questions associated with the answer.
            - `metadata` MetadataDTO[] — List of metadata associated with the answer.
              - …
            - `context` ContextDTO — Context associated with Qna.
              - …
          - `displayText` string — Text displayed to represent a follow up question prompt
        - `isContextOnly` boolean — To mark if a prompt is relevant only with a previous question or not. true - Do not include this QnA as search result for queries without context false - ignores context and includes this QnA in search result
    - `urls` string[] — List of existing URLs to be refreshed. The content will be extracted again and re-indexed.
  - `enableHierarchicalExtraction` boolean — Enable hierarchical extraction of Q-A from files and urls. The value set during KB creation will be used if this field is not present.
  - `defaultAnswerUsedForExtraction` string — Text string to be used as the answer in any Q-A which has no extracted answer from the document but has a hierarchy. Required when EnableHierarchicalExtraction field is set to True.

## Response `202`

Details of the asynchronous operation.

- Operation — Record to track long running operation.
  - `operationState` 'Failed' | 'NotStarted' | 'Running' | 'Succeeded' — Enumeration of operation states.
  - `createdTimestamp` string — Timestamp when the operation was created.
  - `lastActionTimestamp` string — Timestamp when the current state was entered.
  - `resourceLocation` string — Relative URI to the target resource location for completed resources.
  - `userId` string — User Id
  - `operationId` string — Operation Id.
  - `errorResponse` ErrorResponse — Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
    - `error` Error — The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
      - `code` 'BadArgument' | 'Forbidden' | 'NotFound' | 'KbNotFound' | 'Unauthorized' | 'Unspecified' | 'EndpointKeysError' | 'QuotaExceeded' | 'QnaRuntimeError' | 'SKULimitExceeded' | 'OperationNotFound' | 'ServiceError' | 'ValidationFailure' | 'ExtractionFailure', required — Human readable error code.
      - `message` string — A human-readable representation of the error.
      - `target` string — The target of the error.
      - `details` Error[] — An array of details about specific errors that led to this reported error.
      - `innerError` InnerErrorModel — An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
        - `code` string — A more specific error code than was provided by the containing error.
        - `innerError` InnerErrorModel — recursive

## Other responses

- `default` — Error response.

---

[API](https://skmtc.net/azure/apis/qnamaker-client.md) · [All operations](https://skmtc.net/azure/apis/qnamaker-client/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/qnamaker-client/versions/75b50ce22fbe/schema)
