SumoRouter
SumoRouter Customer API

Account

Server

The signed-in user's profile, password, two-factor authentication and notification preferences.


Get the signed-in user

GET
https://ai.brandkamu.id
/api/me

Profile, admin flag, credit balance and sign-in methods of the session's user.

Get the signed-in user › Responses

The user.

id
​string · uuid · required
email
​string · email · required
name
​string · required
is_admin
​boolean · required
balance_nano
​integer · int64 · required

Credit balance in nano-USD (1 USD = 1,000,000,000). Includes credit currently reserved by in-flight requests as already spent.

mfa_enabled
​boolean · required

Two-factor authentication is set up.

has_password
​boolean · required

Can sign in with a password (Google-only accounts can't).

google_linked
​boolean · required
created_at
​string · date-time · required

Update the display name

PUT
https://ai.brandkamu.id
/api/me/profile

Changes the display name (up to 80 characters, no control characters). The email can't be changed.

Update the display name › Request Body

name
​string · maxLength: 80 · required

Update the display name › Responses

The saved (trimmed) name.

name
​string · required

Change the password

POST
https://ai.brandkamu.id
/api/me/password

Requires the current password. The new one must be at least 8 characters (10 for admins) and different. All other sessions end; the response carries a new session token for this client (keeping its 2FA state) — replace the stored token. Google-only accounts (no password) get 400 and should use forgot-password to add one. Limited to 5 attempts per minute.

Change the password › Request Body

current_password
​string · required
new_password
​string · minLength: 8 · required

Change the password › Responses

New session token.

token
​string · required

Session token (JWT, valid 7 days). Send as Authorization: Bearer <token>.


Get notification preferences

GET
https://ai.brandkamu.id
/api/me/notifications

Low-balance email alert settings.

Get notification preferences › Responses

Preferences.

low_balance_alert
​boolean · required
low_balance_threshold_nano
​integer | null · int64 · required

Custom threshold in nano-USD; null uses the default.

default_threshold_nano
​integer · int64 · required

The default threshold (1 USD = 1000000000).


Update notification preferences

PUT
https://ai.brandkamu.id
/api/me/notifications

Turns the low-balance email alert on or off and sets its threshold (nano-USD, 0 to 10,000 USD; null uses the default of 1 USD). Saving starts a fresh alert cycle.

Update notification preferences › Request Body

low_balance_alert
​boolean · required
low_balance_threshold_nano
​integer | null · int64 · min: 0 · max: 10000000000000

Threshold in nano-USD; null = default.

Update notification preferences › Responses

Saved preferences.

low_balance_alert
​boolean · required
low_balance_threshold_nano
​integer | null · int64 · required

Custom threshold in nano-USD; null uses the default.

default_threshold_nano
​integer · int64 · required

The default threshold (1 USD = 1000000000).


Start turning on two-factor authentication

POST
https://ai.brandkamu.id
/api/me/mfa/setup

Returns a new TOTP secret (the same one again while it is pending, for 15 minutes). Confirm with POST /api/me/mfa/enable. 400 if 2FA is already on.

Start turning on two-factor authentication › Responses

Enrolment details.

secret
​string · required

Base32 secret in groups of 4 characters, for manual entry.

otpauth_uri
​string · required

otpauth://totp/… URI.

qr_svg
​string · required

SVG markup of the QR code for otpauth_uri.

account
​string · required

The user's email.

issuer
​string · required

The site name.


Confirm and turn on two-factor authentication

POST
https://ai.brandkamu.id
/api/me/mfa/enable

Confirms the pending secret with a current 6-digit code. 2FA turns on, all other sessions end, and the response carries the recovery codes (shown once) and a new session token to replace the stored one. Limited to 10 attempts per minute.

Confirm and turn on two-factor authentication › Request Body

code
​string · required

6-digit authenticator code (or a recovery code where accepted).

Confirm and turn on two-factor authentication › Responses

2FA is on.

recovery_codes
​string[] · required
token
​string · required

New session token (JWT).


Turn off two-factor authentication

POST
https://ai.brandkamu.id
/api/me/mfa/disable

Needs a current code or a recovery code. Not allowed for admins (403, 2FA is required for them). All other sessions end; the response carries a new session token. Limited to 10 attempts per minute.

Turn off two-factor authentication › Request Body

code
​string · required

6-digit authenticator code (or a recovery code where accepted).

Turn off two-factor authentication › Responses

2FA is off.

token
​string · required

Session token (JWT, valid 7 days). Send as Authorization: Bearer <token>.


Regenerate 2FA recovery codes

POST
https://ai.brandkamu.id
/api/me/mfa/recovery-codes

Issues new recovery codes (the old ones stop working). Needs a current 6-digit authenticator code. Limited to 10 attempts per minute.

Regenerate 2FA recovery codes › Request Body

code
​string · required

6-digit authenticator code (or a recovery code where accepted).

Regenerate 2FA recovery codes › Responses

The new codes, shown once.

recovery_codes
​string[] · required