> ## Documentation Index
> Fetch the complete documentation index at: https://oma-codex-339-workspace-permissions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 验证凭据

> 通过 OMA API 验证凭据。

<Info>每个请求都必须发送 `?beta=true`。</Info>


## OpenAPI

````yaml /openapi/oma.zh.json post /v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate
openapi: 3.1.0
info:
  title: OMA API 参考
  version: 1.0.0
  description: Open Managed Agents 应用 API 参考。
servers:
  - url: http://localhost:38080
    description: 本地 OMA 服务器
security:
  - omaApiKey: []
  - omaBearer: []
paths:
  /v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate:
    post:
      summary: 验证凭据
      operationId: BetaValidateCredential
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
        - name: anthropic-version
          in: header
          required: false
          schema:
            type: string
        - name: anthropic-beta
          in: header
          required: false
          schema:
            type: string
            items:
              type: string
            x-stainless-override-schema:
              x-stainless-param: betas
              x-stainless-extend-default: true
              type: array
              description: 用于指定一个或多个 Beta 版本的可选请求头。
              items:
                $ref: '#/components/schemas/AnthropicBeta'
            x-default: managed-agents-2026-04-01
        - name: vault_id
          in: path
          required: true
          schema:
            type: string
          description: 密钥库标识符。
          example: vlt_011CZkZDLs7fYzm1hXNPeRjv
        - name: credential_id
          in: path
          required: true
          schema:
            type: string
          description: 凭据标识符。
          example: vcrd_011CZkZEMt8gZan2iYOQfSkw
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsCredentialValidation'
        '400':
          description: Invalid argument - 客户端指定了无效的参数
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '401':
          description: 未认证 - 请求没有有效的认证凭据
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '403':
          description: 权限被拒绝 - 调用方没有执行指定操作的权限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '404':
          description: 未找到 - 请求的某个实体不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '408':
          description: 超出截止时间 - 截止时间在操作完成之前已过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '409':
          description: 已中止 - 该操作因并发问题而被中止
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '412':
          description: 前置条件不满足 - 由于系统未处于所需状态，操作被拒绝
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '413':
          description: Out of range - 尝试的操作超出了有效范围
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '429':
          description: 资源耗尽 - 某些资源已被耗尽（限流）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '431':
          description: 请求头字段过大 - 请求元数据过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '499':
          description: Cancelled - 操作已被客户端取消
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '500':
          description: Internal - 内部服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '501':
          description: 未实现 - 该操作未实现或不受支持
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '503':
          description: 不可用 - 服务当前不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '504':
          description: 超时 - 上游服务未及时响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
