API ReferenceVault
Store Credential
Store or update a credential in the vault
Scope: vault:write
Creates or updates a credential. If a credential with the same name exists, it's overwritten.
Request
curl -X PUT https://api.loomal.ai/v0/vault/stripe \
-H "Authorization: Bearer mgent-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"type": "API_KEY",
"data": { "key": "sk_live_abc123..." },
"metadata": { "service": "stripe", "prefix": "sk_live_...c123" }
}'Body
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | One of: LOGIN, API_KEY, OAUTH, TOTP, SSH_KEY, DATABASE, SMTP, AWS, CERTIFICATE, CUSTOM |
data | object | Yes | Secret fields (encrypted at rest) |
metadata | object | No | Non-secret fields (stored as plaintext for display) |
expiresAt | string | No | Expiry date (ISO 8601) |
Response
{
"credentialId": "cred_abc123",
"type": "API_KEY",
"name": "stripe",
"metadata": { "service": "stripe", "prefix": "sk_live_...c123" },
"expiresAt": null,
"createdAt": "2026-03-29T03:00:00Z"
}Examples
Store a login
curl -X PUT https://api.loomal.ai/v0/vault/github \
-H "Authorization: Bearer mgent-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"type": "LOGIN",
"data": { "password": "s3cret!" },
"metadata": { "uri": "https://github.com", "username": "agent-bot" }
}'Store a TOTP secret
curl -X PUT https://api.loomal.ai/v0/vault/github-2fa \
-H "Authorization: Bearer mgent-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"type": "TOTP",
"data": { "secret": "JBSWY3DPEHPK3PXP" },
"metadata": { "issuer": "GitHub", "account": "agent-bot" }
}'