> ## Documentation Index
> Fetch the complete documentation index at: https://docs.irisagent.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get AI answer to any query


> Get an AI answer to any support query using the trained information such as knowledge articles, tickets, documentation, and more.




## OpenAPI

````yaml /api-reference/openapi.json post /v1/irisgpt/ask
openapi: 3.0.3
info:
  title: IrisAgent's API Reference
  description: >
    IrisAgent service can be used as an API to power intelligent conversations
    and search, index, and connect with your internal and external knowledge
    articles, tickets, community forums, product documentation,

    and other informational content.
  version: 1.2.0
servers:
  - url: https://api1.irisagent.com
security:
  - bearerAuth: []
paths:
  /v1/irisgpt/ask:
    post:
      summary: |
        Get AI answer to any query
      description: >
        Get an AI answer to any support query using the trained information such
        as knowledge articles, tickets, documentation, and more.
      operationId: irisgptAsk
      parameters:
        - $ref: '#/components/parameters/LanguageIsoCode'
        - $ref: '#/components/parameters/ChatIdentifier'
      requestBody:
        description: >
          The `requestBody` contains the information sent to IrisGPT for
          processing.

          The main component is the `query`, representing the user's input or
          question.

          This body must be sent in JSON format.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AskRequest'
      responses:
        '200':
          $ref: '#/components/responses/AskResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '408':
          $ref: '#/components/responses/408'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '504':
          $ref: '#/components/responses/504'
components:
  parameters:
    LanguageIsoCode:
      name: X-Language-Iso-Code
      in: header
      description: |
        This optional header allows you to specify the desired language.
        If not provided, automatic language detection will be used.
      schema:
        type: string
        format: iso-639-1
    ChatIdentifier:
      name: Chat-Identifier
      in: header
      description: >
        The `Chat-Identifier` is an optional header used to track the
        conversation session.

        If not provided, a new chat session will automatically be created.

        While not required for single request/response interactions, it is
        necessary for maintaining continuity in ongoing conversations.
      required: false
      schema:
        type: string
        format: uuid
  schemas:
    AskRequest:
      type: object
      properties:
        productId:
          description: >
            If you have multiple products and knowledge base segmented by
            products, you can provide the product ID here.
          type: string
        author:
          description: >
            The author of the query, which can be used for personalization or
            tracking purposes.
          type: string
          enum:
            - agent
            - customer
        query:
          description: |
            The user's query or question to be processed by IrisGPT.
            It is the core input for generating a response.
          type: string
          x-oapi-codegen-extra-tags:
            validate: required,gte=1
        voiceChannel:
          description: >
            Optional flag to indicate if the request is coming from a voice
            channel.

            When set to true, the response will not include source article links
            (links, linksTitle, and urls fields will be omitted).

            Defaults to false if not provided.
          type: boolean
          default: false
      required:
        - query
    AskResponseItem:
      description: >
        The `AskResponseItem` schema defines the structure of IrisGPT's
        response, including both the formatted and plain text versions of the
        answer, along with relevant links and URLs.
      type: object
      properties:
        responseType:
          $ref: '#/components/schemas/ResponseType'
        mdText:
          description: >
            The Markdown-formatted response from IrisGPT, including links and
            titles sourced from relevant articles.
          type: string
        intentTag:
          description: |
            The intent tag associated with the response, if applicable.
          type: string
          nullable: true
        procedure:
          description: >
            The name of the matched FAQ/procedure flow, if the response was
            generated by an FAQ match.
          type: string
          nullable: true
        escalate:
          description: >
            Whether this response is an escalation to a human agent, triggered
            by a FAQ procedure's [ESCALATE] marker.
          type: boolean
        htmltext:
          description: >
            The HTML-formatted response from IrisGPT, including links and titles
            sourced from relevant articles.
          type: string
        source:
          description: >
            The source of the response content, indicating where the information
            was obtained from.
          type: string
        plaintext:
          description: |
            A plain text version of IrisGPT's response, excluding any links.
          type: string
        linksTitle:
          description: >
            The title of the source articles, which can vary based on the
            request language.
          type: string
        links:
          description: >
            A list of objects containing URLs and their corresponding titles,
            representing articles referenced in the response.
          type: array
          items:
            $ref: '#/components/schemas/Link'
          nullable: true
          x-go-type-skip-optional-pointer: true
        urls:
          description: >
            A list of URLs corresponding to the source articles from which the
            response is derived.
          type: array
          items:
            type: string
          nullable: true
          x-go-type-skip-optional-pointer: true
        id:
          description: >-
            Unique identifier for the response, which can be used for tracking
            or reference.
          type: string
      required:
        - htmltext
        - mdText
        - plaintext
        - source
        - id
    Error:
      type: object
      properties:
        error:
          description: Error message
          type: string
        code:
          description: HTTP status code for the error
          type: integer
        status:
          description: Status text corresponding to the error
          type: string
      required:
        - error
        - code
        - status
    ResponseType:
      description: Indicates the type of response and how it was generated.
      type: string
      default: no-answer
      enum:
        - ai-answer-from-tickets
        - ai-answer-with-kb-links
        - ai-answer-from-incidents
        - generic
        - intent-flow
        - intent-tags
        - no-answer
      x-go-type-skip-optional-pointer: true
    Link:
      description: >
        The `Link` schema defines the structure for each link object included in
        IrisGPT's response.

        Each link consists of a title (or text) and its corresponding URL.
      type: object
      properties:
        text:
          description: |
            The title or descriptive text associated with the link.
          type: string
        url:
          description: |
            The URL of the source article or resource.
          type: string
          format: uri
      required:
        - text
        - url
  responses:
    '400':
      description: >-
        Bad Request - The server cannot process the request due to client error.
        This includes missing required fields, invalid data types, malformed
        JSON, or requests exceeding size limits.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '401':
      description: >-
        Unauthorized - Authentication is required and has failed or has not been
        provided. Your API key may be invalid or missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '408':
      description: >-
        Request Timeout - The server timed out waiting for the request to
        complete. The request may be retried.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '429':
      description: >-
        Too Many Requests - You have sent too many requests in a given amount of
        time.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: >-
        Internal Server Error - The server encountered an unexpected condition
        that prevented it from fulfilling the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '504':
      description: >-
        Gateway Timeout - The server, while acting as a gateway or proxy, did
        not receive a timely response from an upstream server.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    AskResponse:
      description: >
        The `AskResponse` represents the structure of the response returned by
        IrisGPT.

        It is formatted in JSON and contains the AI-generated answer to the
        user's query.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AskResponseItem'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |
        The `Authorization` header is required to authenticate API requests.
        It should contain a bearer token obtained through the IrisAgent portal.

````