<span id="读取团队会话消息"></span>

# Read team conversation messages

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

Read the public input and output messages of a team conversation.


```http
GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agent-teams/{team_id}/sessions/{context_id}/messages
```

<span id="调用前准备"></span>

## Before you call this API

Set `BASE_URL` to the product API prefix `https://api.moi.matrixorigin.cn/v5`; use the corresponding product API URL for a dedicated deployment.

[Prepare product identity and object identifiers in the same environment](objects.md#prepare).

<span id="请求"></span>

## Request

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} Request example

```bash
curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agent-teams/$TEAM_ID/sessions/$CONTEXT_ID/messages?limit=50&offset=0" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

Next-page example:

```bash
curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agent-teams/$TEAM_ID/sessions/$CONTEXT_ID/messages?limit=50&offset=50" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

Latest-window example:

```bash
curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agent-teams/$TEAM_ID/sessions/$CONTEXT_ID/messages?latest=true&limit=50" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} Parameters

| Parameter | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `workspace_id` | Path | string | Yes | Current workspace ID; keep the product identity and headers in the same environment. |
| `team_id` | Path | string | Yes | Team ID from the team list or creation response. |
| `context_id` | Path | string | Yes | Team conversation ID from creation or the list. |
| `latest` | Queries | boolean text | No | Only literal true enables the latest window. Use separately from ordinary pagination. |
| `limit` | Queries | integer | No | Default 50, maximum 200. Nonpositive or invalid values use 50. |
| `offset` | Queries | integer | No | Default 0; negative values use 0. |

In ordinary mode, stop when offset + items.length >= total or items is empty. Concurrent writes may affect offset pagination; total is not a stable snapshot.

Ordinary mode sorts by creation time and snapshot order ascending and uses limit/offset pagination. latest=true selects the newest window, ignores requested offset, restores chronological order, and returns the actual window offset. total counts input/output snapshots underlying the message projection, not tasks.

:::::
::::::
:::::::

<span id="成功响应"></span>

## Successful response

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} Response example

```json
{
  "code": 0,
  "data": {
    "items": [
      {
        "id": "message-example",
        "conversation_id": "context-example",
        "task_id": "task-example",
        "agent_workspace_id": "workspace-example",
        "agent_id": "agent-example",
        "role": "user",
        "parts": [
          {
            "kind": "text",
            "text": "整理资料"
          }
        ],
        "committed": false,
        "created_at": "2026-11-12T01:00:00Z"
      }
    ],
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

:::::
:::::{tab-item} Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | integer | 0 on success. |
| `data` | object | [Corresponding response object](objects.md#responses). |

HTTP 200. Returns the [corresponding object](objects.md#responses). Confirm writes with the corresponding read action.

:::::
::::::
:::::::

<span id="错误响应"></span>

## Error responses

[Errors and concurrency handling](lifecycle.md#errors) distinguishes parameter, version, member/session state, and admission failures.
