Version 2.1.1792967583 · latest Download OpenAPI Markdown

Users

Admins manage platform accounts: create, view, update, enable/disable, reset passwords, turn off TOTP. An account must be disabled before it can be deleted.

usersUser accountsAuthentication: Admin only13 endpoints

List users

GET/api/v2/users
Authentication: Admin only

Query parameters

FieldTypeRequiredDescription
pageinteger— Page number, starting from 1
Default 1
page_sizeinteger— Items per page
Default 20
sortstring— Sort fields, comma-separated; prefix `-` for descending, e.g. `-created_at,id`
idsstring— Only list these IDs: comma-separated positive integers, at most 200 after deduplication (same as the page_size limit; more returns 400); an empty value is the same as omitting it. Combined with other filters as an intersection; IDs you cannot see are silently left out. Pagination is unchanged: set page_size to at least the number of IDs to get them in one page
emailstring— Email
phonestring— Phone number
usernamestring— Username

Create user

POST/api/v2/users
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
emailstring— Email
enabledboolean— Whether enabled
login_ip_allowstring[]— Login IP allowlist (IPs or CIDRs); empty means no restriction
login_verifyLoginVerify— Second-factor login: none means not required; email / sms also require an email/SMS code at login (the platform must allow it and the address must be bound)
Values ["none","email","sms"]
passwordstring— Required on create; on update, providing it resets the password and revokes all sessions of the user
phonestring— Phone number
rolestring— Account role: admin or tenant
Values ["admin","tenant"]
totp_enabledboolean— Whether TOTP is enabled
usernamestringRequired Username

Batch enable, disable or delete users

POST/api/v2/users/batch
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
actionstringRequired enable, disable or delete.
Values ["enable","disable","delete"]
idsinteger[]Required User IDs to operate on, 1 to 100 per call.

Get user

GET/api/v2/users/{id}
Authentication: Admin only

Update user

PUT/api/v2/users/{id}
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
emailstring— Email
enabledboolean— Whether enabled
login_ip_allowstring[]— Login IP allowlist (IPs or CIDRs); empty means no restriction
login_verifyLoginVerify— Second-factor login: none means not required; email / sms also require an email/SMS code at login (the platform must allow it and the address must be bound)
Values ["none","email","sms"]
passwordstring— Required on create; on update, providing it resets the password and revokes all sessions of the user
phonestring— Phone number
rolestring— Account role: admin or tenant
Values ["admin","tenant"]
totp_enabledboolean— Whether TOTP is enabled
usernamestringRequired Username

Delete user

DELETE/api/v2/users/{id}
Authentication: Admin only

Get user account

GET/api/v2/users/{user_id}/account
Authentication: Admin only

Freeze or unfreeze user account

PUT/api/v2/users/{user_id}/account
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
freeze_reasonstring— Freeze reason; empty if not frozen.
frozenbooleanRequired Whether the account is frozen; deductions are rejected while frozen.

List a user's API keys

GET/api/v2/users/{user_id}/api-keys
Authentication: Admin only

Query parameters

FieldTypeRequiredDescription
pageinteger— Page number, starting from 1
Default 1
page_sizeinteger— Items per page
Default 20
sortstring— Sort fields, comma-separated; prefix `-` for descending, e.g. `-created_at,id`

Create an API key for a user

POST/api/v2/users/{user_id}/api-keys
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
allow_ipsApiKeyAllowIps— Caller IP allowlist (single IPs only, at most 200); empty means no restriction. Calls from other IPs get 401 as invalid credentials
expires_atstring— Expires at
namestringRequired Name
scopesstring[]Required Granted scopes, same values as scopes at creation

Update a user's API key IP allowlist or reset it

PUT/api/v2/users/{user_id}/api-keys/{id}
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
allow_ipsApiKeyAllowIps— Caller IP allowlist (single IPs only, at most 200); empty means no restriction. Calls from other IPs get 401 as invalid credentials
resetboolean— When true, issue a new key; the old one stops working at once

