> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 認証情報の作成

> 指定の Vault に新しい MCP サーバー認証情報を追加します。

`POST /api/v1/cloud/vaults/{vault_id}/credentials`

指定された Vault に新しい MCP サーバー認証情報を追加します。

## パスパラメータ

| パラメータ      | 型      | 必須 | 説明           |
| ---------- | ------ | -- | ------------ |
| `vault_id` | string | はい | Vault の一意識別子 |

## ヘッダー

| ヘッダー            | 必須 | 説明                  |
| --------------- | -- | ------------------- |
| `Authorization` | はい | `Bearer $QODER_PAT` |
| `Content-Type`  | はい | `application/json`  |

## リクエストボディ

| フィールド          | 型      | 必須  | 説明                                                                                                |
| -------------- | ------ | --- | ------------------------------------------------------------------------------------------------- |
| `auth`         | object | はい  | 認証情報の認証詳細。[Credential auth オブジェクト](/ja/cloud-agents/api/vaults/schemas#credential-auth-object)を参照 |
| `display_name` | string | いいえ | 互換性のために受け付けられる。現在は `null` として返され、保持されない                                                           |
| `metadata`     | object | いいえ | 認証情報に保存されるカスタムメタデータ。デフォルトは `{}`                                                                   |

## リクエスト例

```bash theme={null}
curl -X POST https://api.qoder.com/api/v1/cloud/vaults/vault_019e3bb940277f0db05ab74291acf6ef/credentials \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "auth": {
      "type": "static_bearer",
      "mcp_server_url": "https://example.com/mcp-stream",
      "token": "your-access-token"
    },
    "metadata": {"team":"docs"}
  }'
```

## レスポンス例

**HTTP 200 OK**

```json theme={null}
{
  "id": "vcred_019e3bb98877759e862750b495c1fce8",
  "type": "vault_credential",
  "vault_id": "vault_019e3bb940277f0db05ab74291acf6ef",
  "auth": {
    "type": "static_bearer",
    "mcp_server_url": "https://example.com/mcp-stream"
  },
  "display_name": null,
  "metadata": {
    "team": "docs"
  },
  "archived_at": null,
  "created_at": "2026-05-18T15:34:35.387093Z",
  "updated_at": "2026-05-18T15:34:35.387093Z"
}
```

## レスポンスフィールド

| フィールド          | 型              | 説明                                    |
| -------------- | -------------- | ------------------------------------- |
| `id`           | string         | `vcred_` プレフィックス付きの認証情報一意識別子          |
| `type`         | string         | 固定値 `"vault_credential"`              |
| `vault_id`     | string         | 所有する Vault の ID                       |
| `auth`         | object         | サニタイズされた認証詳細。シークレットは決して返されない          |
| `display_name` | null           | 現在は常に `null`                          |
| `metadata`     | object         | 認証情報に保存されるカスタムメタデータオブジェクト。デフォルトは `{}` |
| `archived_at`  | string \| null | アーカイブ時刻。アクティブな場合は `null`              |
| `created_at`   | string         | 作成時刻（ISO 8601）                        |
| `updated_at`   | string         | 最終更新時刻（ISO 8601）                      |

## エラー

| HTTP | type                    | トリガー条件                                                                |
| ---- | ----------------------- | --------------------------------------------------------------------- |
| 400  | `invalid_request_error` | `auth` 欠落、認証情報タイプ無効、必須 auth フィールド欠落、または `metadata` 無効                 |
| 401  | `TOKEN_INVALID`         | 認証トークンが欠落または無効                                                        |
| 404  | `not_found_error`       | Vault が存在しないまたはアクセス不可                                                 |
| 409  | `conflict_error`        | Vault がアーカイブ済み、Vault がアクティブな認証情報の上限に達している、または重複するアクティブな MCP 認証情報が存在する |

## 注意事項

* レスポンスには `token`、`access_token`、`refresh_token`、`client_secret`、`secret_value` を含む認証情報のシークレットは返されません。
* 1 つの Vault は最大 20 個のアクティブな認証情報を保持できます。
* 認証情報は作成後直ちに `active` 状態になります。

エラーエンベロープの詳細については[エラーリファレンス](/ja/cloud-agents/api/conventions/errors)を参照してください。

## 関連項目

<CardGroup cols={2}>
  <Card title="Vaults" icon="key" href="/ja/cloud-agents/vaults">
    シークレットを安全に保存し、Agent Session に注入する。
  </Card>
</CardGroup>
