---
title: "Asynchronous operation to create a new knowledgebase."
method: POST
path: "/knowledgebases/create"
tags: ["Knowledgebases"]
---

# Asynchronous operation to create a new knowledgebase.

`POST /knowledgebases/create`

## Request body

- CreateKbDTO — Post body schema for CreateKb operation.
  - `name` string, required — Friendly name for the knowledgebase.
  - `qnaList` QnADTO[] — List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned 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 used for extracting Q-A.
  - `files` FileDTO[] — List of files from which to Extract Q-A.
    - `fileName` string, required — File name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx".
    - `fileUri` string, required — Public URI of the file.
  - `enableHierarchicalExtraction` boolean — Enable hierarchical extraction of Q-A from files and urls. Value to be considered False 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.
  - `language` string — Language of the knowledgebase. Please find the list of supported languages <a href="https://aka.ms/qnamaker-languages#languages-supported" target="_blank">here</a>.

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