获取触发器
curl --request GET \
--url https://api.moonshot.cn/v1/triggers/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.moonshot.cn/v1/triggers/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.moonshot.cn/v1/triggers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moonshot.cn/v1/triggers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.moonshot.cn/v1/triggers/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.moonshot.cn/v1/triggers/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonshot.cn/v1/triggers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "trig_01h455vb4pex5vsknk084sn02q",
"name": "Daily summary",
"status": "active",
"agent_id": "agent_01h455vb4pex5vsknk084sn02q",
"session_mode": "new_session",
"policy": {
"type": "cron",
"expression": "0 9 * * *",
"timezone": "UTC"
},
"scope": "project",
"created_by": "user_example",
"created_at": "2026-08-01T09:00:00.000Z",
"updated_at": "2026-08-01T09:00:00.000Z"
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}返回单个触发器。cron 策略处于活跃状态时包含即将到来的运行时间。
GET
/
v1
/
triggers
/
{id}
获取触发器
curl --request GET \
--url https://api.moonshot.cn/v1/triggers/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.moonshot.cn/v1/triggers/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.moonshot.cn/v1/triggers/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.moonshot.cn/v1/triggers/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.moonshot.cn/v1/triggers/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.moonshot.cn/v1/triggers/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.moonshot.cn/v1/triggers/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "trig_01h455vb4pex5vsknk084sn02q",
"name": "Daily summary",
"status": "active",
"agent_id": "agent_01h455vb4pex5vsknk084sn02q",
"session_mode": "new_session",
"policy": {
"type": "cron",
"expression": "0 9 * * *",
"timezone": "UTC"
},
"scope": "project",
"created_by": "user_example",
"created_at": "2026-08-01T09:00:00.000Z",
"updated_at": "2026-08-01T09:00:00.000Z"
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}{
"error": {
"type": "invalid_parameter_error",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}路径参数
触发器 ID。
Pattern:
^trig_[0-9a-hjkmnp-tv-z]{26}$响应
触发器详情。cron 策略活跃时携带即将到来的运行时间。
保存的规则,按计划或按需启动智能体。
触发器 ID。
Pattern:
^trig_[0-9a-hjkmnp-tv-z]{26}$人类可读的触发器名称。
当前生命周期状态。
可用选项:
active, paused, archived 每次运行启动的智能体。
Pattern:
^agent_[0-9a-hjkmnp-tv-z]{26}$每次触发器运行使用哪个会话。
可用选项:
new_session, reuse_session 决定触发器何时运行的策略。
Show child attributes
Show child attributes
可见性范围。
可用选项:
official, org, project, user 创建者的用户 ID。
创建时间戳。
最后更新时间戳。
触发器暂停的原因。处于活跃状态时不存在。
Show child attributes
Show child attributes
精确的智能体版本("1"、"2"……)。缺省时在触发时刻选择最新版本。
承载触发器所启动会话的环境。
Pattern:
^env_[0-9a-hjkmnp-tv-z]{26}$绑定到触发器所启动会话的资源。
作为资源绑定到会话的文件。
- 文件
- 凭据库
- 记忆库
Show child attributes
Show child attributes
每次运行时添加到目标会话的开场事件。
发送用户消息。
- 用户消息
- 用户中断
Show child attributes
Show child attributes
创建或最后更新此触发器的不可变配置的类型,目前为 dream_policy_version。平台管理的触发器(此字段已设置)拒绝更新、暂停、恢复与归档——其生命周期跟随所属资源。仍可手动运行。
该不可变配置的 ID,例如梦境策略版本 ID。
触发器上次触发的时间。
即将到来的运行时间的近似值(UTC,最多 5 个)。仅活跃的 cron 触发器存在。
归档时间戳。处于活跃或暂停状态时不存在。
TriggerRun 通知的 webhook 配置。缺省则禁用投递。
Show child attributes
Show child attributes
此页面对您有帮助吗?