护栏
列出护栏执行记录
追踪护栏评估的只可追加审计日志。
GET
/
api
/
v1
/
guardrail-executions
列出护栏执行记录
curl --request GET \
--url https://api.example.com/api/v1/guardrail-executionsimport requests
url = "https://api.example.com/api/v1/guardrail-executions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/guardrail-executions', 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.example.com/api/v1/guardrail-executions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v1/guardrail-executions"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v1/guardrail-executions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/guardrail-executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body返回调用方有权查看的护栏评估只可追加审计日志,按最新记录优先排序。记录会保留 90 天(由 BullMQ 保留任务强制执行)。
认证
需要携带具备billing API 密钥权限范围的 Bearer 令牌。
查询参数
integer
返回的行数。范围 1–200,默认 50。
string
按单个 API 密钥(UUID)筛选。
string
按单个策略(UUID)筛选。
string
ISO 时间戳。仅返回严格晚于该时间创建的记录。可用于追踪日志。
请求示例
# 单个策略最近 20 条评估记录
curl "https://www.hitheo.ai/api/v1/guardrail-executions?limit=20&policy_id=$POLICY_ID" \
-H "Authorization: Bearer $THEO_API_KEY"
# 追踪某个时间点之后的所有评估记录
curl "https://www.hitheo.ai/api/v1/guardrail-executions?since=2026-01-15T18:00:00.000Z" \
-H "Authorization: Bearer $THEO_API_KEY"
const recent = await theo.guardrails.executions.list({
policyId,
limit: 20,
});
// 长轮询获取新记录
const since = new Date(Date.now() - 60_000).toISOString();
const newRows = await theo.guardrails.executions.list({ since });
可见性
- 个人调用方(无激活的组织):仅能查看自己在个人策略下创建的记录。
- 团队调用方:可查看激活组织所拥有策略下所有成员的记录。可见性遵循的是策略,而非触发该记录的用户。
响应
{
"executions": [
{
"id": "exec_abc123",
"user_id": "user_xyz",
"key_id": "key_abc",
"policy_id": "1f4f2c1a-...",
"policy_name": "Compliance-strict",
"guardrail_id": "pii_redactor",
"phase": "input",
"verdict": "redact",
"matched_pattern": "email,phone",
"redacted_count": 2,
"latency_ms": 1,
"created_at": "2026-01-15T18:24:11.123Z"
}
]
}
此页面对您有帮助吗?
列出护栏执行记录
curl --request GET \
--url https://api.example.com/api/v1/guardrail-executionsimport requests
url = "https://api.example.com/api/v1/guardrail-executions"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/guardrail-executions', 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.example.com/api/v1/guardrail-executions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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.example.com/api/v1/guardrail-executions"
req, _ := http.NewRequest("GET", url, nil)
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.example.com/api/v1/guardrail-executions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/guardrail-executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body