---
title: ガードレールを作成する | RunAPI
description: 再利用可能なモデル、プロバイダー、および予算ポリシーを作成します。
url: https://runapi.ai/ja/docs/api/management/guardrails/create.md
canonical: https://runapi.ai/ja/docs/api/management/guardrails/create
locale: ja
---

> HTML 版: https://runapi.ai/ja/docs/api/management/guardrails/create
> エージェント向けサイトインデックス: https://runapi.ai/llms.txt

# ガードレールを作成する

再利用可能なモデル、プロバイダー、および予算ポリシーを作成します。

## エンドポイント

POST /api/v1/guardrails

ベースURL: https://runapi.ai

API バージョン: v1

認証: Authorization: Bearer YOUR_MANAGEMENT_API_KEY


Authorization: アカウント管理者の Management API キーが必要です。

## リクエスト

指定されたリクエストの場所にのみ値を送信してください。

### JSON ボディ

```json
{
  "allowed_models": {
    "description": "モデル許可リスト。",
    "required": false,
    "type": "array | null"
  },
  "allowed_providers": {
    "description": "プロバイダー名の許可リスト。",
    "required": false,
    "type": "array | null"
  },
  "blocked_models": {
    "description": "許可リストよりも優先されるモデルブロックリスト。",
    "required": false,
    "type": "array | null"
  },
  "blocked_providers": {
    "description": "プロバイダー名のブロックリスト。",
    "required": false,
    "type": "array | null"
  },
  "credit_limit_cents": {
    "description": "総支出上限（USセント単位）。",
    "required": false,
    "type": "integer | null"
  },
  "credit_limit_reset_interval": {
    "description": "総支出上限のリセット周期。",
    "enum": [
      "daily",
      "weekly",
      "monthly"
    ],
    "required": false,
    "type": "string | null"
  },
  "description": {
    "description": "オプションの自由形式の説明。",
    "required": false,
    "type": "string"
  },
  "enabled": {
    "default": true,
    "description": "ガードレールが適用されるかどうか。",
    "required": false,
    "type": "boolean"
  },
  "model_budgets": {
    "description": "モデルごとの予算ルール。",
    "required": false,
    "type": "array | null"
  },
  "name": {
    "description": "アカウント内で一意の Guardrail 名。",
    "required": true,
    "type": "string"
  }
}
```

## 成功レスポンス

HTTP 201 - POST /api/v1/guardrails

```json
{
  "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"
}
```

## エラーレスポンス (401)

HTTP 401

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Authentication required"
}
```

## エラーレスポンス (403)

HTTP 403

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Management API key required"
}
```

## エラーレスポンス (403)

HTTP 403

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人が読めるエラーメッセージ。",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Account admin required"
}
```

## エラーレスポンス (400)

HTTP 400

### レスポンススキーマ

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "人が読めるエラーメッセージ。",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "人間が読める形式のバリデーションサマリー。",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "公開リクエストフィールドをキーとするバリデーションメッセージ。各フィールドに対して人間が読める文字列の配列が含まれます。",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### レスポンス例

```json
{
  "error": "page must be an integer"
}
```

## エラーレスポンス (422)

HTTP 422

### レスポンススキーマ

```json
{
  "properties": {
    "error": {
      "description": "人間が読める形式のバリデーションサマリー。",
      "type": "string"
    },
    "errors": {
      "additionalProperties": {
        "items": {
          "type": "string"
        },
        "type": "array"
      },
      "description": "公開リクエストフィールドをキーとするバリデーションメッセージ。各フィールドに対して人間が読める文字列の配列が含まれます。",
      "type": "object"
    }
  },
  "required": [
    "error",
    "errors"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### レスポンス例

```json
{
  "error": "Validation failed",
  "errors": {
    "base": [
      "Validation failed"
    ]
  }
}
```

## cURLの例



### curl

```curl
curl -X POST https://runapi.ai/api/v1/guardrails \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"name":"Production budget","description":"Production policy","enabled":true,"credit_limit_cents":50000,"credit_limit_reset_interval":"monthly","allowed_models":["gpt-5.4"],"model_budgets":[{"match_mode":"include","models":["gpt-5.4"],"credit_limit_cents":10000,"credit_limit_reset_interval":"monthly"}]}'
```

## 関連リファレンス

- [ガードレール](https://runapi.ai/ja/docs/api/management/guardrails.md)
- [Guardrail オブジェクト](https://runapi.ai/ja/docs/api/management/guardrails/object.md)

---

## RunAPI のその他の情報

- [ホーム](https://runapi.ai/ja/.md)
- [モデルカタログ](https://runapi.ai/ja/models.md)
- [料金](https://runapi.ai/ja/pricing.md)
- [プロバイダー](https://runapi.ai/ja/models)
- [ドキュメント](https://runapi.ai/ja/docs/guides)
- [SDK](https://runapi.ai/ja/sdk.md)
- [CLI](https://runapi.ai/ja/cli.md)
- [MCP Server](https://runapi.ai/ja/mcp.md)
- [Claude Code と Cursor](https://runapi.ai/ja/claude-code-vs-cursor.md)
- [Cursor API セットアップ](https://runapi.ai/ja/cursor-api-setup.md)
- [RunAPI と OpenRouter の比較](https://runapi.ai/ja/openrouter-alternative.md)
- [エンタープライズ](https://runapi.ai/ja/contact.md)
- [お問い合わせ](https://runapi.ai/ja/contact.md)
- [利用規約](https://runapi.ai/ja/terms.md)
- [プライバシー](https://runapi.ai/ja/privacy.md)
- [エージェント向けサイトインデックス](https://runapi.ai/llms.txt)

お問い合わせ: contact@runapi.ai

## 構造化データ

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/ja/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/ja",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/jaicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "ja",
    "@type": "TechArticle",
    "headline": "ガードレールを作成する",
    "description": "再利用可能なモデル、プロバイダー、および予算ポリシーを作成します。",
    "url": "https://runapi.ai/ja/docs/api/management/guardrails/create",
    "mainEntityOfPage": "https://runapi.ai/ja/docs/api/management/guardrails/create"
  }
]
```
