List Sessions
根据已签发的 userKey 查询其下创建的所有会话列表。可按活跃或已结束筛选。结果按 STUDIO-API-KEY 作用域过滤(仅返回与该密钥映射的 appId 相关的会话)。next / previous 分页链接基于请求 Host;若部署在反向代理之后,请正确配置 X-Forwarded-* 头。
GET/api/v2/sessions
Headers
| 请求头 | 值 |
|---|---|
| STUDIO-API-KEY | {userKey} |
查询参数
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| page | integer | 1 | 页码(≥ 1) |
| page_size | integer | 20 | 每页条数(1–100) |
| type | string | — | active:活跃会话historic:已结束会话(可选) |
示例
- cURL
- Node.js
- Python
curl https://ai-streamer.deepbrain.io/api/v2/sessions \
-H "Content-Type: application/json" \
-H "STUDIO-API-KEY: ${userKey}" \
-X GET
import axios from 'axios'
const userKey = '${userKey}'
axios.get(
'https://ai-streamer.deepbrain.io/api/v2/sessions',
{
headers: {
'STUDIO-API-KEY': userKey,
'Content-Type': 'application/json'
}
}
)
.then((res) => {
console.log(res.data)
})
.catch((error) => {
console.error(error)
})
import requests
url = 'https://ai-streamer.deepbrain.io/api/v2/sessions'
user_key = '${userKey}'
headers = {
'STUDIO-API-KEY': user_key,
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
print(response.json())
成功(code: 1000)
{
"code": 1000,
"data": {
"count": 2,
"next": "<https://dev-streamer.example.com/api/v2/sessions?page=2&page_size=20&type=active>",
"previous": null,
"results": [
{
"sessionId": "${SESSION_ID}",
"created_at": "2026-04-07T02:37:50.000Z",
"updated_at": "2026-04-07T02:37:50.000Z",
"duration": 0,
"source": "API",
"credits_consumed": 0
}
]
},
"message": null
}
下一步
查询单个会话详情请使用 Get Session Detail API。