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

# Get Session Messages



## OpenAPI

````yaml /api-v2.json get /sessions/{session_id}/messages
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services. Read the
    [docs](https://docs.meibel.ai) to learn how to use it.
  version: 0.6.4
servers:
  - url: https://api.meibel.ai/v2
    description: Meibel API (v2)
  - url: https://api.dev.meibel.ai/v2
    description: Meibel Dev API (v2)
  - url: http://localhost:8000/v2
    description: Local Development
security: []
tags:
  - name: Datasources
    description: v2 datasource management
  - name: Data Elements
    description: v2 data element CRUD and search
  - name: File Upload
    description: Upload files to a datasource and track upload progress
  - name: Ingest
    description: Trigger and monitor datasource ingestion
  - name: Datasource Downloads
    description: Export all datasource content as a zip archive
  - name: Table Descriptions
    description: v2 table and column descriptions
  - name: Metadata Model Catalog
    description: v2 metadata model catalog
  - name: Confidence Scoring
    description: v2 confidence scoring jobs and summaries
  - name: Documents
    description: Parse and transform documents into structured data
  - name: Agents
    description: Agent definition management
  - name: Sessions
    description: Agent session (execution) management and chat
  - name: Execution Policies
    description: Data access and tool usage constraints scoped to agent sessions
  - name: Artifact Schemas
    description: Agent artifact schema management
paths:
  /sessions/{session_id}/messages:
    get:
      tags:
        - Sessions
      summary: Get Session Messages
      operationId: getSessionMessages
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionMessagesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            import os
            from meibel import MeibelClient

            client = MeibelClient(api_key=os.environ["MEIBEL_API_KEY"])

            response = client.sessions.get_messages(
                session_id="sess_8f3a1c2d9e4b",
            )

            print(f"Agent: {response.agent_name} (v{response.version})")
            for msg in response.messages:
                print(f"[{msg.timestamp}] {msg.type}: {msg.message}")
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from "meibel";


            const client = new MeibelClient({ apiKey: process.env.MEIBEL_API_KEY
            });


            const sessionMessages = await
            client.sessions.getMessages("session_7f3a9c1b2d");


            console.log(`Agent: ${sessionMessages.agent_name}, version:
            ${sessionMessages.version}`);


            for (const item of sessionMessages.messages) {
              console.log(`[${item.timestamp}] ${item.type}: ${item.message}`);
            }
        - lang: Go
          label: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\tv2 \"github.com/meibel-ai/meibel-go/v2\"\n)\n\nfunc main() {\n\tclient := v2.NewClient(v2.WithAPIKey(os.Getenv(\"MEIBEL_API_KEY\")))\n\n\tresp, err := client.Sessions.GetMessages(context.Background(), \"session_abc123\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"Agent: %s (v%s)\\n\", *resp.AgentName, *resp.Version)\n\tfor _, msg := range resp.Messages {\n\t\tfmt.Printf(\"[%s] %s\\n\", msg.Type, *msg.Message)\n\t}\n}"
components:
  schemas:
    SessionMessagesResponse:
      properties:
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        version:
          anyOf:
            - type: string
            - type: 'null'
          title: Version
        messages:
          items:
            $ref: '#/components/schemas/SessionMessageItem'
          type: array
          title: Messages
      type: object
      required:
        - messages
      title: SessionMessagesResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SessionMessageItem:
      properties:
        type:
          type: string
          title: Type
        timestamp:
          anyOf:
            - type: string
            - type: 'null'
          title: Timestamp
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
        signal_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Signal Id
        tool_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Id
        tool_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Name
        arguments:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Arguments
        result:
          anyOf:
            - {}
            - type: 'null'
          title: Result
      type: object
      required:
        - type
      title: SessionMessageItem
    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
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````