发送会话事件
更新时间:2026-09-11
POST
https://api.dumate.cn/api/v1/sessions/{sessionId}/events
本接口用于向会话(Session)发送用户消息,或中断当前正在执行的对话。
权限说明
使用 API Key 鉴权调用 API 流程,具体调用流程,请查看认证鉴权。
请求参数
Headers 参数
除公共头域外,无其它特殊头域
URL 参数
sessionId
string
目标会话(Session)标识。
必选
Body 参数
events
array
事件数组,不可为空。
当前仅处理数组中的第一个事件,每次请求传入一个事件。
必选
显示子属性
隐藏子属性
items
object {2}
显示子属性
隐藏子属性
type
string
事件类型。
可选值:user.message、user.interrupt。
必选
content
array
消息内容列表。type 为 user.message 时必填且不可为空;type 为 user.interrupt 时无需提供。
可选
显示子属性
隐藏子属性
items
object {3}
显示子属性
隐藏子属性
type
string
内容类型。
可选值:text、file。
必选
text
string
用户输入的文本。type 为 text 时使用。
可选
file_id
string
文件标识,取上传文件接口返回的 fileID。type 为 file 时必填。
仅允许字母、数字、下划线和连字符。
上传该文件时必须传入当前会话(Session)的 sessionId。
可选
请求结构
POST /api/v1/sessions/ses_01ABC/events HTTP/1.1
Host: api.dumate.cn
Authorization: Bearer <YOUR_API_KEY>
Content-Type: application/json
{
"events": [
{
"type": "user.message",
"content": [
{
"type": "text",
"text": "你好,请介绍一下你能完成哪些任务"
}
]
}
]
}
示例代码
curl
curl --location --request POST "https://api.dumate.cn/api/v1/sessions/ses_01ABC/events" \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"events": [
{
"type": "user.message",
"content": [
{
"type": "text",
"text": "你好,请介绍一下你能完成哪些任务"
}
]
}
]
}'
curl
curl --location --request POST "https://api.dumate.cn/api/v1/sessions/ses_01ABC/events" \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"events": [
{
"type": "user.message",
"content": [
{
"type": "text",
"text": "总结这篇文档的主要内容"
},
{
"type": "file",
"file_id": "file-01a00bed6a23707c85a99a43820df945"
}
]
}
]
}'
curl
curl --location --request POST "https://api.dumate.cn/api/v1/sessions/ses_01ABC/events" \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--data '{
"events": [
{
"type": "user.interrupt"
}
]
}'
返回响应
Headers 参数
除公共头域外,无其它特殊头域
返回参数
user.message
HTTP 状态码为 204 No Content,无响应体
可选
user.interrupt
HTTP 状态码为 200 OK,响应体为布尔值
可选
响应示例
发送消息成功:
HTTP/1.1 204 No Content
评价此篇文章
