swagger: "2.0"
schemes:
  - https
host: azure.local
info:
  description: An API for QnAMaker Service
  title: QnAMaker Client
  version: "4.0"
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/cognitiveservices/data-plane/QnAMaker/stable/v4.0/QnAMaker.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: cognitiveservices-QnAMaker
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  apim_key:
    in: header
    name: Ocp-Apim-Subscription-Key
    type: apiKey
security:
  - apim_key: []
parameters:
  CreateKbPayload:
    description: Post body of the request.
    in: body
    name: createKbPayload
    required: true
    schema:
      $ref: "#/definitions/CreateKbDTO"
    x-ms-parameter-location: method
    x-nullable: true
  Endpoint:
    description: "Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com)."
    in: path
    name: Endpoint
    required: true
    type: string
    x-ms-parameter-location: client
    x-ms-skip-url-encoding: true
  EndpointSettingsPayload:
    description: Post body of the request.
    in: body
    name: endpointSettingsPayload
    required: true
    schema:
      $ref: "#/definitions/EndpointSettingsDTO"
    x-ms-parameter-location: method
    x-nullable: true
  Environment:
    description: Specifies whether environment is Test or Prod.
    enum:
      - Prod
      - Test
    in: path
    name: environment
    required: true
    type: string
    x-ms-enum:
      modelAsString: true
      name: EnvironmentType
    x-ms-parameter-location: method
    x-nullable: false
  KbId:
    description: Knowledgebase id.
    in: path
    name: kbId
    required: true
    type: string
    x-ms-parameter-location: method
    x-nullable: false
  KeyType:
    description: Type of Key
    in: path
    name: keyType
    required: true
    type: string
    x-ms-parameter-location: method
    x-nullable: false
  OperationId:
    description: Operation id.
    in: path
    name: operationId
    required: true
    type: string
    x-ms-parameter-location: method
    x-nullable: false
  ReplaceKb:
    description: An instance of ReplaceKbDTO which contains list of qnas to be uploaded
    in: body
    name: replaceKb
    required: true
    schema:
      $ref: "#/definitions/ReplaceKbDTO"
    x-ms-parameter-location: method
    x-nullable: true
  UpdateKb:
    description: Post body of the request.
    in: body
    name: updateKb
    required: true
    schema:
      $ref: "#/definitions/UpdateKbOperationDTO"
    x-ms-parameter-location: method
    x-nullable: true
  WordAlterations:
    description: New alterations data.
    in: body
    name: wordAlterations
    required: true
    schema:
      $ref: "#/definitions/WordAlterationsDTO"
    x-ms-parameter-location: method
    x-nullable: true
