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

# List task messages

> Returns the conversation log for this task — every user reply submitted via
`POST /v1/tasks/{task_id}/message` plus the agent's messages back. Oldest
first by default.




## OpenAPI

````yaml GET /api/v1/tasks/{task_id}/messages
openapi: 3.1.0
info:
  title: Nanonets Agents Platform — Public API
  version: 1.0.0
  summary: >-
    Programmatically run AI agents, send follow-up messages, fetch results, and
    update agent prompts.
  description: >
    The Nanonets Agents Platform Public API lets you trigger agents, stream task
    progress,

    and integrate agent outputs into your own systems.


    ## Authentication


    All requests must include a workspace API key as a Bearer token:


    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    Workspace API keys are minted from the web app under **Settings → API
    Keys**. Each key

    is scoped to a single workspace; requests against agents or tasks outside
    that workspace

    return `403`.


    ## Lifecycle


    A typical integration is three calls:


    1. `POST /v1/agents/{agent_id}/run` — start a task. Returns a `task_id`
    immediately.

    2. Poll `GET /v1/tasks/{task_id}` until `status` is a terminal value
    (`completed`,
       `failed`, or `stopped`), **or** wait until it reaches `waiting_for_input` to
       respond with `POST /v1/tasks/{task_id}/message`.
    3. `GET /v1/tasks/{task_id}/summary` for the final answer, or `/result` for
    the full
       reasoning trace.

    ## Errors


    Every error response is `{"error": "<human-readable message>"}`. The HTTP
    status

    indicates the class:


    | Status | Meaning |

    |--------|---------|

    | 400 | Malformed request (bad UUID, missing required field, file too large)
    |

    | 401 | Missing or invalid API key |

    | 403 | API key is valid but the agent/task belongs to a different workspace
    |

    | 404 | Agent or task not found |

    | 500 | Server error — safe to retry with backoff |
  contact:
    name: Nanonets Support
    url: https://nanonets.com/support
  license:
    name: Proprietary
servers:
  - url: https://agents.nanonets.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Agents
    description: Manage agents — create, list, update, run, and version.
  - name: Tasks
    description: >-
      Inspect task status, fetch results, list and cancel tasks, and send
      follow-up messages.
paths:
  /api/v1/tasks/{task_id}/messages:
    get:
      tags:
        - Tasks
      summary: List messages on a task
      description: >
        Returns the conversation log for this task — every user reply submitted
        via

        `POST /v1/tasks/{task_id}/message` plus the agent's messages back.
        Oldest

        first by default.
      operationId: listTaskMessages
      parameters:
        - $ref: '#/components/parameters/TaskIdPath'
      responses:
        '200':
          description: All messages on this task in chronological order.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListTaskMessagesResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  parameters:
    TaskIdPath:
      name: task_id
      in: path
      required: true
      description: UUID of the task.
      schema:
        type: string
        format: uuid
  schemas:
    ListTaskMessagesResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/TaskMessage'
    TaskMessage:
      type: object
      description: One message in a task's conversation log.
      required:
        - id
        - task_id
        - agent_id
        - role
        - content
        - created_at
      properties:
        id:
          type: string
          format: uuid
        task_id:
          type: string
          format: uuid
        agent_id:
          type: string
          format: uuid
        user_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            ID of the user who submitted this message, or `null` for messages
            submitted via the API.
        role:
          type: string
          description: Sender role.
          enum:
            - user
            - assistant
            - system
        content:
          description: Free-form JSON message content. Shape depends on the producer.
        parent_id:
          type:
            - string
            - 'null'
          format: uuid
        created_at:
          type: string
          format: date-time
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
          examples:
            - Invalid agent_id format
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: API key is valid but the resource belongs to a different workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Agent or task not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ServerError:
      description: Unexpected server error. Safe to retry with exponential backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Workspace API key issued from the web app. Pass as
        `Authorization: Bearer YOUR_API_KEY`.

````