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

# Get Task Messages

> Returns paginated events for a task. Use the nextCursor field to retrieve subsequent pages.



## OpenAPI

````yaml /openapi/public-api-endpoint-reference.yaml get /v1/ai/agents/tasks/{taskId}/messages
openapi: 3.1.0
info:
  title: Maia Public REST API
  version: '1.0'
servers:
  - description: EU1
    url: https://eu1.api.matillion.com/dpc
  - description: US1
    url: https://us1.api.matillion.com/dpc
security:
  - bearerAuth: []
tags:
  - description: Manage Schedules
    name: Schedules
  - description: Manage Connections
    name: Connections
  - description: Operations for managing Project Variables
    name: Project Variables
  - description: Manage Pipelines
    name: Pipelines
  - description: Review pipelines against quality rules
    name: Pipeline Quality Review
  - description: Execute tests within a project
    name: Test Execution
  - description: Manage your AI agent tasks
    name: AI Agent Tasks
  - description: SCIM endpoints for user/group permission management
    name: Directory Integration
  - description: Publish shared pipeline artifacts
    name: Shared Pipeline Artifacts
  - description: Manage Repositories
    name: Repositories
  - description: Report on Credit Consumption
    name: Consumption
  - description: Manage Artifacts
    name: Artifacts
  - description: Operations for data lineage and governance
    name: Data Lineage
  - description: Manage Streaming Pipelines
    name: Streaming Pipelines
  - description: Execute a pipeline
    name: Pipeline Execution
  - description: ''
    name: Environments
  - description: ''
    name: Projects
  - description: Manage Agents
    name: Agents
  - description: Operations for managing Environment-level Overrides of Project Variables
    name: Project Variable Environment Overrides
  - description: Query audit events
    name: Audit Events
  - description: Connector Profiles
    name: Connectors
paths:
  /v1/ai/agents/tasks/{taskId}/messages:
    get:
      tags:
        - AI Agent Tasks
      summary: Get Task Messages
      description: >-
        Returns paginated events for a task. Use the nextCursor field to
        retrieve subsequent pages.
      operationId: getTaskMessages
      parameters:
        - in: path
          name: taskId
          required: true
          schema:
            type: string
            format: uuid
        - in: query
          name: limit
          required: false
          schema:
            type: integer
            format: int32
            default: 25
            maximum: 1000
        - in: query
          name: paginationToken
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTaskMessagesResponse'
          description: Task messages retrieved successfully
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Invalid request parameters
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Missing or invalid authentication token
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Insufficient permissions to retrieve task messages
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Task not found
        '502':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Upstream service error
        '504':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Upstream service timeout
components:
  schemas:
    GetTaskMessagesResponse:
      type: object
      properties:
        more:
          type: string
          description: >-
            Token for fetching the next batch of results for this query; if
            omitted then there are no more.
        results:
          type: array
          description: The list of events for the task
          items:
            $ref: '#/components/schemas/TaskEvent'
    ProblemDetail:
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
        status:
          type: integer
          format: int32
        title:
          type: string
        type:
          type: string
          format: uri
        violations:
          type: array
          items:
            type: string
    TaskEvent:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/JsonNode'
          description: >-
            The event payload as returned by the upstream copilot service.
            Structure varies by event type.
        groupId:
          type: string
          description: >-
            Optional identifier for grouped events returned by the upstream
            copilot service
        timestamp:
          type: string
          format: date-time
    JsonNode: {}
  securitySchemes:
    bearerAuth:
      bearerFormat: JWT
      description: a valid bearer token
      scheme: bearer
      type: http

````