跳转到主要内容

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。仅在 processing 状态下调用 cancel 才会实际中断 Agent 执行:状态先转为 canceling,中断完成后自动回到 idle,Session 仍可继续使用——直接发送下一条 user.message 即可,无需创建新 Session。如果 Session 已处于 idle,cancel 是空操作,同样返回 200,状态保持 idle 不变。

请求头

头部必选说明
AuthorizationBearer <PAT>
Content-Typeapplication/json

路径参数

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

示例请求

curl -X POST "https://api.qoder.com/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"
}

响应字段

字段类型说明
idstringSession ID
typestring固定值 "session"
statusstring取消后的状态,值为 "canceling"
canceling 是中间状态,表示取消指令已发出。中断完成后最终状态变为 idle,可通过 SSE 流监听 session.status_idle 事件确认。

错误码

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