paths:
  /alterations:
    get:
      operationId: Alterations_Get
      parameters: []
      responses:
        "200":
          description: Alterations data.
          schema:
            $ref: "#/definitions/WordAlterationsDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Download alterations from runtime.
      tags:
        - Alterations
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
          responses:
            "200":
              body:
                wordAlterations:
                  - alterations:
                      - qnamaker
                      - qna maker
                  - alterations:
                      - botframework
                      - bot framework
                  - alterations:
                      - webchat
                      - web chat
              headers: {}
    put:
      operationId: Alterations_Replace
      parameters:
        - $ref: "#/parameters/WordAlterations"
      responses:
        "204":
          description: HTTP 204 No Content.
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Replace alterations data.
      tags:
        - Alterations
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            wordAlterations:
              wordAlterations:
                - alterations:
                    - qnamaker
                    - qna maker
                - alterations:
                    - botframework
                    - bot framework
                - alterations:
                    - webchat
                    - web chat
          responses:
            "204": {}
  /endpointSettings:
    get:
      operationId: EndpointSettings_GetSettings
      parameters: []
      responses:
        "200":
          description: Response with endpoint settings info in it.
          schema:
            $ref: "#/definitions/EndpointSettingsDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Gets endpoint settings for an endpoint.
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
          responses:
            "200":
              body:
                activeLearning:
                  enable: "True"
              headers: {}
    patch:
      operationId: EndpointSettings_UpdateSettings
      parameters:
        - $ref: "#/parameters/EndpointSettingsPayload"
      responses:
        "200":
          description: Response with endpointSettings update status.
          schema:
            type: string
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Updates endpoint settings for an endpoint.
      tags:
        - EndpointKeys
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            endpointSettingsPayload:
              activeLearning:
                enable: "True"
          responses:
            "200":
              body: Successfully updated endpoint settings
              headers: {}
  /endpointkeys:
    get:
      operationId: EndpointKeys_GetKeys
      parameters: []
      responses:
        "200":
          description: Response with endpoint info in it.
          schema:
            $ref: "#/definitions/EndpointKeysDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Gets endpoint keys for an endpoint
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
          responses:
            "200":
              body:
                installedVersion: 4.0.5
                lastStableVersion: 4.0.6
                primaryEndpointKey: 73e88a14-694a-44d5-883b-184a68aa8530
                secondaryEndpointKey: b2c98c16-ca31-4294-8626-6c57454a5063
              headers: {}
  "/endpointkeys/{keyType}":
    patch:
      operationId: EndpointKeys_RefreshKeys
      parameters:
        - $ref: "#/parameters/KeyType"
      responses:
        "200":
          description: Details of the endpoint keys generated.
          schema:
            $ref: "#/definitions/EndpointKeysDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Re-generates an endpoint key.
      tags:
        - EndpointKeys
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            keyType: PrimaryKey
          responses:
            "200":
              body:
                installedVersion: 4.0.5
                lastStableVersion: 4.0.6
                primaryEndpointKey: 73e88a14-694a-44d5-883b-184a68aa8530
                secondaryEndpointKey: b2c98c16-ca31-4294-8626-6c57454a5063
              headers: {}
  /knowledgebases:
    get:
      operationId: Knowledgebase_ListAll
      parameters: []
      responses:
        "200":
          description: Collection of knowledgebases.
          schema:
            $ref: "#/definitions/KnowledgebasesDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Gets all knowledgebases for a user.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
          responses:
            "200":
              body:
                knowledgebases:
                  - hostName: https://myqnamakerbot.azurewebsites.net
                    id: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
                    lastAccessedTimestamp: 2018-03-16T10:59:46Z
                    lastChangedTimestamp: 2018-03-16T10:58:10Z
                    lastPublishedTimestamp: 2018-03-16T10:59:56Z
                    name: My QnA Maker Bot
                    sources:
                      - Custom Editorial
                      - SurfaceManual.pdf
                    urls:
                      - https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                      - https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                    userId: 03a4f4ce-30a6-4ec6-b436-02bcdf6153e1
              headers: {}
  /knowledgebases/create:
    post:
      operationId: Knowledgebase_Create
      parameters:
        - $ref: "#/parameters/CreateKbPayload"
      responses:
        "202":
          description: Details of the asynchronous operation.
          schema:
            $ref: "#/definitions/Operation"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Asynchronous operation to create a new knowledgebase.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            createKbPayload:
              files:
                - fileName: SurfaceManual.pdf
                  fileUri: https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf
              name: QnA Maker FAQ
              qnaList:
                - answer: "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle"
                  id: 0
                  metadata: []
                  questions:
                    - How can I change the default message from QnA Maker?
                  source: Custom Editorial
                - answer: "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create"
                  context:
                    isContextOnly: false
                    prompts:
                      - displayOrder: 1
                        displayText: Update KB
                        qna:
                          answer: "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update"
                          context:
                            isContextOnly: false
                            prompts:
                              - displayOrder: 1
                                displayText: Refresh Endpoint Keys
                                qna:
                                  answer: "You can use our REST apis to refresh endpoint keys. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/endpointkeys/refreshkeys"
                                  questions:
                                    - How do I programmatically refresh endpoint keys?
                          metadata:
                            - name: category
                              value: api
                          questions:
                            - How do I programmatically update my KB?
                  id: 0
                  metadata:
                    - name: category
                      value: api
                  questions:
                    - How do I programmatically create a KB?
                  source: Custom Editorial
              urls:
                - https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                - https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
          responses:
            "202":
              body:
                createdTimestamp: 2018-03-19T07:38:46Z
                lastActionTimestamp: 2018-03-19T07:39:29Z
                operationId: 03a4f4ce-30a6-4ec6-b436-02bcdf6153e1
                operationState: NotStarted
                userId: 86bb8390-56c0-42c2-9f81-3de161981191
              headers: {}
  "/knowledgebases/{kbId}":
    delete:
      operationId: Knowledgebase_Delete
      parameters:
        - $ref: "#/parameters/KbId"
      responses:
        "204":
          description: HTTP 204 No content.
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Deletes the knowledgebase and all its data.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            kbId: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
          responses:
            "204": {}
    get:
      operationId: Knowledgebase_GetDetails
      parameters:
        - $ref: "#/parameters/KbId"
      responses:
        "200":
          description: Details of the knowledgebase.
          schema:
            $ref: "#/definitions/KnowledgebaseDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Gets details of a specific knowledgebase.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            kbId: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
          responses:
            "200":
              body:
                hostName: https://myqnamakerbot.azurewebsites.net
                id: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
                lastAccessedTimestamp: 2018-03-16T10:59:46Z
                lastChangedTimestamp: 2018-03-16T10:58:10Z
                lastPublishedTimestamp: 2018-03-16T10:59:56Z
                name: My QnA Maker Bot
                sources:
                  - Custom Editorial
                  - SurfaceManual.pdf
                urls:
                  - https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                userId: 03a4f4ce-30a6-4ec6-b436-02bcdf6153e1
              headers: {}
    patch:
      operationId: Knowledgebase_Update
      parameters:
        - $ref: "#/parameters/KbId"
        - $ref: "#/parameters/UpdateKb"
      responses:
        "202":
          description: Details of the asynchronous operation.
          headers:
            Location:
              description: Relative URI to the target location of the asynchronous operation. Client should poll this resource to get status of the operation.
              type: string
          schema:
            $ref: "#/definitions/Operation"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Asynchronous operation to modify a knowledgebase.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            kbId: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
            updateKb:
              add:
                files:
                  - fileName: SurfaceManual.pdf
                    fileUri: https://download.microsoft.com/download/2/9/B/29B20383-302C-4517-A006-B0186F04BE28/surface-pro-4-user-guide-EN.pdf
                qnaList:
                  - answer: "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle"
                    id: 0
                    metadata: []
                    questions:
                      - How can I change the default message from QnA Maker?
                    source: Custom Editorial
                urls:
                  - https://docs.microsoft.com/en-us/azure/cognitive-services/Emotion/FAQ
              delete:
                ids:
                  - 13
                  - 35
              update:
                name: QnA Maker FAQ Prompts Bot
                qnaList:
                  - alternateQuestionClusters:
                      delete: []
                    answer: "You can use our REST apis to create a KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/create"
                    context:
                      isContextOnly: false
                      promptsToAdd:
                        - displayOrder: 0
                          displayText: Add Prompts
                          qna:
                            alternateQuestionClusters: []
                            answer: Click here to know more https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation
                            context:
                              isContextOnly: false
                              prompts: []
                            id: 0
                            metadata: []
                            questions:
                              - How can I add prompts?
                            source: Editorial
                          qnaId: 0
                        - displayOrder: 0
                          displayText: Delete Prompts
                          qna:
                            alternateQuestionClusters: []
                            answer: Click here to know more https://docs.microsoft.com/en-us/azure/cognitive-services/qnamaker/how-to/multiturn-conversation
                            context:
                              isContextOnly: false
                              prompts: []
                            id: 0
                            metadata: []
                            questions:
                              - How can I delete delete prompts?
                            source: Editorial
                          qnaId: 0
                        - displayOrder: 0
                          displayText: Update Knowledgebase
                          qna: null
                          qnaId: 3
                      promptsToDelete:
                        - 3
                    id: 2
                    metadata:
                      add: []
                      delete: []
                    questions:
                      add: []
                      delete: []
                    source: Custom Editorial
                  - alternateQuestionClusters:
                      delete: []
                    answer: "You can use our REST apis to update your KB. See here for details: https://docs.microsoft.com/en-us/rest/api/cognitiveservices/qnamaker/knowledgebase/update"
                    context:
                      isContextOnly: false
                      promptsToAdd:
                        - displayOrder: 1
                          displayText: Regenerate Endpoint keys
                          qna: null
                          qnaId: 4
                      promptsToDelete:
                        - 4
                    id: 3
                    metadata:
                      add:
                        - name: category
                          value: programmatic
                      delete:
                        - name: category
                          value: api
                    questions:
                      add: []
                      delete: []
                    source: Custom Editorial
          responses:
            "202":
              body:
                createdTimestamp: 2018-03-19T07:38:46Z
                lastActionTimestamp: 2018-03-19T07:39:29Z
                operationId: 03a4f4ce-30a6-4ec6-b436-02bcdf6153e1
                operationState: NotStarted
                userId: 86bb8390-56c0-42c2-9f81-3de161981191
              headers: {}
    post:
      operationId: Knowledgebase_Publish
      parameters:
        - $ref: "#/parameters/KbId"
      responses:
        "204":
          description: HTTP 204 No content.
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Publishes all changes in test index of a knowledgebase to its prod index.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            kbId: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
          responses:
            "204": {}
    put:
      operationId: Knowledgebase_Replace
      parameters:
        - $ref: "#/parameters/KbId"
        - $ref: "#/parameters/ReplaceKb"
      responses:
        "204":
          description: HTTP 204 No content.
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Replace knowledgebase contents.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            kbId: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
            replaceKb:
              qnAList:
                - answer: string
                  id: 0
                  metadata:
                    - name: string
                      value: string
                  questions:
                    - string
                  source: string
          responses:
            "204": {}
  "/knowledgebases/{kbId}/{environment}/qna":
    get:
      operationId: Knowledgebase_Download
      parameters:
        - $ref: "#/parameters/KbId"
        - $ref: "#/parameters/Environment"
      responses:
        "200":
          description: Collection of all Q-A in the knowledgebase.
          schema:
            $ref: "#/definitions/QnADocumentsDTO"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Download the knowledgebase.
      tags:
        - Knowledgebases
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            environment: Test
            kbId: 9d091697-fb8c-4ed5-9ac0-35bf8273bfff
          responses:
            "200":
              body:
                qnaDocuments:
                  - answer: "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle"
                    id: 1
                    metadata: []
                    questions:
                      - How can I change the default message from QnA Maker?
                    source: Custom Editorial
                  - answer: "You can use our REST apis to manage your KB. See here for details: https://westus.dev.cognitive.microsoft.com/docs/services/58994a073d9e04097c7ba6fe/operations/58994a073d9e041ad42d9baa"
                    id: 2
                    metadata:
                      - name: category
                        value: api
                    questions:
                      - How do I programmatically update my KB?
                    source: Custom Editorial
                  - answer: QnA Maker provides an FAQ data source that you can query from your bot or application. Although developers will find this useful, content owners will especially benefit from this tool. QnA Maker is a completely no-code way of managing the content that powers your bot or application.
                    id: 3
                    metadata: []
                    questions:
                      - Who is the target audience for the QnA Maker tool?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <p>You can sign in with your <a href="https://account.microsoft.com/account" data-linktype="external">Microsoft account</a></p>
                    id: 4
                    metadata: []
                    questions:
                      - How do I sign in to the QnA Maker portal?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <p>Yes, currently the QnA Maker tool is free to use. However, usage is metered for each account. For more information, see <a href="https://qnamaker.ai/Documentation/Authentication" data-linktype="external">Authentication and subscription keys</a></p>
                    id: 5
                    metadata: []
                    questions:
                      - Is the QnA Maker Service free?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: It’s possible that the tool can't auto-extract some question-and-answer (QnA) content from valid FAQ URLs. In such cases, you can paste the QnA content in a .txt file and see if the tool can ingest it. Alternately, you can editorially add content to your knowledge base.
                    id: 6
                    metadata: []
                    questions:
                      - My URLs have valid FAQ content, but the tool cannot extract them. Why not?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: '<main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>The tool supports the following file formats for ingestion:</p><ul><li>.tsv: QnA contained in the format Question(tab)Answer.</li><li>.txt, .docx, .pdf: QnA contained as regular FAQ content--that is, a sequence of questions and answers.</li></ul></main>'
                    id: 7
                    metadata: []
                    questions:
                      - What format does the tool expect for the file content?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>No, you don’t. However, QnA Maker is offered as one of several templates in <a href="https://azure.microsoft.com/services/bot-service/" data-linktype="external">Azure Bot Service</a>. Bot Service enables rapid intelligent bot development through Microsoft Bot Framework, and it runs in a serverless environment. </p><p>Bots scale based on demand. You pay for only the resources that you consume.</p></main>
                    id: 8
                    metadata: []
                    questions:
                      - Do I need to use Bot Framework in order to use QnA Maker?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>QnAMaker provides a REST endpoint that you can call from any bot code. However, if you'd like a quick way to set up a QnAMaker bot, you can use the <a href="https://docs.microsoft.com/bot-framework/bot-service-overview-introduction" data-linktype="external">Azure Bot Service</a>. Follow the instructions <a href="https://docs.microsoft.com/bot-framework/bot-service-quickstart" data-linktype="external">here</a> and choose the "Question and Answer" bot template. Once the bot is created, you will need to do the following steps to complete setup.</p><ol><li>In Azure portal, open the newly created Web App Bot resource.</li><li>Click on "Application Settings" and in the App Settings list, add QnASubscriptionKey and QnAKnowledgebaseId. The corresponding values can be obtained from the KB Settings page in <a href="http://qnamaker.ai/" data-linktype="external">http://qnamaker.ai</a>.</li><li>The QnAMaker-enabled Azure bot service app is now ready to use. To try it out click on "Test in Web Chat" to chat with your QnA bot.</li></ol></main>
                    id: 9
                    metadata: []
                    questions:
                      - How can I create a bot with QnAMaker?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>Follow these steps to embed the QnA Maker service as a web-chat control in your website:</p><ol><li>Create your knowledge base from the <a href="https://qnamaker.ai/" data-linktype="external">QnA Maker webpage</a>.</li><li>Create your bot as shown in <a href="https://docs.botframework.com/en-us/azure-bots/build/first-bot/#navtitle" data-linktype="external">Create a bot with the Azure Bot Service</a>. </li><li>Look for the Question and Answer bot template.</li><li>Enable the bot on the Web Chat channel. Get the embed keys.</li><li>Embed the web chat as shown in <a href="https://docs.botframework.com/en-us/support/embed-chat-control2/#navtitle" data-linktype="external">Connect a bot to Web Chat</a>.</li></ol></main>
                    id: 10
                    metadata: []
                    questions:
                      - How do I embed the QnA Maker service in my website?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: Currently, the QnA Maker tool handles semi-structured FAQ content and certain types of product manuals. Eventually, the vision is to be able to answer questions from unstructured content as well.
                    id: 11
                    metadata: []
                    questions:
                      - What is the roadmap of QnA Maker?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: Currently, the limit is a 20-MB knowledge base.
                    id: 12
                    metadata: []
                    questions:
                      - How large a knowledge base can I create?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: Every edit operation, whether in a table update, test, or settings, needs to be saved before it can be published. Be sure to select the Save and retrain button after every edit operation.
                    id: 13
                    metadata: []
                    questions:
                      - The updates that I made to my knowledge base are not reflected on publish. Why not?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: The upload feature expects the file to be formatted as tab-separated columns of question, answer, and source.
                    id: 14
                    metadata: []
                    questions:
                      - Why can’t I replace my knowledge base with the upload feature?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: You should refresh your subscription keys if you suspect that they have been compromised. Any requests with your subscription key will count toward your quota.
                    id: 15
                    metadata: []
                    questions:
                      - When should I refresh my subscription keys?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: The QnA Maker tool stores all knowledge base content in Azure Storage. You need a combination of knowledge base ID and subscription key to access the knowledge base. The tool doesn't use knowledge base content for any other purpose.
                    id: 16
                    metadata: []
                    questions:
                      - How safe is the data in my knowledge base?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>The knowledge base supports Markdown. However, the auto-extraction from URLs has limited HTML-to-Markdown conversion capability. If you want to use full-fledged Markdown, you can modify your content directly in the table, or upload a knowledge base with the rich content.</p><p>Multimedia, such as images and videos, is not supported at this time.</p></main>
                    id: 17
                    metadata: []
                    questions:
                      - Does the knowledge base support rich data or multimedia?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>The QnA Maker tool ingests and matches data in UTF-16 encoding. Any language should work as is. But, we have extensively tested the relevance of the service for English only.</p><p>If you have content from multiple languages, be sure to create a separate service for each language.</p></main>
                    id: 18
                    metadata: []
                    questions:
                      - Does QnA Maker support non-English languages?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: The chat logs are tab-separated files, with the query and the frequency as the columns. Frequency is the number of times that the same query was seen. The file is sorted in descending order of frequency. Select questions from the downloaded file that you want to test, and then upload it to see what responses the system returned for them.
                    id: 19
                    metadata: []
                    questions:
                      - What is the format of the downloaded chat logs?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>The new service doesn't include the test URL. The reason is that all calls are metered, as part of Cognitive Services. Because the test URL exposed the subscription key and the knowledge base ID, it was a security risk. </p><p>However, it's still easy to share your knowledge base and use it in chats. Check out the Azure Bot Service template for the <a href="https://blog.botframework.com/2016/12/13/More-Ways-to-Make-Smart-Bots/" data-linktype="external">Question and Answer bot</a>. You can create the Question and Answer bot in Skype in a few clicks, and then share it with anyone.</p></main>
                    id: 20
                    metadata: []
                    questions:
                      - Where is the test web-chat URL from the old portal? How do I share my knowledge base with others now?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <p>Current transaction limits are 10 calls per minute and 10,000 calls per month. If you require higher limits, a free premium tier is available with limits of 1,000 calls per minute and 500,000 calls per month. To sign up for this option, fill in the <a href="https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR_yh9o_uvdhPnJy8sn_XBGRUMktKRFNYME1VUkVRRVkwV0hDWUNWMVVNRC4u" data-linktype="external">request form</a>. Note that these tiers are subject to change when the tool goes to general availability.</p>
                    id: 21
                    metadata: []
                    questions:
                      - How can I increase the transaction limits?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <p>If QnA Maker doesn't match any of the questions, it shows a default "Sorry, no match found" message. You can change this default message in the code-behind by using the <code>QnAMakerDialog</code> object. For more information, see <a href="https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle" data-linktype="external">Create a bot using the Question and Answer template</a>.</p>
                    id: 22
                    metadata: []
                    questions:
                      - How can I change the default message when no good match is found?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: The tool parses only public URLs and does not support authenticated data sources at this time. Alternately, you can download the file and use the file-upload option to extract questions and answers.
                    id: 23
                    metadata: []
                    questions:
                      - Why is my SharePoint link not getting extracted?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <p>There is no direct integration of LUIS with QnA Maker. But, in your bot code, you can use LUIS and QnA Maker together. <a href="https://github.com/Microsoft/BotBuilder-CognitiveServices/tree/master/Node/samples/QnAMaker/QnAWithLUIS" data-linktype="external">View a sample bot</a></p>
                    id: 24
                    metadata: []
                    questions:
                      - How can I integrate LUIS with QnA Maker?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: QnAMaker is currently in free Preview and does not have support SLAs. If you want to report an issue or provide feedback, you do so on UserVoice through the "Feedback" button in the top navigation bar.
                    id: 25
                    metadata: []
                    questions:
                      - How can I report issues or contact support for QnAMaker?
                    source: https://docs.microsoft.com/en-in/azure/cognitive-services/qnamaker/faqs
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>While the Conversation User Interface (CUI) is upon us, at this point few developers have the expertise and tools needed to create new conversational experiences or enable existing applications and services with a conversational interface their users can enjoy. We have created the Bot Framework to make it easier for developers to build and connect great bots to users, wherever they converse, including on Microsoft's premier channels.</p><h2 id="channels">Channels</h2></main>
                    id: 26
                    metadata: []
                    questions:
                      - Why did Microsoft develop the Bot Framework?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <p>We plan on making continuous improvements to the Bot Framework, including additional channels, but cannot provide a schedule at this time.If you would like a specific channel added to the framework, <a href="https://docs.microsoft.com/en-us/bot-framework/bot-service-resources-links-help" data-linktype="relative-path">let us know</a>.</p>
                    id: 27
                    metadata: []
                    questions:
                      - When will you add more conversation experiences to the Bot Framework?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <p>We have not provided a general mechanism for developers to add new channels to Bot Framework, but you can connect your bot to your app via the <a href="http://docs.botframework.com/en-us/restapi/directline/" data-linktype="external">Direct Line API</a>. If you are a developer of a communication channel and would like to work with us to enable your channel in the Bot Framework <a href="https://docs.microsoft.com/en-us/bot-framework/bot-service-resources-links-help" data-linktype="relative-path">we’d love to hear from you</a>.</p>
                    id: 28
                    metadata: []
                    questions:
                      - I have a communication channel I’d like to be configurable with Bot Framework. Can I work with Microsoft to do that?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>The Bot Framework is designed to build, connect, and deploy high quality, responsive, performant and scalable bots for Skype and many other channels. The SDK can be used to create text/sms, image, button and card-capable bots (which constitute the majority of bot interactions today across conversation experiences) as well as bot interactions which are Skype-specific such as rich audio and video experiences.</p><p>If you already have a great bot and would like to reach the Skype audience, your bot can easily be connected to Skype (or any supported channel) via the Bot Builder for REST API (provided it has an internet-accessible REST endpoint).</p><h2 id="security-and-privacy">Security and Privacy</h2></main>
                    id: 29
                    metadata: []
                    questions:
                      - If I want to create a bot for Skype, what tools and services should I use?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>Each bot is its own service, and developers of these services are required to provide Terms of Service and Privacy Statements per their Developer Code of Conduct. You can access this information from the bot’s card in the Bot Directory.</p><p>to provide the I/O service, the Bot Framework transmits your message and message content (including your ID), from the chat service you used to the bot.</p></main>
                    id: 30
                    metadata: []
                    questions:
                      - Do the bots registered with the Bot Framework collect personal information? If yes, how can I be sure the data is safe and secure? What about privacy?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: Users have a way to report a misbehaving bot via the bot’s contact card in the directory. Developers must abide by Microsoft terms of service to participate in the service.
                    id: 31
                    metadata: []
                    questions:
                      - How do you ban or remove bots from the service?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>You'll need to whitelist the following URLs in your corporate firewall:</p><ul><li>login.botframework.com (Bot authentication)</li><li>login.microsoftonline.com (Bot authentication)</li><li>westus.api.cognitive.microsoft.com (for Luis.ai NLP integration)</li><li>state.botframework.com (Bot state storage for prototyping)</li><li>cortanabfchanneleastus.azurewebsites.net (Cortana channel)</li><li>cortanabfchannelwestus.azurewebsites.net (Cortana Channel)</li><li>*.botFramework.com (channels)</li></ul><h2 id="rate-limiting">Rate limiting</h2></main>
                    id: 32
                    metadata: []
                    questions:
                      - Which specific URLs do I need to whitelist in my corporate firewall to access bot services?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: "The Bot Framework service must protect itself and its customers against abusive call patterns (e.g., denial of service attack), so that no single bot can adversely affect the performance of other bots. To achieve this kind of protection, we’ve added rate limits (also known as throttling) to all endpoints. By enforcing a rate limit, we can restrict the frequency with which a bot can make a specific call. For example: with rate limiting enabled, if a bot wanted to post a large number of activities, it would have to space them out over a time period. Please note that the purpose of rate-limiting is not to cap the total volume for a bot. It is designed to prevent abuse of the conversational infrastructure that does not follow human conversation patterns."
                    id: 33
                    metadata: []
                    questions:
                      - What is rate limiting?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: "It is unlikely you’ll experience rate limiting, even at high volume. Most rate limiting would only occur due to bulk sending of activities (from a bot or from a client), extreme load testing, or a bug. When a request is throttled, an HTTP 429 (Too Many Requests) response is returned along with a Retry-After header indicating the amount of time (in seconds) to wait before retrying the request would succeed. You can collect this information by enabling analytics for your bot via Azure Application Insights. Or, you can add code in your bot to log messages. "
                    id: 34
                    metadata: []
                    questions:
                      - How will I know if I’m impacted?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>It can happen if:</p><ul><li>a bot sends messages too frequently</li><li>a client of a bot sends messages too frequently</li><li>Direct Line clients request a new Web Socket too frequently</li></ul></main>
                    id: 35
                    metadata: []
                    questions:
                      - How does rate limiting occur?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>We’re continuously tuning the rate limits to make them as lenient as possible while at the same time protecting our service and our users. Because thresholds will occasionally change, we aren’t publishing the numbers at this time. If you are impacted by rate limiting, feel free to reach out to us at <a href="mailto://bf-reports@microsoft.com" data-linktype="external">bf-reports@microsoft.com</a>.</p><h2 id="related-services">Related Services</h2></main>
                    id: 36
                    metadata: []
                    questions:
                      - What are the rate limits?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <p>Both the Bot Framework and <a href="http://www.microsoft.com/cognitive" data-linktype="external">Cognitive Services</a> are new capabilities introduced at <a href="http://build.microsoft.com/" data-linktype="external">Microsoft Build 2016</a> that will also be integrated into Cortana Intelligence Suite at GA. Both these services are built from years of research and use in popular Microsoft products. These capabilities combined with ‘Cortana Intelligence’ enable every organization to take advantage of the power of data, the cloud and intelligence to build their own intelligent systems that unlock new opportunities, increase their speed of business and lead the industries in which they serve their customers.</p>
                    id: 37
                    metadata: []
                    questions:
                      - How does the Bot Framework relate to Cognitive Services?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>Cortana Intelligence is a fully managed Big Data, Advanced Analytics and Intelligence suite that transforms your data into intelligent action.It is a comprehensive suite that brings together technologies founded upon years of research and innovation throughout Microsoft (spanning advanced analytics, machine learning, big data storage and processing in the cloud) and:</p><ul><li>Allows you to collect, manage and store all your data that can seamlessly and cost effectively grow over time in a scalable and secure way.</li><li>Provides easy and actionable analytics powered by the cloud that allow you to predict, prescribe and automate decision making for the most demanding problems.</li><li>Enables intelligent systems through cognitive services and agents that allow you to see, hear, interpret and understand the world around you in more contextual and natural ways.</li></ul><p>With Cortana Intelligence, we hope to help our enterprise customers unlock new opportunities, increase their speed of business and be leaders in their industries.</p></main>
                    id: 38
                    metadata: []
                    questions:
                      - What is Cortana Intelligence?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
                  - answer: <main id="main" role="main" class="content" ms.cmpgrp="content" data-bi-name="content" lang="en-us" dir="ltr"><p>Direct Line is a REST API that allows you to add your bot into your service, mobile app, or webpage.</p><p>You can write a client for the Direct Line API in any language. Simply code to the <a href="http://docs.botframework.com/en-us/restapi/directline/" data-linktype="external">Direct Line protocol</a>, generate a secret in the Direct Line configuration page, and talk to your bot from wherever your code lives.</p><p>Direct Line is suitable for:</p><ul><li>Mobile apps on iOS, Android, and Windows Phone, and others</li><li>Desktop applications on Windows, OSX, and more</li><li>Webpages where you need more customization than the <a href="https://docs.microsoft.com/en-us/bot-framework/bot-service-channel-connect-webchat" data-linktype="relative-path">embeddable Web Chat channel</a> offers</li><li>Service-to-service applications</li></ul></main>
                    id: 39
                    metadata: []
                    questions:
                      - What is the Direct Line channel?
                    source: https://docs.microsoft.com/en-us/bot-framework/resources-bot-framework-faq
              headers: {}
  "/operations/{operationId}":
    get:
      operationId: Operations_GetDetails
      parameters:
        - $ref: "#/parameters/OperationId"
      responses:
        "200":
          description: Details of the long running operation.
          headers:
            RetryAfter:
              description: Indicates how long the client should wait before sending a follow up request. The header will be present only if the operation is running or has not started yet.
              type: integer
          schema:
            $ref: "#/definitions/Operation"
          x-nullable: true
        default:
          description: Error response.
          schema:
            $ref: "#/definitions/ErrorResponse"
      summary: Gets details of a specific long running operation.
      tags:
        - Operations
      x-ms-examples:
        Successful query:
          parameters:
            Content-Type: application/json
            Endpoint: "{Endpoint}"
            Ocp-Apim-Subscription-Key: "{API key}"
            operationId: 03a4f4ce-30a6-4ec6-b436-02bcdf6153e1
          responses:
            "200":
              body:
                createdTimestamp: 2018-03-19T07:38:46Z
                lastActionTimestamp: 2018-03-19T07:39:29Z
                operationId: 03a4f4ce-30a6-4ec6-b436-02bcdf6153e1
                operationState: Succeeded
                resourceLocation: https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/9d091697-fb8c-4ed5-9ac0-35bf8273bfff
                userId: 86bb8390-56c0-42c2-9f81-3de161981191
              headers: {}
