API ReferenceVault
Get TOTP Code
Generate a 6-digit TOTP code from a stored credential
Scope: vault:read
Returns the current TOTP code and seconds remaining. The secret is never exposed.
Request
curl https://api.loomal.ai/v0/vault/github-2fa/totp \
-H "Authorization: Bearer mgent-your-api-key"Response
{
"code": "482916",
"remaining": 18
}| Field | Type | Description |
|---|---|---|
code | string | Current 6-digit TOTP code |
remaining | number | Seconds until code rotates |
Errors
{
"error": "bad_request",
"message": "No TOTP secret found on this credential",
"status": 400
}The credential must have a secret field (for TOTP type) or a totp field (for any type with TOTP attached).