Delete a user's API key

DELETE/api/v2/users/{user_id}/api-keys/{id}
Authentication: Admin only

Recharge or deduct user balance

POST/api/v2/users/{user_id}/recharges
Authentication: Admin only

Request body application/json

FieldTypeRequiredDescription
amount_centsintegerRequired Amount in cents; must be a positive integer.
directionstring— credit = recharge (default), debit = deduct.
Values ["credit","debit"]Default "credit"
remarkstring— Remark

Users object

FieldTypeRequiredDescription
actionstringRequired enable, disable or delete.
Values ["enable","disable","delete"]
affectedinteger— Number of users processed.
allow_ipsApiKeyAllowIps— Caller IP allowlist (single IPs only, at most 200); empty means no restriction. Calls from other IPs get 401 as invalid credentials
amount_centsintegerRequired Amount in cents; must be a positive integer.
archivedboolean— Moved into the archive table by the archiving task (read-only).
balance_centsinteger— Account balance in cents, same as balance_cents of GET /users/{user_id}/account (0 when there is no account). Only present in the GET /users list, not in single-user responses
read-only
certifiedboolean— Whether real-name verification has passed
client_ipstring— Source IP of this request, derived the same way as the login IP allowlist check (what the allowlist compares is what is shown). Only present in GET /me and PUT /me
read-only
created_atstring— Created at
read-only
dataobject— Extra data (such as package purchase details).
delegated_sessionboolean— Whether the current session was issued by superadmin sign-in or switch-to-user (if so, password, email, phone, login allowlist, login verification and real-name are read-only). Only present in GET /me and PUT /me
read-only
desstring— Description
directionstring— credit = recharge (default), debit = deduct.
Values ["credit","debit"]Default "credit"
emailstring— Email
enabledboolean— Whether enabled
expires_atstring— Expires at
freeze_reasonstring— Freeze reason; empty if not frozen.
frozenboolean— Whether the account is frozen; deductions are rejected while frozen.
idinteger— Record ID
read-only
idsinteger[]Required User IDs to operate on, 1 to 100 per call.
last_used_atstring— Time of last use; null if never used
ledger_idinteger— ID of the linked ledger entry; null if none.
login_ip_allowstring[]— Login IP allowlist (IPs or CIDRs); empty means no restriction
login_verifyLoginVerify— Second-factor login: none means not required; email / sms also require an email/SMS code at login (the platform must allow it and the address must be bound)
Values ["none","email","sms"]
mch_order_nostring— Merchant order number (the gateway-side order number); null for non-online payments.
namestring— Name
paid_atstring— Payment time; null if unpaid.
passwordstring— Required on create; on update, providing it resets the password and revokes all sessions of the user
pay_typestring— admin/balance/alipay/wxpay, etc.; empty = unpaid.
phonestring— Phone number
prefixstring— First few characters of the plaintext key, for recognition
remarkstring— Remark
resetboolean— When true, issue a new key; the old one stops working at once
rolestring— Account role: admin or tenant
Values ["admin","tenant"]
scopesstring[]— Granted scopes, same values as scopes at creation
secretstring— Plaintext key (the X-API-Key value), returned only once at creation; only a hash is stored
statusstring— Order status: unpaid or paid.
Values ["unpaid","paid"]
tenant_idinteger— Owner tenant (user) ID
read-only
totp_enabledboolean— Whether TOTP is enabled
totp_recovery_leftinteger— Number of unused TOTP recovery codes. Only present in GET /me and PUT /me when TOTP is enabled
read-only
transaction_idstring— Gateway-side transaction ID; empty if unpaid.
typestring— recharge (admin recharge) / deduct (admin deduction) / payment (online payment) / package (package purchase), etc.
updated_atstring— Updated at
read-only
user_idinteger— User ID
usernamestring— Username