Close sub-account
Sub-Accounts & White-Label Retail KYC
/users/{userId}
Close sub-account
closeUsersSoft-closes/offboards a sub-account. This is a terminal state: closed sub-accounts cannot trade, receive deposits, or withdraw. The record is retained for audit, regulatory, and support purposes. Closure is blocked while the sub-account has open orders, positive holdings, or unsettled proceeds. If the USD wallet has residual cash, either withdraw it first or pass residualCashHandling: "transfer_to_partner" to atomically move the cash back to the partner master wallet during closure. Emits account.closed to registered webhooks. Requires Idempotency-Key.
Parameters
userIdstringpathRequiredExample: usr_abc123
Headers
AuthorizationstringRequiredBearer sk_sandbox_<your_key> for sandbox requests.
Idempotency-KeystringheaderRequiredUnique string that makes write calls safe to retry on network failure. Required for money movement, trading, KYC, subscriptions, and webhook creation. Deduplicated for 24 hours -- duplicate keys return the cached response. HTTP 409 if a concurrent request with the same key is still in progress.
Example: dep_user42_1743152580
Request body
residualCashHandlingrequire_zero | transfer_to_partnerHow to handle a remaining USD wallet balance. require_zero blocks closure if cash remains. transfer_to_partner atomically moves residual cash to the partner master wallet before closing.
reasonstringPartner-supplied closure reason stored for audit and support.
Example: "User requested account deletion in partner app."
Response fields
messagestringExample: "Sub-account closed. Residual cash transferred to partner master wallet."
subAccountIdstringExample: "usr_abc123"
externalIdstringExample: "user_42"
statusclosedresidualTransferUsdnumberUSD cash moved back to the partner master wallet during closure.
Example: 42.5
currencyUSDnewMasterBalancenumberPresent when residual cash was transferred.
Example: 10042.5
alreadyClosedbooleantrue when the sub-account was already closed.
Response codes
200Sub-account closed, or was already closed.409Closure blocked by open orders, positions, unsettled proceeds, or residual cash.