護欄
列出護欄執行記錄
追蹤護欄評估的只可追加審計日誌。
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