A vault groups the credentials an agent uses on a session. You create vaults and credentials once, then name the vaults when you create a session (vault_ids). Secret values are write-only: no response ever returns them. Every request carries the API key and the workspace header: x-api-key: $BMA_API_KEY and bma-workspace-id: $BMA_PROJECT_ID.

Create a vault

GET /v1/vaults, GET|POST /v1/vaults/{vault_id} (retrieve, update) and POST /v1/vaults/{vault_id}/archive complete the lifecycle.

Add a credential

POST /v1/vaults/{vault_id}/credentials takes an auth object whose type is one of: networking is either {"type": "unrestricted"} or {"type": "limited", "allowed_hosts": [...]} (1 to 16 bare hostnames, IPv4 addresses or *. wildcards): the secret is only substituted into requests to those hosts. injection_location chooses whether the value is injected into request headers, bodies, or both (default: header only; at least one must be on). Update a credential with POST /v1/vaults/{vault_id}/credentials/{credential_id}. For mcp_oauth, expires_at and refresh can change only together with a new access_token. Archive it with POST …/archive.

Validate an MCP OAuth credential

POST /v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate probes the MCP server live (initialize, tools/list). A 401 with a stored refresh token refreshes the access token and probes again. Only mcp_oauth credentials that are not archived can be validated; anything else answers 400.

Use a vault

Pass the vault ids when you create a session; the session’s tools use the vault’s credentials. See MCP for how MCP servers pick a credential, and Errors for the error codes.