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

# Message list

> Get the saved messages of a session. The response is a list of AI SDK UI Messages.



## OpenAPI

````yaml /openapi/en/aitoearn.openapi.json get /api/agent/sessions/{sessionId}/messages
openapi: 3.0.1
info:
  title: AiToEarn Open Platform API
  description: >-
    AiToEarn Open Platform API. You can switch between the China and
    international sites for testing. Business success is determined by whether
    the response body has code === 0.
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: China site
  - url: https://aitoearn.ai
    description: International site
security: []
tags:
  - name: AI Services
  - name: AI Services/Video Generation
  - name: AI Services/Image Generation
  - name: Channel Management
  - name: Channel Management/Accounts
  - name: Channel Management/Publishing
  - name: Channel Management/Platforms
  - name: Channel Management/Works
  - name: Channel Management/Account Groups
  - name: Channel Management/Authorization
  - name: Asset Management
  - name: AI Services/Large Language Models
  - name: AI Services/Real-person Assets
  - name: AI Services/Agent
paths:
  /api/agent/sessions/{sessionId}/messages:
    get:
      tags:
        - AI Services/Agent
      summary: Message list
      description: >-
        Get the saved messages of a session. The response is a list of AI SDK UI
        Messages.
      operationId: AgentController_getSessionMessages
      parameters:
        - name: sessionId
          in: path
          required: true
          description: Session ID.
          schema:
            type: string
            description: Session ID.
      responses:
        '200':
          description: >-
            The request has been processed by the service. Business success is
            determined by whether the response body has code === 0.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Message ID.
                        sessionId:
                          type: string
                          description: Owning session ID.
                        runId:
                          type: string
                          description: Associated run ID.
                        stepNumber:
                          type: integer
                          description: Associated step number, starting at 0.
                        message:
                          type: object
                          description: AI SDK UI Message。
                          properties:
                            id:
                              type: string
                              description: UI message ID.
                            role:
                              type: string
                              enum:
                                - system
                                - user
                                - assistant
                              description: Message role.
                            parts:
                              type: array
                              description: Message parts. Fields vary by part type.
                              items:
                                type: object
                                additionalProperties: true
                          required:
                            - id
                            - role
                            - parts
                          additionalProperties: true
                        createdAt:
                          type: string
                          format: date-time
                          description: Created at.
                      required:
                        - id
                        - sessionId
                        - message
                        - createdAt
                      additionalProperties: false
                    description: Session message list.
                  code:
                    type: integer
                    description: >-
                      Business status code. 0 means success; non-zero means a
                      business error.
                  message:
                    type: string
                    description: Response message.
                  requestId:
                    type: string
                    description: Request ID.
                  timestamp:
                    type: integer
                    description: Error response timestamp in Unix milliseconds.
                required:
                  - code
                  - message
              examples:
                success:
                  summary: Success
                  value:
                    code: 0
                    message: Request succeeded
                    data:
                      - id: string
                        sessionId: string
                        message:
                          id: string
                          role: system
                          parts:
                            - {}
                        createdAt: '2026-07-02T12:00:00.000Z'
                        runId: string
                        stepNumber: 1
                validationFailed10002:
                  summary: ValidationFailed (10002)
                  value:
                    code: 10002
                    message: Parameter validation failed
                    data: {}
                    timestamp: 1772099056662
                unauthorized401:
                  summary: Unauthenticated or invalid API Key
                  value:
                    code: 401
                    message: Unauthorized
                    data: {}
                    timestamp: 1772099056662
                agentSessionNotFound18104:
                  summary: AgentSessionNotFound (18104)
                  value:
                    code: 18104
                    message: Agent session not found
                    data: {}
                    timestamp: 1772099056662
      security:
        - apikey-header-X-Api-Key: []
components:
  securitySchemes:
    apikey-header-X-Api-Key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Need to get API Key from AiToEarn. Click to go to ["API Key Obtaining
        Tutorial"](/en/use/api-key).

````