跳转到主要内容
GET /v1/sessions/{session_id}/threads 获取 Session 中的所有线程列表。如果 Session 尚未创建线程,系统会自动创建一个 coordinator 主线程。

请求头

头部必选说明
AuthorizationBearer <PAT>

路径参数

参数类型必选说明
session_idstringSession ID(sess_ 前缀)

查询参数

参数类型必选说明
limitinteger返回数量上限,默认 20
orderstring排序方向:asc(默认)或 desc
before_idstring游标分页:返回该 ID 之前的记录
after_idstring游标分页:返回该 ID 之后的记录
statuses[]string按线程状态过滤。支持多个值:idlerunningarchivedterminatedblocked

示例请求

curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019f00000000000000000000000000aa/threads" \
  -H "Authorization: Bearer $QODER_PAT"

按状态过滤

curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019f00000000000000000000000000aa/threads?statuses[]=running&statuses[]=idle" \
  -H "Authorization: Bearer $QODER_PAT"

示例响应

HTTP 200 OK
{
  "data": [
    {
      "id": "sthr_019f00000000000000000000000001aa",
      "type": "session_thread",
      "session_id": "sess_019f00000000000000000000000000aa",
      "parent_thread_id": null,
      "agent": {
        "id": "agent_019f000000000000000000000000001a",
        "type": "agent",
        "name": "task-coordinator",
        "model": "ultimate",
        "version": 1
      },
      "agent_id": "agent_019f000000000000000000000000001a",
      "agent_version": 1,
      "name": "",
      "role": "coordinator",
      "status": "idle",
      "stop_reason": {"type": "end_turn"},
      "created_by_tool_use_id": null,
      "archived_at": null,
      "created_at": "2026-06-15T08:00:00.000Z",
      "updated_at": "2026-06-15T08:05:00.000Z"
    },
    {
      "id": "sthr_019f00000000000000000000000002bb",
      "type": "session_thread",
      "session_id": "sess_019f00000000000000000000000000aa",
      "parent_thread_id": "sthr_019f00000000000000000000000001aa",
      "agent": {
        "id": "agent_019f000000000000000000000000002b",
        "type": "agent",
        "name": "Research Agent",
        "model": "ultimate",
        "version": 2
      },
      "agent_id": "agent_019f000000000000000000000000002b",
      "agent_version": 2,
      "name": "Research Agent",
      "role": "child",
      "status": "running",
      "stop_reason": {},
      "created_by_tool_use_id": "toolu_bdrk_01T42NPLcKrBvLJfWgGt3QMt",
      "archived_at": null,
      "created_at": "2026-06-15T08:01:00.000Z",
      "updated_at": "2026-06-15T08:01:00.000Z"
    }
  ],
  "first_id": "sthr_019f00000000000000000000000001aa",
  "last_id": "sthr_019f00000000000000000000000002bb",
  "has_more": false
}

响应字段

字段类型说明
dataSession Thread 数组线程对象列表
first_idstring | null当前页第一条记录的 ID
last_idstring | null当前页最后一条记录的 ID
has_moreboolean是否还有更多记录

错误码

HTTPtype触发条件
401authentication_errorPAT 无效或过期
404not_found_errorSession 不存在
完整错误信封说明详见 错误参考

相关

Managed Agents

了解 coordinator 与 child 线程的协作模型。

归档 Thread

终止指定的子线程。

Session Thread 对象

Session Thread 对象的完整字段参考。