definitions:
  ActiveLearningSettingsDTO:
    additionalProperties: false
    description: Active Learning settings of the endpoint.
    properties:
      enable:
        description: True/False string providing Active Learning
        type: string
    type: object
  AlterationsDTO:
    additionalProperties: false
    description: Collection of words that are synonyms.
    properties:
      alterations:
        description: Words that are synonymous with each other.
        items:
          type: string
        maxLength: 20
        minLength: 1
        type: array
    required:
      - alterations
    type: object
  ContextDTO:
    description: Context associated with Qna.
    properties:
      isContextOnly:
        description: |-
          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
        type: boolean
      prompts:
        description: List of prompts associated with the answer.
        items:
          $ref: "#/definitions/PromptDTO"
        maxItems: 20
        type: array
    type: object
  CreateKbDTO:
    additionalProperties: false
    description: Post body schema for CreateKb operation.
    properties:
      defaultAnswerUsedForExtraction:
        description: 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.
        maxLength: 300
        minLength: 1
        type: string
      enableHierarchicalExtraction:
        description: Enable hierarchical extraction of Q-A from files and urls. Value to be considered False if this field is not present.
        type: boolean
      files:
        description: List of files from which to Extract Q-A.
        items:
          $ref: "#/definitions/FileDTO"
        maxLength: 10
        type: array
      language:
        description: Language of the knowledgebase.
        maxLength: 100
        minLength: 1
        type: string
      name:
        description: Friendly name for the knowledgebase.
        maxLength: 100
        minLength: 1
        type: string
      qnaList:
        description: List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted.
        items:
          $ref: "#/definitions/QnADTO"
        maxLength: 1000
        type: array
      urls:
        description: List of URLs to be used for extracting Q-A.
        items:
          type: string
        maxLength: 10
        type: array
    required:
      - name
    type: object
  CreateKbInputDTO:
    additionalProperties: false
    description: Input to create KB.
    properties:
      files:
        description: List of files to be added to knowledgebase.
        items:
          $ref: "#/definitions/FileDTO"
        maxLength: 10
        type: array
      qnaList:
        description: List of QNA to be added to the index. Ids are generated by the service and should be omitted.
        items:
          $ref: "#/definitions/QnADTO"
        type: array
      urls:
        description: List of URLs to be added to knowledgebase.
        items:
          type: string
        maxLength: 10
        type: array
    type: object
  DeleteKbContentsDTO:
    additionalProperties: false
    description: PATCH body schema of Delete Operation in UpdateKb
    properties:
      ids:
        description: List of Qna Ids to be deleted
        items:
          format: int32
          type: integer
        type: array
      sources:
        description: List of sources to be deleted from knowledgebase.
        items:
          type: string
        maxLength: 300
        minLength: 1
        type: array
    type: object
  EndpointKeysDTO:
    additionalProperties: false
    description: Schema for EndpointKeys generate/refresh operations.
    properties:
      installedVersion:
        description: Current version of runtime.
        type: string
      language:
        description: Language setting of runtime.
        type: string
      lastStableVersion:
        description: Latest version of runtime.
        type: string
      primaryEndpointKey:
        description: Primary Access Key.
        type: string
      secondaryEndpointKey:
        description: Secondary Access Key.
        type: string
    type: object
  EndpointSettingsDTO:
    additionalProperties: false
    description: Endpoint settings.
    properties:
      activeLearning:
        allOf:
          - $ref: "#/definitions/ActiveLearningSettingsDTO"
        description: Active Learning settings of the endpoint.
    type: object
  Error:
    additionalProperties: false
    description: The error object. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
    properties:
      code:
        $ref: "#/definitions/ErrorCode"
        description: One of a server-defined set of error codes.
      details:
        description: An array of details about specific errors that led to this reported error.
        items:
          $ref: "#/definitions/Error"
        type: array
      innerError:
        $ref: "#/definitions/InnerErrorModel"
        description: An object containing more specific information than the current object about the error.
      message:
        description: A human-readable representation of the error.
        type: string
      target:
        description: The target of the error.
        type: string
    required:
      - code
    type: object
  ErrorCode:
    description: Human readable error code.
    enum:
      - BadArgument
      - Forbidden
      - NotFound
      - KbNotFound
      - Unauthorized
      - Unspecified
      - EndpointKeysError
      - QuotaExceeded
      - QnaRuntimeError
      - SKULimitExceeded
      - OperationNotFound
      - ServiceError
      - ValidationFailure
      - ExtractionFailure
    type: string
    x-ms-enum:
      modelAsString: true
      name: ErrorCodeType
  ErrorResponse:
    additionalProperties: false
    description: Error response. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.
    properties:
      error:
        allOf:
          - $ref: "#/definitions/Error"
        description: The error object.
    type: object
  FileDTO:
    additionalProperties: false
    description: DTO to hold details of uploaded files.
    properties:
      fileName:
        description: File name. Supported file types are ".tsv", ".pdf", ".txt", ".docx", ".xlsx".
        maxLength: 200
        minLength: 1
        type: string
      fileUri:
        description: Public URI of the file.
        type: string
    required:
      - fileName
      - fileUri
    type: object
  InnerErrorModel:
    additionalProperties: false
    description: 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.
    properties:
      code:
        description: A more specific error code than was provided by the containing error.
        type: string
      innerError:
        $ref: "#/definitions/InnerErrorModel"
        description: An object containing more specific information than the current object about the error.
    type: object
  KnowledgebaseDTO:
    additionalProperties: false
    description: Response schema for CreateKb operation.
    properties:
      hostName:
        description: URL host name at which the knowledgebase is hosted.
        type: string
      id:
        description: Unique id that identifies a knowledgebase.
        type: string
      lastAccessedTimestamp:
        description: Time stamp at which the knowledgebase was last accessed (UTC).
        type: string
      lastChangedTimestamp:
        description: Time stamp at which the knowledgebase was last modified (UTC).
        type: string
      lastPublishedTimestamp:
        description: Time stamp at which the knowledgebase was last published (UTC).
        type: string
      name:
        description: Friendly name of the knowledgebase.
        type: string
      sources:
        description: Custom sources from which Q-A were extracted or explicitly added to the knowledgebase.
        items:
          type: string
        type: array
      urls:
        description: URL sources from which Q-A were extracted and added to the knowledgebase.
        items:
          type: string
        type: array
      userId:
        description: User who created / owns the knowledgebase.
        type: string
    type: object
  KnowledgebasesDTO:
    additionalProperties: false
    description: Collection of knowledgebases owned by a user.
    properties:
      knowledgebases:
        description: Collection of knowledgebase records.
        items:
          $ref: "#/definitions/KnowledgebaseDTO"
        type: array
    type: object
  MetadataDTO:
    additionalProperties: false
    description: Name - value pair of metadata.
    properties:
      name:
        description: Metadata name.
        maxLength: 100
        minLength: 1
        type: string
      value:
        description: Metadata value.
        maxLength: 500
        minLength: 1
        type: string
    required:
      - name
      - value
    type: object
  Operation:
    additionalProperties: false
    description: Record to track long running operation.
    properties:
      createdTimestamp:
        description: Timestamp when the operation was created.
        type: string
      errorResponse:
        $ref: "#/definitions/ErrorResponse"
        description: Error details in case of failures.
      lastActionTimestamp:
        description: Timestamp when the current state was entered.
        type: string
      operationId:
        description: Operation Id.
        type: string
      operationState:
        $ref: "#/definitions/OperationState"
        description: Operation state.
      resourceLocation:
        description: Relative URI to the target resource location for completed resources.
        type: string
      userId:
        description: User Id
        type: string
    type: object
  OperationState:
    description: Enumeration of operation states.
    enum:
      - Failed
      - NotStarted
      - Running
      - Succeeded
    type: string
    x-ms-enum:
      modelAsString: true
      name: OperationStateType
  PromptDTO:
    description: Prompt for an answer.
    properties:
      displayOrder:
        description: Index of the prompt - used in ordering of the prompts
        format: int32
        type: integer
      displayText:
        description: Text displayed to represent a follow up question prompt
        maxLength: 200
        type: string
      qna:
        allOf:
          - $ref: "#/definitions/QnADTO"
        description: QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO object
      qnaId:
        description: Qna id corresponding to the prompt - if QnaId is present, QnADTO object is ignored.
        format: int32
        type: integer
    type: object
  QnADTO:
    additionalProperties: false
    description: Q-A object.
    properties:
      answer:
        description: Answer text
        maxLength: 25000
        minLength: 1
        type: string
      context:
        allOf:
          - $ref: "#/definitions/ContextDTO"
        description: Context of a QnA
      id:
        description: Unique id for the Q-A.
        format: int32
        type: integer
      metadata:
        description: List of metadata associated with the answer.
        items:
          $ref: "#/definitions/MetadataDTO"
        maxLength: 10
        type: array
      questions:
        description: List of questions associated with the answer.
        items:
          type: string
        maxLength: 100
        minLength: 1
        type: array
      source:
        description: Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
        maxLength: 300
        type: string
    required:
      - answer
      - questions
    type: object
  QnADocumentsDTO:
    additionalProperties: false
    description: List of QnADTO
    properties:
      qnaDocuments:
        description: List of answers.
        items:
          $ref: "#/definitions/QnADTO"
        type: array
    type: object
  ReplaceKbDTO:
    additionalProperties: false
    description: Post body schema for Replace KB operation.
    properties:
      qnAList:
        description: List of Q-A (QnADTO) to be added to the knowledgebase. Q-A Ids are assigned by the service and should be omitted.
        items:
          $ref: "#/definitions/QnADTO"
        type: array
    required:
      - qnAList
    type: object
  UpdateContextDTO:
    description: Update Body schema to represent context to be updated
    properties:
      isContextOnly:
        description: |-
          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
        type: boolean
      promptsToAdd:
        description: List of prompts to be added to the qna.
        items:
          $ref: "#/definitions/PromptDTO"
        type: array
      promptsToDelete:
        description: List of prompts associated with qna to be deleted
        items:
          format: int32
          type: integer
        type: array
    type: object
  UpdateKbContentsDTO:
    additionalProperties: false
    description: PATCH body schema for Update operation in Update Kb
    properties:
      name:
        description: Friendly name for the knowledgebase.
        type: string
      qnaList:
        description: List of Q-A (UpdateQnaDTO) to be added to the knowledgebase.
        items:
          $ref: "#/definitions/UpdateQnaDTO"
        type: array
      urls:
        description: List of existing URLs to be refreshed. The content will be extracted again and re-indexed.
        items:
          type: string
        maxLength: 10
        type: array
    type: object
  UpdateKbOperationDTO:
    additionalProperties: false
    description: Contains list of QnAs to be updated
    properties:
      add:
        allOf:
          - $ref: "#/definitions/CreateKbInputDTO"
        description: An instance of CreateKbInputDTO for add operation
      defaultAnswerUsedForExtraction:
        description: 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.
        maxLength: 300
        minLength: 1
        type: string
      delete:
        allOf:
          - $ref: "#/definitions/DeleteKbContentsDTO"
        description: An instance of DeleteKbContentsDTO for delete Operation
      enableHierarchicalExtraction:
        description: 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.
        type: boolean
      update:
        allOf:
          - $ref: "#/definitions/UpdateKbContentsDTO"
        description: An instance of UpdateKbContentsDTO for Update Operation
    type: object
  UpdateMetadataDTO:
    additionalProperties: false
    description: PATCH Body schema to represent list of Metadata to be updated
    properties:
      add:
        description: List of metadata associated with answer to be added
        items:
          $ref: "#/definitions/MetadataDTO"
        maxLength: 100
        type: array
      delete:
        description: List of Metadata associated with answer to be deleted
        items:
          $ref: "#/definitions/MetadataDTO"
        maxLength: 100
        type: array
    type: object
  UpdateQnaDTO:
    additionalProperties: false
    description: PATCH Body schema for Update Qna List
    properties:
      answer:
        description: Answer text
        type: string
      context:
        allOf:
          - $ref: "#/definitions/UpdateContextDTO"
        description: Context associated with Qna to be updated.
      id:
        description: Unique id for the Q-A
        format: int32
        maximum: 2147483647
        minimum: 0
        type: integer
      metadata:
        allOf:
          - $ref: "#/definitions/UpdateMetadataDTO"
        description: List of metadata associated with the answer to be updated
      questions:
        allOf:
          - $ref: "#/definitions/UpdateQuestionsDTO"
        description: List of questions associated with the answer.
      source:
        description: Source from which Q-A was indexed. eg. https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs
        maxLength: 300
        type: string
    type: object
  UpdateQuestionsDTO:
    additionalProperties: false
    description: PATCH Body schema for Update Kb which contains list of questions to be added and deleted
    properties:
      add:
        description: List of questions to be added
        items:
          type: string
        maxLength: 100
        type: array
      delete:
        description: List of questions to be deleted.
        items:
          type: string
        maxLength: 100
        type: array
    type: object
  WordAlterationsDTO:
    additionalProperties: false
    description: Collection of word alterations.
    properties:
      wordAlterations:
        description: Collection of word alterations.
        items:
          $ref: "#/definitions/AlterationsDTO"
        maxLength: 10000
        type: array
    required:
      - wordAlterations
    type: object
x-ms-parameterized-host:
  hostTemplate: "{Endpoint}/qnamaker/v4.0"
  parameters:
    - $ref: "#/parameters/Endpoint"
  useSchemePrefix: false
