List, create and edit users; suspend, credit, 2FA reset and per-user history.
List users
Lists and searches users. Results are ordered by sort, then by id.
query Parameters
qCase-insensitive substring of the email or name.
statusactive (not disabled and email verified), disabled, unverified (not disabled, email not
verified) or admin. All users when absent.
sortlimitPage size (clamped to 1-200).
offsetRows to skip.
List users › Responses
A page of users.
totalUsers matching the filters.
Create a user
Creates a regular user with a password. The email is marked as verified. Only is_admin: false is
accepted: the initial admin is the only admin (403 otherwise).
Create a user › Request Body
emailStored lower-cased.
passwordnameis_adminMust be false.
balance_nanoStarting credit in nano-USD (1 USD = 1_000_000_000).
Create a user › Responses
The new user.
idemailnameis_adminis_ownerThe initial admin; can't lose the admin role or be suspended.
balance_nanoBalance in nano-USD (1 USD = 1_000_000_000); can be negative.
disabled_atSet while the account is suspended.
disabled_reasonlast_login_atmfa_enabledemail_verifiedcreated_atGet a user
Profile, usage statistics (all time and last 30 days), daily usage for the last 30 days (in the site time zone) and the top 10 models of the last 30 days.
path Parameters
idUser id.
Get a user › Responses
The user's detail.
Last 30 days in the site time zone; only days with requests.
Top 10 models of the last 30 days by cost.
Update a user
Edits a user; omitted fields are unchanged. Setting a password ends the user's other sessions and
sends a "password changed" email. The admin role can't be changed (403 if is_admin differs
from the current value).
path Parameters
idUser id.
Update a user › Request Body
emailnamepasswordNew password; at least 8 characters (10 for an admin).
is_adminCan't change; only accepted when equal to the current value.
email_verifiedtrue marks the email verified (keeps the original time if already verified); false un-verifies it.
Update a user › Responses
The updated user.
idemailnameis_adminis_ownerThe initial admin; can't lose the admin role or be suspended.
balance_nanoBalance in nano-USD (1 USD = 1_000_000_000); can be negative.
disabled_atSet while the account is suspended.
disabled_reasonlast_login_atmfa_enabledemail_verifiedcreated_atSuspend or unsuspend a user
{"disabled": true} suspends the account: the user is signed out, can't sign in, and their API keys
stop working at once (cached authentications are cleared). Nothing is deleted.
{"disabled": false} restores access and clears the reason.
The initial admin can't be suspended (403), you can't suspend yourself (400), and at least one
enabled admin must remain (400).
path Parameters
idUser id.
Suspend or unsuspend a user › Request Body
disabledtrue suspends, false unsuspends.
reasonOptional, shown to admins; trimmed and cut to 500 characters. Ignored when unsuspending.
Suspend or unsuspend a user › Responses
The user with the new status.
idemailnameis_adminis_ownerThe initial admin; can't lose the admin role or be suspended.
balance_nanoBalance in nano-USD (1 USD = 1_000_000_000); can be negative.
disabled_atSet while the account is suspended.
disabled_reasonlast_login_atmfa_enabledemail_verifiedcreated_atAdd or deduct credit
Changes the user's balance by delta_nano (positive grants, negative deducts; the balance may go
below zero). Recorded in the audit log and the user's balance history.
path Parameters
idUser id.
Add or deduct credit › Request Body
delta_nanoSigned amount in nano-USD (1 USD = 1_000_000_000). Can't be zero.
noteShown in the balance history (e.g. "refund"); trimmed and cut to 200 characters.
Add or deduct credit › Responses
The new balance.
balance_nanoNew balance in nano-USD.
Reset two-factor authentication
Turns the user's 2FA off (e.g. lost phone and recovery codes), ends their sessions and emails them.
An admin is asked to set 2FA up again at their next sign-in. 400 if 2FA isn't on.
path Parameters
idUser id.
Reset two-factor authentication › Responses
2FA is off.
mfa_enabledList a user's top-ups
The user's top-up requests in every status, newest first.
path Parameters
idUser id.
query Parameters
limitPage size (clamped to 1-200).
offsetRows to skip.
List a user's top-ups › Responses
A page of top-ups.
totalGet a user's balance history
Every change to the balance, newest first: paid top-ups, coupon redemptions, affiliate rewards, admin credit and starting balance (from the audit log), and usage as one row per day.
path Parameters
idUser id.
query Parameters
limitPage size (clamped to 1-200).
offsetRows to skip.
Get a user's balance history › Responses
A page of balance changes.
totalList a user's API keys
All of the user's API keys, revoked ones included (active first, then newest; at most 200). Secrets are never returned.
path Parameters
idUser id.
List a user's API keys › Responses
The keys (not paginated).
idnamekey_prefixMasked display form, e.g. sk-****-a1b2.
credit_limit_nanoSpending limit in nano-USD; null for none.
usage_nanoSpend so far, nano-USD.
allowed_modelsexpires_atallowed_ipsredact_secretslast_used_atrevoked_atcreated_atList a user's recent requests
The user's AI requests, newest first (metadata only). Use GET /logs?user= for filters.
path Parameters
idUser id.
query Parameters
limitPage size (clamped to 1-200).
offsetRows to skip.
List a user's recent requests › Responses
A page of requests.
totalList a user's activity
The user's audit timeline, newest first: what they did (sign-ins, keys, top-ups) and what was done to their account (credit, suspension, edits).
path Parameters
idUser id.
query Parameters
limitoffsetRows to skip.
List a user's activity › Responses
A page of audit entries.
total