跳转到主要内容
GET
/
v3beta1
/
enterprise
/
organizations
/
{org_id}
/
guardrail-violations
列出组织的防护规则违规记录。
curl --request GET \
  --url https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations', 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.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations",
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.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations"

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.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.devin.ai/v3beta1/enterprise/organizations/{org_id}/guardrail-violations")

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
{
  "items": [
    {
      "action_taken": "<string>",
      "confidence_score": 123,
      "created_at": 123,
      "event_id": "<string>",
      "guardrail_id": "<string>",
      "guardrail_name": "<string>",
      "org_id": "<string>",
      "reasoning": "<string>",
      "session_id": "<string>",
      "user_message": "<string>",
      "violation_id": 123
    }
  ],
  "end_cursor": "<string>",
  "has_next_page": false,
  "total": 123
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
如需了解护栏的工作原理以及如何配置,请参阅 AI Guardrails 功能指南。

权限

需要具有企业级 ManageEnterpriseSettings 权限的服务用户。

时间过滤器

此 endpoint 支持通过 time_aftertime_before 查询参数设置可选时间过滤器。
  • time_aftertime_before 都是以秒为单位的 Unix 时间戳,按 UTC 解析。
  • 如果提供 time_before,则也必须提供 time_after
  • time_aftertime_before 之间的时间范围必须 不超过 100 天
  • 如果未提供任何时间过滤器,API 将返回全部可用历史记录中的 guardrail 违规记录 (受分页限制) 。

授权

Authorization
string
header
必填

服务用户凭据(前缀:cog_)

路径参数

org_id
string
必填

组织 ID(前缀:org-)

示例:

"org-abc123def456"

查询参数

order
enum<string>
默认值:desc
可用选项:
asc,
desc
time_before
integer | null
time_after
integer | null
after
string | null
first
integer
默认值:100
必填范围: 1 <= x <= 200
session_id
string | null
guardrail_id
string | null

响应

成功响应

items
GuardrailViolationResponse · object[]
必填
end_cursor
string | null

用于获取下一页的游标;如果这是最后一页,则为 None。

has_next_page
boolean
默认值:false

当前页之后是否还有更多条目。

total
integer | null

可选的总记录数(可为提升性能而省略)。