Skip to content
Get Started

Register a TOTP secret

client.v2.totp.secrets.create(SecretCreateParams { algorithm, digits, issuer, 4 more } body, RequestOptionsoptions?): SecretCreateResponse { status, totp_secret }
POST/api/v2/totp/secrets

Store an encrypted TOTP secret for your account. Agents can use this instead of a phone-based authenticator app.

Provide either:

  • A uri (the otpauth:// URI from a QR code scan), which auto-populates all fields
  • A base32 secret with optional label, issuer, algorithm, digits, and period
ParametersExpand Collapse
body: SecretCreateParams { algorithm, digits, issuer, 4 more }
algorithm?: "SHA1" | "SHA256" | "SHA512"

Hash algorithm

One of the following:
"SHA1"
"SHA256"
"SHA512"
digits?: 6 | 8

Code length

One of the following:
6
8
issuer?: string

Service name (e.g. “GitHub”, “Google”)

label?: string

Human-readable label for this secret (e.g. “GitHub - [email protected]”). Required unless uri is provided.

period?: number

Rotation period in seconds

secret?: string

Base32-encoded TOTP secret. Omit to auto-generate one.

uri?: string

Full otpauth://totp/... URI from a QR code. Overrides all other fields if provided.

ReturnsExpand Collapse
SecretCreateResponse { status, totp_secret }
status?: string
totp_secret?: TotpSecret { id, algorithm, created_at, 5 more }
id?: string

Unique identifier for this TOTP secret

formatuuid
algorithm?: "SHA1" | "SHA256" | "SHA512"

Hash algorithm used

One of the following:
"SHA1"
"SHA256"
"SHA512"
created_at?: string
digits?: number

Code length (6 or 8)

issuer?: string | null

Service name

label?: string

Human-readable label

period?: number

Rotation period in seconds

secret?: string

Base32 secret — only returned on creation, never on list/get

Register a TOTP secret

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 secret = await client.v2.totp.secrets.create();

console.log(secret.status);
{
  "status": "OK",
  "totp_secret": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "algorithm": "SHA1",
    "created_at": "2026-04-05T12:00:00Z",
    "digits": 6,
    "issuer": "GitHub",
    "label": "GitHub - [email protected]",
    "period": 30,
    "secret": "JBSWY3DPEHPK3PXP"
  }
}
Returns Examples
{
  "status": "OK",
  "totp_secret": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "algorithm": "SHA1",
    "created_at": "2026-04-05T12:00:00Z",
    "digits": 6,
    "issuer": "GitHub",
    "label": "GitHub - [email protected]",
    "period": 30,
    "secret": "JBSWY3DPEHPK3PXP"
  }
}