GET /api/v1/forward/sessions
返回当前账号下的 Session 列表;归档 Session 默认不返回。
请求头
| Header | 是否必填 | 说明 |
|---|---|---|
| Authorization | 是 | Bearer <PAT> |
查询参数
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|---|---|---|---|---|
| identity_ids | string或array | 否 | - | 按一个或多个 Identity ID 过滤,支持逗号分隔。 |
| template_id | string | 否 | - | 按 Forward Template ID 过滤。 |
| source_type | string | 否 | - | 按 api、im 或 schedule 过滤。 |
| created_at[gt] | string | 否 | - | 创建时间严格大于该 RFC 3339 时间。 |
| created_at[gte] | string | 否 | - | 创建时间大于等于该 RFC 3339 时间。 |
| created_at[lt] | string | 否 | - | 创建时间严格小于该 RFC 3339 时间。 |
| created_at[lte] | string | 否 | - | 创建时间小于等于该 RFC 3339 时间。 |
| updated_at[gt] | string | 否 | - | 更新时间严格大于该 RFC 3339 时间。 |
| updated_at[gte] | string | 否 | - | 更新时间大于等于该 RFC 3339 时间。 |
| updated_at[lt] | string | 否 | - | 更新时间严格小于该 RFC 3339 时间。 |
| updated_at[lte] | string | 否 | - | 更新时间小于等于该 RFC 3339 时间。 |
| limit | integer | 否 | 20 | 分页大小,最大 100。 |
| after_id | string | 否 | - | 向后翻页游标。 |
| before_id | string | 否 | - | 向前翻页游标。 |
| order | string | 否 | desc | 排序方向:desc 或 asc。 |
| include_archived | boolean | 否 | false | 是否包含已归档 Session。 |
示例请求
curl -s -X GET 'https://api.qoder.com/api/v1/forward/sessions' \
-H "Authorization: Bearer $QODER_PAT"
示例响应
HTTP 200 OK{
"data": [
{
"id": "sess_xxx",
"type": "session",
"identity_id": "idn_xxx",
"template": {
"id": "tmpl_support",
"type": "template",
"name": "Support assistant",
"model": "ultimate",
"version": 3
},
"source_type": "im",
"status": "idle",
"title": "Customer support session",
"incremental_streaming_enabled": false,
"metadata": {
"source": "dingtalk"
},
"config": {
"environment_variables": {
"API_KEY": "sk-xxx"
}
},
"stats": {
"active_seconds": 30,
"duration_seconds": 3600
},
"usage": {
"credits": 12.5
},
"archived_at": null,
"created_at": "2026-06-22T10:00:00Z",
"updated_at": "2026-06-22T11:00:00Z"
}
],
"first_id": "sess_xxx",
"last_id": "sess_xxx",
"has_more": false
}
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| data | array | 当前页的 Session 对象。 |
| first_id | string | null | 当前页第一条记录 ID。 |
| last_id | string | null | 当前页最后一条记录 ID。 |
| has_more | boolean | 是否还有更多记录。 |
错误
| HTTP | Type | Code | 触发条件 |
|---|---|---|---|
| 400 | invalid_request_error | invalid_time_range | 时间筛选范围不合法。 |
| 400 | invalid_request_error | invalid_pagination | 分页参数不合法。 |
| 401 | authentication_error | authentication_required | PAT 无效或已过期。 |
注意事项
after_id和before_id不能同时传入。- 当前设计不支持按
status筛选。 - Credits 模块未启用时可省略
usage.credits。