Skip to content
中文

Create Credential

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

Request parameters

  • vault_idstringrequired

    path: Vault ID (path or query parameter).

  • authobjectrequired

    Authentication details for creating a credential.

    Expand sub-fields (10)
    • access_tokenstringoptional

      OAuth access token. Required when type is mcp_oauth. Not used when type is static_bearer, environment_variable.

    • mcp_server_urlstringoptional

      URL of the MCP server this credential authenticates against. Required when type is mcp_oauth, static_bearer. Not used when type is environment_variable.

    • typestringrequired
      values mcp_oauthstatic_bearerenvironment_variable
    • expires_atstringoptional

      A timestamp in RFC 3339 format Not used when type is static_bearer, environment_variable.

    • refreshobjectoptional

      OAuth refresh token parameters for creating a credential with refresh support. Not used when type is static_bearer, environment_variable.

    • tokenstringoptional

      Static bearer token value. Required when type is static_bearer. Not used when type is mcp_oauth, environment_variable.

    • networkingobjectoptional

      Outbound hosts the secret value is substituted on. Required when type is environment_variable. Not used when type is mcp_oauth, static_bearer.

    • secret_namestringoptional

      Name of the environment variable. Immutable after create. Required when type is environment_variable. Not used when type is mcp_oauth, static_bearer.

    • secret_valuestringoptional

      Secret value. Write-only; never returned in responses. Required when type is environment_variable. Not used when type is mcp_oauth, static_bearer.

    • injection_locationobjectoptional

      Where in the outbound request the secret value may be substituted. Not used when type is mcp_oauth, static_bearer.

  • display_namestringoptional

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

  • metadataobjectoptional

    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

Request

curl
curl https://api.deepraxis.com/anthropic/v1/vaults/vlt_123/credentials \
  -H "x-api-key: $PRAXIS_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: managed-agents-2026-04-01" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"walk-vault-r1-docs2-credential","auth":{"type":"environment_variable","secret_name":"GITHUB_TOKEN","secret_value":"ghp_example","networking":{"type":"limited","allowed_hosts":["api.github.com"]}}}'
Python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.deepraxis.com/anthropic",
    api_key="$PRAXIS_API_KEY",
)

result = client.beta.vaults.credentials.create("vlt_123", display_name='walk-vault-r1-docs2-credential', auth={'type': 'environment_variable', 'secret_name': 'GITHUB_TOKEN', 'secret_value': 'ghp_example', 'networking': {'type': 'limited', 'allowed_hosts': ['api.github.com']}})
print(result)
TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.deepraxis.com/anthropic",
  apiKey: "$PRAXIS_API_KEY",
});

const result = await client.beta.vaults.credentials.create("vlt_123", {
  "display_name": "walk-vault-r1-docs2-credential",
  "auth": {
    "type": "environment_variable",
    "secret_name": "GITHUB_TOKEN",
    "secret_value": "ghp_example",
    "networking": {
      "type": "limited",
      "allowed_hosts": [
        "api.github.com"
      ]
    }
  }
});
console.log(result);

Response 200

{
  "id": "vsec_33fbcd3aebec462da14c6aba91a66219",
  "type": "vault_credential",
  "vault_id": "vlt_95e96f6f23dd406595834f2951239d55",
  "display_name": "walk-vault-r1-docs2-credential",
  "metadata": {},
  "auth": {
    "type": "environment_variable",
    "secret_name": "GITHUB_TOKEN",
    "networking": {
      "type": "limited",
      "allowed_hosts": [
        "api.github.com"
      ]
    },
    "injection_location": {
      "header": true,
      "body": true
    }
  },
  "created_at": "2026-10-12T11:36:10.622Z",
  "updated_at": "2026-10-12T11:36:10.622Z",
  "archived_at": null
}

Response

HTTP 200

Successful response

application/json

Name Type Description
id string Unique identifier for the credential.
archived_at null | string A timestamp in RFC 3339 format
auth object Authentication details for a credential.
auth.mcp_server_url string URL of the MCP server this credential authenticates against.
auth.type string
auth.expires_at null | string A timestamp in RFC 3339 format
auth.refresh null | object OAuth refresh token configuration returned in credential responses.
auth.injection_location object Where in the outbound request the secret value is substituted.
auth.networking object Outbound hosts the secret value is substituted on.
auth.secret_name string Name of the environment variable.
created_at string A timestamp in RFC 3339 format
metadata object Arbitrary key-value metadata attached to the credential.
type string
updated_at string A timestamp in RFC 3339 format
vault_id string Identifier of the vault this credential belongs to.
display_name null | string Human-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"
}