components:
  schemas:
    BetaManagedAgentsCredentialValidation:
      description: 对凭据针对其配置的 MCP 服务器进行实时探测的结果。
      type: object
      additionalProperties: false
      required:
        - type
        - credential_id
        - vault_id
        - status
        - validated_at
        - has_refresh_token
        - mcp_probe
        - refresh
      properties:
        type:
          type: string
          enum:
            - vault_credential_validation
          examples:
            - vault_credential_validation
        credential_id:
          description: 所验证凭证的唯一标识符。
          type: string
          examples:
            - vcrd_011CZkZEMt8gZan2iYOQfSkw
        vault_id:
          description: 包含该 credential 的密钥库的标识符。
          type: string
          examples:
            - vlt_011CZkZDLs7fYzm1hXNPeRjv
        status:
          description: 验证探测的总体结论。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsCredentialValidationStatus'
          examples:
            - valid
        validated_at:
          description: 执行验证探测的时间。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        has_refresh_token:
          description: 该凭证是否配置了刷新令牌。
          type: boolean
          examples:
            - true
        mcp_probe:
          description: 失败的 MCP 探测步骤的详情。探测成功时为 null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsMcpProbe'
          nullable: true
          examples:
            - null
        refresh:
          description: 在收到 401 时尝试的 refresh-令牌交换的详细信息。未尝试刷新时为 Null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRefreshObject'
          nullable: true
          examples:
            - null
      example:
        type: vault_credential_validation
        credential_id: vcrd_011CZkZEMt8gZan2iYOQfSkw
        vault_id: vlt_011CZkZDLs7fYzm1hXNPeRjv
        status: valid
        validated_at: '2026-03-15T10:00:00Z'
        has_refresh_token: true
        mcp_probe: null
        refresh: null
    BetaErrorResponse:
      properties:
        error:
          discriminator:
            mapping:
              api_error:
                $ref: '#/components/schemas/BetaAPIError'
              authentication_error:
                $ref: '#/components/schemas/BetaAuthenticationError'
              billing_error:
                $ref: '#/components/schemas/BetaBillingError'
              invalid_request_error:
                $ref: '#/components/schemas/BetaInvalidRequestError'
              not_found_error:
                $ref: '#/components/schemas/BetaNotFoundError'
              overloaded_error:
                $ref: '#/components/schemas/BetaOverloadedError'
              permission_error:
                $ref: '#/components/schemas/BetaPermissionError'
              rate_limit_error:
                $ref: '#/components/schemas/BetaRateLimitError'
              timeout_error:
                $ref: '#/components/schemas/BetaGatewayTimeoutError'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaInvalidRequestError'
            - $ref: '#/components/schemas/BetaAuthenticationError'
            - $ref: '#/components/schemas/BetaBillingError'
            - $ref: '#/components/schemas/BetaPermissionError'
            - $ref: '#/components/schemas/BetaNotFoundError'
            - $ref: '#/components/schemas/BetaRateLimitError'
            - $ref: '#/components/schemas/BetaGatewayTimeoutError'
            - $ref: '#/components/schemas/BetaAPIError'
            - $ref: '#/components/schemas/BetaOverloadedError'
          title: 错误
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: 请求 ID
        type:
          const: error
          default: error
          title: 类型
          type: string
      required:
        - error
        - request_id
        - type
      title: ErrorResponse
      type: object
    BetaManagedAgentsCredentialValidationStatus:
      type: string
      description: credential 验证探测的总体结论。
      enum:
        - valid
        - invalid
        - unknown
    BetaTimestamp:
      description: RFC 3339 格式的时间戳
      type: string
      format: date-time
    BetaManagedAgentsMcpProbe:
      description: MCP 验证探测中失败的步骤。
      type: object
      additionalProperties: false
      required:
        - method
        - http_response
      properties:
        method:
          description: 失败的 MCP 方法（例如 `initialize` 或 `tools/list`）。
          type: string
        http_response:
          description: 捕获的 HTTP 错误响应。未收到 HTTP 响应（超时、DNS、TLS）时为 Null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRefreshHttpResponse'
          nullable: true
    BetaManagedAgentsRefreshObject:
      description: 在凭据验证期间尝试进行的刷新令牌交换的结果。
      type: object
      additionalProperties: false
      required:
        - status
        - http_response
      properties:
        status:
          description: 刷新尝试的结果。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsCredentialRefreshStatus'
        http_response:
          description: 来自令牌端点的捕获 HTTP 错误响应。仅当 `status` 为 `failed` 时填充。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRefreshHttpResponse'
          nullable: true
    BetaAPIError:
      properties:
        message:
          default: Internal server error
          title: 消息
          type: string
        type:
          const: api_error
          default: api_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: APIError
      type: object
    BetaAuthenticationError:
      properties:
        message:
          default: Authentication error
          title: 消息
          type: string
        type:
          const: authentication_error
          default: authentication_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: AuthenticationError
      type: object
    BetaBillingError:
      properties:
        message:
          default: Billing error
          title: 消息
          type: string
        type:
          const: billing_error
          default: billing_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: BillingError
      type: object
    BetaInvalidRequestError:
      properties:
        message:
          default: Invalid request
          title: 消息
          type: string
        type:
          const: invalid_request_error
          default: invalid_request_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: InvalidRequestError
      type: object
    BetaNotFoundError:
      properties:
        message:
          default: Not found
          title: 消息
          type: string
        type:
          const: not_found_error
          default: not_found_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: NotFoundError
      type: object
    BetaOverloadedError:
      properties:
        message:
          default: Overloaded
          title: 消息
          type: string
        type:
          const: overloaded_error
          default: overloaded_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: OverloadedError
      type: object
    BetaPermissionError:
      properties:
        message:
          default: Permission denied
          title: 消息
          type: string
        type:
          const: permission_error
          default: permission_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: PermissionError
      type: object
    BetaRateLimitError:
      properties:
        message:
          default: Rate limited
          title: 消息
          type: string
        type:
          const: rate_limit_error
          default: rate_limit_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: RateLimitError
      type: object
    BetaGatewayTimeoutError:
      properties:
        message:
          default: Request timeout
          title: 消息
          type: string
        type:
          const: timeout_error
          default: timeout_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: GatewayTimeoutError
      type: object
    BetaManagedAgentsRefreshHttpResponse:
      description: 凭据验证探测期间捕获的 HTTP 响应。
      type: object
      additionalProperties: false
      required:
        - status_code
        - content_type
        - body
        - body_truncated
      properties:
        status_code:
          description: HTTP 状态码。
          type: integer
          format: int32
        content_type:
          description: '`Content-Type` 响应头的值。'
          type: string
        body:
          description: 响应请求体。可能被截断，且敏感值已被清除。
          type: string
        body_truncated:
          description: '`body` 是否被截断。'
          type: boolean
    BetaManagedAgentsCredentialRefreshStatus:
      type: string
      description: 在凭据验证期间尝试进行的刷新令牌交换的结果。
      enum:
        - succeeded
        - failed
        - connect_error
        - no_refresh_token
  securitySchemes:
    omaApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: OMA 工作区 API 密钥。
      x-default: sk-ant-local-default
    omaBearer:
      type: http
      scheme: bearer
      description: 以 Bearer 令牌形式发送的 OMA 工作区 API 密钥。

````