护栏
列出绑定到某个护栏策略的密钥
验证某个护栏策略当前正在哪些 API 密钥上生效。
GET
/
api
/
v1
/
guardrail-policies
/
{id}
/
bindings
列出绑定到某个护栏策略的密钥
curl --request GET \
--url https://api.example.com/api/v1/guardrail-policies/{id}/bindingsimport requests
url = "https://api.example.com/api/v1/guardrail-policies/{id}/bindings"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/guardrail-policies/{id}/bindings', 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-policies/{id}/bindings",
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-policies/{id}/bindings"
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-policies/{id}/bindings")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/guardrail-policies/{id}/bindings")
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返回当前绑定到指定策略的所有活跃(未撤销)API 密钥。在生产环境中依赖某个策略之前,可用此接口确认该策略确实在你预期的密钥上生效。
身份验证
需要携带具有billing API 密钥作用域的 Bearer 令牌。可见范围:作者本人或所属组织的任意成员。
请求示例
curl https://www.hitheo.ai/api/v1/guardrail-policies/{id}/bindings \
-H "Authorization: Bearer $THEO_API_KEY"
const { policy_id, bindings, count } = await theo.guardrails.policies.bindings(id);
console.log(`Policy is enforcing on ${count} key(s).`);
响应
{
"policy_id": "1f4f2c1a-22ce-4b07-9c0b-9c4f4b9b1d2e",
"bindings": [
{
"key_id": "key_abc123",
"key_name": "Production",
"key_prefix": "theo_sk_abc12345",
"key_org_id": null,
"key_user_id": "user_xyz",
"bound_at": "2026-01-15T18:24:11.000Z"
}
],
"count": 1
}
此页面对您有帮助吗?
列出绑定到某个护栏策略的密钥
curl --request GET \
--url https://api.example.com/api/v1/guardrail-policies/{id}/bindingsimport requests
url = "https://api.example.com/api/v1/guardrail-policies/{id}/bindings"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/guardrail-policies/{id}/bindings', 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-policies/{id}/bindings",
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-policies/{id}/bindings"
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-policies/{id}/bindings")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/guardrail-policies/{id}/bindings")
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