跳转到主要内容

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.

POST /v1/vaults 创建一个新的 Vault 资源。Vault 用于安全存储 MCP 服务器的访问凭证。创建时必须包含至少一个凭证。

请求头

头部必选说明
AuthorizationBearer <PAT>
Content-Typeapplication/json

请求体

字段类型必选说明
display_namestringVault 显示名称
credentialsarray凭证数组,至少包含一个凭证对象
credentials 数组元素:
字段类型必选说明
mcp_server_urlstringMCP 服务器 URL
protocolstring协议类型,可选值:ssestreamable_http
typestring凭证类型,当前仅支持 static_bearer
access_tokenstring访问令牌(static_bearer 类型必填)

示例请求

curl -X POST "https://openapi.qoder.sh/api/v1/cloud/vaults" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "display_name": "my-mcp-vault",
    "credentials": [
      {
        "mcp_server_url": "https://example.com/mcp",
        "protocol": "sse",
        "type": "static_bearer",
        "access_token": "your-access-token"
      }
    ]
  }'

示例响应

HTTP 201 Created
{
  "id": "vault_019e3bb940277f0db05ab74291acf6ef",
  "type": "vault",
  "display_name": "my-mcp-vault",
  "status": "active",
  "metadata": {},
  "credentials": [
    {
      "id": "vcred_019e3bb940297658a632dbf920057eff",
      "vault_id": "vault_019e3bb940277f0db05ab74291acf6ef",
      "mcp_server_url": "https://example.com/mcp",
      "protocol": "sse",
      "type": "static_bearer",
      "status": "active",
      "created_at": "2026-05-18T15:34:16.876188Z",
      "updated_at": "2026-05-18T15:34:16.876188Z"
    }
  ],
  "created_at": "2026-05-18T15:34:16.874877Z",
  "updated_at": "2026-05-18T15:34:16.874877Z"
}

错误码

HTTPtype触发条件
400invalid_request_error缺少 credentials 数组:At least one credential is required when creating a vault.
400invalid_request_error缺少 access_tokenField 'access_token' is required for static_bearer type.
401authentication_error缺少或无效的认证令牌
完整错误信封说明详见 错误参考