# 查询Web应用访客会话

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

按发布方智能体查询公开应用产生的访客会话。


```http
GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents/{agent_id}/webapp/conversations
```

## 调用前准备

`BASE_URL` 使用产品 API 前缀 `https://api.moi.matrixorigin.cn/v5`；专有部署填写对应的产品 API 地址。

[准备发布管理身份和对象](objects.md#prepare)。

## 请求

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} 输入示例

```bash
curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/webapp/conversations?status=all&limit=50&offset=0" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

下一页示例：

```bash
curl --request GET \
  "$BASE_URL/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/webapp/conversations?status=all&limit=50&offset=50" \
  --header "X-API-Key: $MOI_KEY" \
  --header "X-Workspace-ID: $WORKSPACE_ID"
```

:::::
:::::{tab-item} 参数说明

| 参数 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspace_id` | 路径 | string | 是 | 同环境发布工作区ID。 |
| `agent_id` | 路径 | string | 是 | 目标智能体ID。 |
| `status` | 查询 | string | 否 | 默认active；可选active、archived、all。 |
| `limit` | 查询 | integer | 否 | 默认50，上限200；无效/非正按50。 |
| `offset` | 查询 | integer | 否 | 默认0，负数按0。 |

限定purpose=webapp及可见会话，不按当前登录管理员的用户ID筛掉其他访客。读取权限为agent.read；链接停用不等于隐藏全部历史。普通翻页至offset + items.length达到total或当前items为空时停止；并发变化可能改变分页集合。

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

## 成功响应

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "code": 0,
  "data": {
    "items": [
      {
        "conversation_id": "conversation-example",
        "title": "公开访问对话",
        "status": "active",
        "end_user_id": "visitor-example",
        "message_count": 2,
        "created_at": "2026-11-12T01:00:00Z",
        "updated_at": "2026-11-12T01:00:00Z"
      }
    ],
    "total": 1,
    "limit": 50,
    "offset": 0
  }
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `code` | integer | 成功代码。 |
| `data` | object | [对应对象](objects.md#responses)。 |

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

## 错误响应

[错误与回读](lifecycle.md#errors)按该入口区分参数、权限和写入结果。
