跳到正文
API 参考
API 参考

列出 Guardrails

列出当前账户中激活的 Guardrails。

列出当前账户中激活的 Guardrails。

端点

GET /api/v1/guardrails
基础 URL
https://runapi.ai
API 版本
v1
身份验证
Authorization: Bearer YOUR_MANAGEMENT_API_KEY
授权
需要账户管理员的 Management API 密钥。
02

请求

JSON 请求体

只能在列出的请求位置发送值。

查询参数2 个字段
limitinteger
可选

Maximum Guardrails returned per page.

默认值: 20 范围: 1 - 100
pageinteger
可选

Offset page number. Values start at 1.

默认值: 1 边界: 1
03

成功响应

HTTP 200

GET /api/v1/guardrails

JSON
{
  "guardrails": [
    {
      "allowed_models": [
        "gpt-5.4"
      ],
      "allowed_providers": [],
      "assignment_count": 1,
      "blocked_models": [],
      "blocked_providers": [],
      "created_at": "2026-07-27T10:00:00.000Z",
      "credit_limit_cents": 50000,
      "credit_limit_reset_interval": "monthly",
      "description": "Production policy",
      "enabled": true,
      "id": "guardrail_123",
      "model_budgets": [
        {
          "credit_limit_cents": 10000,
          "credit_limit_reset_interval": "monthly",
          "match_mode": "include",
          "models": [
            "gpt-5.4"
          ]
        }
      ],
      "name": "Production budget"
    }
  ],
  "pagination": {
    "limit": 20,
    "page": 1,
    "pages": 1,
    "total": 1
  }
}
04

错误响应 (401)

HTTP 401
响应 Schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

响应示例

JSON
{
  "error": "Authentication required"
}
05

错误响应 (403)

HTTP 403
响应 Schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

响应示例

JSON
{
  "error": "Management API key required"
}
06

错误响应 (403)

HTTP 403
响应 Schema
JSON
{
  "properties": {
    "error": {
      "description": "Human-readable error message.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}

响应示例

JSON
{
  "error": "Account admin required"
}
07

错误响应 (400)

HTTP 400
响应 Schema
JSON
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Human-readable error message.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Human-readable validation summary.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Validation messages keyed by public request field, with an array of human-readable strings for each field.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}

响应示例

JSON
{
  "error": "page must be an integer"
}
08

cURL 示例

CURL
curl -X GET https://runapi.ai/api/v1/guardrails?page=1&limit=20 \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY'