Get current TOTP code
client.v2.totp.getCode(stringsecretID, RequestOptionsoptions?): TotpGetCodeResponse { code, expires_in, status }
GET/api/v2/totp/code/{secret_id}
Generate the current 6- or 8-digit TOTP code for a stored secret, along with how many seconds remain until it rotates.
Get current TOTP code
import SendblueAPI from 'sendblue';
const client = new SendblueAPI({
apiKey: process.env['SENDBLUE_API_API_KEY'], // This is the default and can be omitted
apiSecret: process.env['SENDBLUE_API_API_SECRET'], // This is the default and can be omitted
});
const response = await client.v2.totp.getCode('550e8400-e29b-41d4-a716-446655440000');
console.log(response.code);{
"code": "482031",
"expires_in": 14,
"status": "OK"
}Returns Examples
{
"code": "482031",
"expires_in": 14,
"status": "OK"
}