---
title: ガードレールアサインメントを作成する | RunAPI
description: 1 つのガードレールを標準 API キーまたはアカウントメンバーに関連付けます。
url: https://runapi.ai/ja/docs/api/management/guardrail-assignments/create.md
canonical: https://runapi.ai/ja/docs/api/management/guardrail-assignments/create
locale: ja
---

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

# ガードレールアサインメントを作成する

1 つのガードレールを標準 API キーまたはアカウントメンバーに関連付けます。

## エンドポイント

POST /api/v1/guardrail_assignments

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

API バージョン: v1

認証: Authorization: Bearer YOUR_MANAGEMENT_API_KEY


Authorization: アカウント管理者は対象となる任意のターゲットを割り当てることができます。管理者以外のユーザーは自分自身の標準 API キーのみ割り当てることができます。

## リクエスト

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

### JSON ボディ

```json
{
  "account_user_id": {
    "description": "アカウントメンバーのプレフィックス ID。このターゲットにはアカウント管理者が必要です。",
    "required": false,
    "type": "string"
  },
  "api_token_id": {
    "description": "Standard APIキーのプレフィックスID。正確に1つのターゲットIDを指定してください。",
    "required": false,
    "type": "string"
  },
  "guardrail_id": {
    "description": "Guardrail のプレフィックス ID。",
    "required": true,
    "type": "string"
  }
}
```

## 成功レスポンス

HTTP 201 - POST /api/v1/guardrail_assignments

```json
{
  "account_user_id": null,
  "api_token_id": "token_123",
  "created_at": "2026-07-27T10:00:00.000Z",
  "guardrail_id": "guardrail_123",
  "id": "guardrail_assignment_123"
}
```

## エラーレスポンス (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"
}
```

## エラーレスポンス (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"
}
```

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

HTTP 403

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

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

### レスポンス例

```json
{
  "error": "Forbidden"
}
```

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

HTTP 404

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

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

### レスポンス例

```json
{
  "error": "Resource not found"
}
```

## エラーレスポンス (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/guardrail_assignments \
  -H 'Authorization: Bearer YOUR_MANAGEMENT_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"guardrail_id":"guardrail_123","api_token_id":"token_123"}'
```

## 関連リファレンス

- [ガードレールの割り当て](https://runapi.ai/ja/docs/api/management/guardrail-assignments.md)
- [Guardrail Assignment オブジェクト](https://runapi.ai/ja/docs/api/management/guardrail-assignments/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": "1 つのガードレールを標準 API キーまたはアカウントメンバーに関連付けます。",
    "url": "https://runapi.ai/ja/docs/api/management/guardrail-assignments/create",
    "mainEntityOfPage": "https://runapi.ai/ja/docs/api/management/guardrail-assignments/create"
  }
]
```
