Documentation Index
Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
Use this file to discover all available pages before exploring further.
POST /v1/sessions/{session_id}/cancel
取消正在处理中的 Session。如果 Session 当前为 processing 状态,将中断 Agent 执行并将状态转为 canceling。如果 Session 已处于 idle 状态,操作仍然成功。
请求头
| 头部 | 必选 | 说明 |
|---|
Authorization | 是 | Bearer <PAT> |
Content-Type | 是 | application/json |
路径参数
| 参数 | 类型 | 必选 | 说明 |
|---|
session_id | string | 是 | Session ID(sess_ 前缀) |
示例请求
curl -X POST "https://openapi.qoder.sh/api/v1/cloud/sessions/sess_019e3bb1e8c171fd9abbb1477ffb84cc/cancel" \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json"
示例响应
HTTP 200 OK
返回精简的状态确认对象。
{
"id": "sess_019e3bb1e8c171fd9abbb1477ffb84cc",
"type": "session",
"status": "canceling"
}
响应字段
| 字段 | 类型 | 说明 |
|---|
id | string | Session ID |
type | string | 固定值 "session" |
status | string | 取消后的状态,值为 "canceling" |
canceling 是中间状态,表示取消指令已发出。最终状态将变为 idle 或 cancelled,可通过 SSE 流监听 session.status_idle 事件确认。
错误码
| HTTP | type | 触发条件 |
|---|
| 401 | authentication_error | PAT 无效或过期 |
| 404 | not_found_error | Session 不存在 |
完整错误信封说明详见 错误参考。