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

# Get Session Messages



## OpenAPI

````yaml https://api.gbase.ai/openapi-redoc.json get /v1/{ai_id}/session.messages
openapi: 3.1.0
info:
  title: GBase
  description: >
    # Introduce

    This API document can help you understand GBase more deeply. 

    You can train your own AI directly through the interface of this document.



    ##  Authentication


    Home page: [https://gbase.ai](https://gbase.ai)


    Huggingface:
    [https://huggingface.co/gptbase](https://huggingface.co/gptbase)


    The GBase API uses API keys for authentication. Visit your API Keys page to
    retrieve the API key you'll use in your requests.


    Remember that your API key is a secret! Do not share it with others or
    expose it in any client-side code (browsers, apps). 

    Production requests must be routed through your own backend server where
    your API key can be securely loaded from an environment variable or key
    management service.


    All API requests should include your API key in an Authorization HTTP header
    as follows:


    Parameter name: Authorization


    Value: Bearer [YOUR_API_KEY](https://admin.gbase.ai/keys)


    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    ## Use steps

    1.Fill in your API keys.


    2.You can create an AI by using either the API interface or the
    administrative backend. Once created, the AI will generate an ID which will
    be required for the subsequent steps.


    3.Use the generated ID to call the file upload interface.


    4.After uploading the file, you can use the question interface to inquire
    about it.
  version: 0.0.1
servers:
  - url: https://api.gbase.ai
security: []
paths:
  /v1/{ai_id}/session.messages:
    get:
      tags:
        - Question
      summary: Get Session Messages
      operationId: get_session_messages_v1__ai_id__session_messages_get
      parameters:
        - required: true
          schema:
            type: string
            title: Ai Id
          name: ai_id
          in: path
        - required: true
          schema:
            type: string
            title: Session Id
          name: session_id
          in: query
        - required: false
          schema:
            type: string
            format: date-time
            title: End Time
          name: end_time
          in: query
        - required: false
          schema:
            type: integer
            minimum: 1
            title: Page
            default: 1
          name: page
          in: query
        - required: false
          schema:
            type: integer
            maximum: 1000
            minimum: 1
            title: Size
            default: 50
          name: size
          in: query
        - required: false
          schema:
            type: string
            title: Order By
          name: order_by
          in: query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_SessionMessageExpandOut_'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - Auth0HTTPBearer: []
components:
  schemas:
    Page_SessionMessageExpandOut_:
      properties:
        items:
          items:
            $ref: '#/components/schemas/SessionMessageExpandOut'
          type: array
          title: Items
        total:
          type: integer
          minimum: 0
          title: Total
        page:
          type: integer
          minimum: 1
          title: Page
        size:
          type: integer
          minimum: 1
          title: Size
        pages:
          type: integer
          minimum: 0
          title: Pages
      type: object
      required:
        - items
        - total
        - page
        - size
      title: Page[SessionMessageExpandOut]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SessionMessageExpandOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created_at:
          type: string
          format: date-time
          title: Created At
          readOnly: true
        anonymous_username:
          type: string
          maxLength: 200
          title: Anonymous Username
          nullable: true
        question:
          type: string
          title: Question
        answer:
          type: string
          title: Answer
          nullable: true
        feedback_content:
          type: string
          title: Feedback Content
          nullable: true
        total_tokens:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: Total Tokens
        rating:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: Rating
          default: 0
          nullable: true
        reference_list:
          title: Reference List
        reference_indexes:
          title: Reference Indexes
        history_conversation_count:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: History Conversation Count
          nullable: true
        is_test:
          type: boolean
          title: Is Test
          default: false
        faq_id:
          type: string
          format: uuid
          title: Faq Id
          nullable: true
        comes_from:
          type: string
          maxLength: 100
          title: Comes From
          nullable: true
        first_response_time:
          type: integer
          maximum: 2147483647
          minimum: -2147483648
          title: First Response Time
          nullable: true
        llm_can_answer:
          type: boolean
          title: Llm Can Answer
          nullable: true
        title:
          type: string
          maxLength: 1024
          title: Title
          nullable: true
        url:
          type: string
          maxLength: 1024
          title: Url
          nullable: true
        model:
          type: string
          maxLength: 100
          title: Model
          description: >-
            LOCAL_MODEL: gbase-llama-33<br/>TEXT_EMBEDDING_ADA_002:
            text-embedding-ada-002<br/>TEXT_EMBEDDING_3_SMALL:
            text-embedding-3-small<br/>TEXT_EMBEDDING_3_LARGE:
            text-embedding-3-large<br/>BAAI_BGE_M3_MULTI:
            BAAI/bge-m3-multi<br/>GPT_4: gpt-4<br/>GPT_35_TURBO:
            gpt-3.5-turbo<br/>GPT_4_TURBO_PREVIEW:
            gpt-4-turbo-preview<br/>GPT_35_TURBO_1106:
            gpt-3.5-turbo-1106<br/>GPT_35_TURBO_16K:
            gpt-3.5-turbo-16k<br/>GPT_4_1106_PREVIEW:
            gpt-4-1106-preview<br/>GPT_4_TURBO:
            gpt-4-turbo<br/>GEMINI_25_PRO_EXP_0325:
            gemini-2.5-pro-exp-03-25<br/>GEMINI_25_PRO_PREVIEW_0506:
            gemini-2.5-pro-preview-05-06<br/>GEMINI_15_PRO_EXP_0801:
            gemini-1.5-pro-exp-0801<br/>GEMINI_20_PRO_EXP_0205:
            gemini-2.0-pro-exp-02-05<br/>GPT_4_OMNI:
            gpt-4o<br/>GPT_4_OMNI_2024_05_13:
            gpt-4o-2024-05-13<br/>GPT_4_OMNI_2024_08_06:
            gpt-4o-2024-08-06<br/>GPT_4_OMNI_2024_11_20:
            gpt-4o-2024-11-20<br/>GPT_4_OMNI_MINI: gpt-4o-mini<br/>GPT_4_1:
            gpt-4.1<br/>O3_MINI: o3-mini<br/>O3_MINI_THINKING:
            o3-mini-thinking<br/>GPT_4_1_MINI: gpt-4.1-mini<br/>GPT_4_1_NANO:
            gpt-4.1-nano<br/>GPT_5: gpt-5<br/>GPT_5_MINI:
            gpt-5-mini<br/>GPT_5_NANO: gpt-5-nano<br/>GEMINI_15_PRO:
            gemini-1.5-pro<br/>GEMINI_20_FLASH_EXP_IMAGE_GENERATION:
            gemini-2.0-flash-exp-image-generation<br/>GEMINI_20_FLASH:
            gemini-2.0-flash<br/>GEMINI_20_FLASH_001:
            gemini-2.0-flash-001<br/>GEMINI_25_FLASH_PREVIEW_0520:
            gemini-2.5-flash-preview-05-20<br/>GEMINI_25_FLASH:
            gemini-2.5-flash<br/>GEMINI_25_FLASH_LITE:
            gemini-2.5-flash-lite<br/>GEMINI_25_PRO:
            gemini-2.5-pro<br/>GEMINI_FLASH_LATEST:
            gemini-flash-latest<br/>CLAUDE_35_SONNET_20240620:
            claude-3-5-sonnet-20240620<br/>CLAUDE_35_SONNET_20241022:
            claude-3-5-sonnet-20241022<br/>CLAUDE_37_SONNET:
            claude-3-7-sonnet-20250219<br/>CLAUDE_37_SONNET_THINKING:
            claude-3-7-sonnet-thinking<br/>CLAUDE_SONNET_4:
            claude-sonnet-4-20250514<br/>CLAUDE_SONNET_4_5:
            claude-sonnet-4-5<br/>CLAUDE_OPUS_4_5:
            claude-opus-4-5<br/>CLAUDE_OPUS_4_6:
            claude-opus-4-6<br/>CLAUDE_HAIKU_4_5:
            claude-haiku-4-5<br/>CLAUDE_SONNET_4_5_1M:
            claude-sonnet-4-5-1m<br/>CLAUDE_SONNET_LATEST:
            claude-sonnet-latest<br/>CLAUDE_OPUS_LATEST:
            claude-opus-latest<br/>OPENROUTER_QWEN3_NEXT_80B_A3B_INSTRUCT:
            openrouter/qwen/qwen3-next-80b-a3b-instruct<br/>OPENROUTER_GPT_OSS_120B:
            openrouter/openai/gpt-oss-120b<br/>OPENROUTER_GLM_4_7: op
          nullable: true
        question_metadata:
          title: Question Metadata
        status:
          type: string
          maxLength: 100
          title: Status
          description: 'PENDING: pending<br/>FINISHED: finished'
          default: finished
        is_correct:
          type: boolean
          title: Is Correct
          default: false
          nullable: true
        transfer_to_human:
          type: boolean
          title: Transfer To Human
          default: false
        canvas:
          title: Canvas
        tags:
          items:
            $ref: '#/components/schemas/QuestionTagExportOut'
          type: array
          title: Tags
          default: []
        session_id:
          type: string
          maxLength: 100
          title: Session Id
        user_id:
          type: string
          maxLength: 100
          title: User Id
          nullable: true
        session_message_metadata:
          items: {}
          type: array
          title: Session Message Metadata
          default: []
        default_dataset_id:
          type: string
          title: Default Dataset Id
        citation:
          items: {}
          type: array
          title: Citation
      additionalProperties: false
      type: object
      required:
        - created_at
        - question
        - total_tokens
        - session_id
      title: SessionMessageOut
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    QuestionTagExportOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        group:
          $ref: '#/components/schemas/QuestionTagGroupExportOut'
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        deleted_at:
          type: string
          format: date-time
          title: Deleted At
      type: object
      required:
        - id
        - name
        - created_at
        - updated_at
      title: QuestionTagExportOut
      description: DTO for QuestionTag in exports, includes deleted_at for historical data
    QuestionTagGroupExportOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        deleted_at:
          type: string
          format: date-time
          title: Deleted At
      type: object
      required:
        - id
        - name
        - created_at
        - updated_at
      title: QuestionTagGroupExportOut
      description: >-
        DTO for QuestionTagGroup in exports, includes deleted_at for historical
        data

````