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

# Chat

> Answers a chat message based on information inside AODocs<br>



## OpenAPI

````yaml https://document-assistant.us.aodocs.app/openapi.json post /assistant/api/v1/tenants/{tenant}/chat
openapi: 3.1.0
info:
  title: Document Assistant API
  description: |
    <p>
      The Document Assistant API enables developers to integrate document-based assistant
      functionalities into their applications using AODocs.
    </p>
    <p>
      The first step is to enable AIDA (AODocs Intelligent Document Assistant) in your tenant.
      The support team will provide you with the necessary information on how to get started.
    </p>
    <p>
      The second step is to enable AIDA on libraries. You need to be an administrator of the
      library to do this.<br />
      AIDA can answer questions only from those documents that are in an AIDA enabled
      library.<br />
      We create a vector store index for these documents. This can take some time. The get
      library API provides the status of the indexation and an estimate of the time
      remaining.<br />
      The content of the index is automatically kept up-to-date near real time with the
      content changes.
    </p>
    <p>
      The third step is to ask questions based on the AODocs documents.<br />
      AIDA automatically filters the results based on the user's permissions.
    </p>
    <p>
      <strong>Authentication:</strong> All API endpoints require a valid OAuth2 token in the
      Authorization header. Ensure the client ID of the OAuth2 token is whitelisted in AODocs.
    </p>
  version: 1.1.0
servers:
  - url: https://document-assistant.us.aodocs.app
    description: Production US
  - url: https://document-assistant.eu.aodocs.app
    description: Production EU
security: []
paths:
  /assistant/api/v1/tenants/{tenant}/chat:
    post:
      tags:
        - chat
      summary: Chat
      description: Answers a chat message based on information inside AODocs<br>
      operationId: chat_assistant_api_v1_tenants__tenant__chat_post
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: The domain of the customer
            examples:
              - example.com
            title: Tenant
          description: The domain of the customer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SyncChatRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatResponse'
        '400':
          description: The request contains conflicting document filters
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: No answer was generated
      security:
        - HTTPBearer: []
components:
  schemas:
    SyncChatRequest:
      properties:
        message:
          type: string
          title: Message
          description: The message to be sent to the assistant
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
          description: The id of the agent to scope this chat request
        conversation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversation Id
          description: |-
            The conversation ID of the chat message.<br>
                        If not provided a new conversation will be created.
        library_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Library Id
          description: >-
            Use library_ids field, answer the question in the context of the
            library
          deprecated: true
        library_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Library Ids
          description: Answer the question in the context of these libraries
        document_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Id
          description: >-
            DEPRECATED: use document_ids field, answer the question in the
            context of the document
          deprecated: true
        document_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Document Ids
          description: Answer the question in the context of these documents
        view_id:
          anyOf:
            - type: string
            - type: 'null'
          title: View Id
          description: Answer the question in the context of the view
        filters:
          additionalProperties: true
          type: object
          title: Filters
          description: >-
            These filters limit which documents are considered as sources during
            the answer generation.
        timezone:
          type: integer
          title: Timezone
          description: >-
            Timezone of the user. If is not provided we use UTC timezone.<br> We
            use this information to accurately interpret time-related
            queries.<br> Format: offset from UTC, in minutes
          default: 0
        read_only:
          type: boolean
          title: Read Only
          description: Disable tools that can modify documents for this request
          default: false
        include_quotes:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Quotes
          description: Include quotes that the answer is based on in the response
          default: false
      type: object
      required:
        - message
      title: SyncChatRequest
    ChatResponse:
      properties:
        metadata:
          $ref: '#/components/schemas/ChatResponseMetadata'
        response:
          type: string
          title: Response
      type: object
      required:
        - metadata
        - response
      title: ChatResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChatResponseMetadata:
      properties:
        conversation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Conversation Id
          description: The conversation ID of the chat message
        message_id:
          type: string
          title: Message Id
          description: The message ID of the chat message
        response_id:
          type: string
          title: Response Id
          description: The response ID of the chat message
        sources:
          items:
            $ref: '#/components/schemas/Reference'
          type: array
          title: Sources
          description: Document information used to generate the response
          default: []
        links:
          items:
            $ref: '#/components/schemas/ChatLink'
          type: array
          title: Links
          description: Links to be displayed in the response
          default: []
      type: object
      required:
        - conversation_id
        - message_id
        - response_id
      title: ChatResponseMetadata
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Reference:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the reference
        library_id:
          type: string
          title: Library Id
          description: The library ID of the node
        document_id:
          type: string
          title: Document Id
          description: The document ID of the node
        document_title:
          type: string
          title: Document Title
          description: Title of document
        document_link:
          type: string
          title: Document Link
          description: Link to the document
        quoted_text:
          anyOf:
            - type: string
            - type: 'null'
          title: Quoted Text
          description: >-
            Quoted text from the document. A short excerpt that verifies
            verbatim against the source where the answering flow narrowed it —
            the default for content-search answers — and the full retrieved
            source chunk otherwise. quote_narrowed tells the two apart.
        attachment_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Attachment Id
          description: The attachment ID of the node
        attachment_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Attachment Name
          description: The attachment name of the node
        attachment_mime_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Attachment Mime Type
          description: The attachment mime type of the node
        attachment_link:
          anyOf:
            - type: string
            - type: 'null'
          title: Attachment Link
          description: The attachment link of the node
        location_info:
          anyOf:
            - type: string
            - type: 'null'
          title: Location Info
          description: Location of the quoted text on the document (optional
        location_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Location Type
          description: Type of the location of the quoted text
        revision_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Revision Id
          description: The revision ID of the attachment (optional)
        external_source_url:
          anyOf:
            - type: string
            - type: 'null'
          title: External Source Url
          description: URL of the external source
        external_source_title:
          anyOf:
            - type: string
            - type: 'null'
          title: External Source Title
          description: Display name of the external source
        quote_narrowed:
          type: boolean
          title: Quote Narrowed
          description: >-
            True when quoted_text has already been narrowed to a short, verified
            supporting quote (or nulled after failing verification) instead of
            holding the full raw retrieved chunk. Set only where that narrowing
            actually happens; callers deciding whether to strip quoted_text
            should check this field rather than the request's feature flags,
            since a flag being on doesn't mean the citation's own flow acted on
            it.
          default: false
        bounding_boxes_available:
          type: boolean
          title: Bounding Boxes Available
          description: >-
            Whether this citation can be submitted to the bounding-box lookup
            endpoint.
          readOnly: true
      type: object
      required:
        - id
        - library_id
        - document_id
        - document_title
        - document_link
        - bounding_boxes_available
      title: Reference
    ChatLink:
      properties:
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
      type: object
      required:
        - title
        - url
      title: ChatLink
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.