AnthropicClaude Managed Agents

Create Credential

Store one third-party credential in a vault (for example an OAuth token for an MCP service).

POST /anthropic/v1/vaults/{vault_id}/credentials◐ Partial

Request parameters

  • vault_idstring必填

    path: Vault ID (path or query parameter).

  • authobject必填

    Authentication details for creating a credential.

    ▸ 展开子字段(10)
    • access_tokenstring必填

      OAuth access token.

    • mcp_server_urlstring必填

      URL of the MCP server this credential authenticates against.

    • typestring必填
      取值 environment_variable
    • expires_atstring可选

      A timestamp in RFC 3339 format

    • refreshobject可选

      OAuth refresh token parameters for creating a credential with refresh support.

    • tokenstring必填

      Static bearer token value.

    • networkingobject必填

      Outbound hosts the secret value is substituted on.

    • secret_namestring必填

      Name of the environment variable. Immutable after create.

    • secret_valuestring必填

      Secret value. Write-only; never returned in responses.

    • injection_locationobject可选

      Where in the outbound request the secret value may be substituted.

  • display_namestring可选

    Human-readable name for the credential. Up to 255 characters.

  • metadataobject可选

    Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

Returns

200

Supports environment_variable and static_bearer. environment_variable networking supports limited only; unrestricted returns 400. secret_name may contain only uppercase letters, digits and underscores and cannot start with a digit. injection_location defaults match the official API. A static_bearer token is usable only on the host of its mcp_server_url. Creating or updating mcp_oauth returns 501 (not_implemented_error), produces no side effects, and the official SDK does not retry; use one-click authorization at /vault/v1/authorizations for OAuth tokens. A vault holds at most 20 active credentials. Metadata keys starting with anthropic. are reserved and cannot be written.

Errors follow the Claude Managed Agents format — see error codes

Response

HTTP 200

Successful response

application/json

NameTypeDescription
idstringUnique identifier for the credential.
archived_atnull | stringA timestamp in RFC 3339 format
authobjectAuthentication details for a credential.
auth.mcp_server_urlstringURL of the MCP server this credential authenticates against.
auth.typestring
auth.expires_atnull | stringA timestamp in RFC 3339 format
auth.refreshnull | objectOAuth refresh token configuration returned in credential responses.
auth.injection_locationobjectWhere in the outbound request the secret value is substituted.
auth.networkingobjectOutbound hosts the secret value is substituted on.
auth.secret_namestringName of the environment variable.
created_atstringA timestamp in RFC 3339 format
metadataobjectArbitrary key-value metadata attached to the credential.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idstringIdentifier of the vault this credential belongs to.
display_namenull | stringHuman-readable name for the credential.

MCP OAuth creation limit

The example above creates an environment_variable credential. Creating mcp_oauth still returns 501 without creating a credential; updating an existing mcp_oauth credential is also unsupported. This is the captured creation error.

{
  "type": "error",
  "error": {
    "type": "not_implemented_error",
    "message": "Not implemented: creating mcp_oauth credentials is not available on this platform yet; use static_bearer or environment_variable."
  },
  "request_id": "4c1dcdba-97bb-46ce-aad0-0a7d8753357c"
}