V2 Integrator API
Prepare Liquidate-All (Stage 1)
Stage 1 of the two-stage liquidate-all flow — enumerates every holding on the recipient’s chain above the swap threshold and returns the authorization to swap them all to the chosen settlement asset (USDC, or USDT on EVM).
POST
Stage 1 of the two-stage liquidate-all flow. Reads the portfolio’s live
positions on the recipient’s chain, selects every holding whose value is above
the tenant’s swap threshold, and returns a signable authorization that swaps
them all to a settlement asset and delivers it to
recipientAccountId.
Stage 2 (POST /v2/portfolios/{portfolioId}/liquidate-all) submits the signed
authorization.
This is the whole-portfolio counterpart of
POST .../withdraw/signature with liquidate: true
— you don’t list assets; the server enumerates them. The signed message it
returns is a standard withdrawal authorization with liquidate: true, so it
behaves identically at stage 2.
- Auth:
x-api-keyheader (required) - Scope:
portfolios:withdraw - Chains: EVM and Solana (Solana requires the tenant’s Solana B2B API
access — without it, a Solana recipient returns
403).
recipientAccountId is a chain-bound CAIP-10
identifier — eip155:<chainId>:<address> (EVM) or
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp:<base58> (Solana). Liquidation is
scoped to that one chain — holdings on other chains are untouched. To
liquidate a multi-chain portfolio fully, call this once per chain.
The shape of the returned authorization matches the withdraw flow: EVM
portfolios receive an EIP-712 typed-data object under data.typedData; Solana
portfolios receive an off-chain authorization under data.authorization
(kind: "ecdsa" — EVM-rooted owner, sign raw via EIP-191 personal_sign;
kind: "solana-message" — Solana-rooted owner, sign text via ed25519). See
Prepare Withdrawal for the signing details.
Settlement asset
By default every holding is swapped to USDC on the recipient’s chain. Pass an optionalsettlementAssetId (CAIP-19, on the same chain as recipientAccountId)
to choose the settlement asset — USDC (every liquidation chain) or USDT
(EVM chains where it’s configured; not available on Solana). Any asset that
isn’t an allowed settlement asset on the chain returns
400 API_221 UNSUPPORTED_SETTLEMENT_ASSET. The chosen asset is bound into
the signed message.
On Solana the proceeds are swapped inside the portfolio’s smart account and
delivered to the recipient in one engine operation; native SOL positions are
liquidated too (a small rent reserve stays behind so the account remains
rent-exempt).
Ondo tokenized stocks (TSLAon, SPCXon, …) redeem through Ondo directly
and settle only in the chain’s Ondo cash asset — USDT on BNB Chain (56),
USDC on Ethereum (1). If the portfolio holds Ondo tokens and the requested
settlement asset doesn’t match, this endpoint rejects with
400 API_221 UNSUPPORTED_SETTLEMENT_ASSET before anything is signed. See the
stage-2 notes
for market-hours behavior.
Best-effort empty
Holdings whose value is below the tenant swap threshold (or that have no swap route) are left in the vault — forcing uneconomical swaps would lose more to gas than they recover. The portfolio is emptied of everything worth swapping, not necessarily down to zero. If nothing clears the threshold, the call returns400 API_220 NOTHING_TO_LIQUIDATE.
The authorization is valid for 10 minutes and, like all withdrawals, binds
the portfolio, recipient, the enumerated assets + amounts, the nonce, and the
expiry into the user’s signature.
Common error responses:
400 API_211 INVALID_RECIPIENT— zero address or a self-transfer to the smart account being debited.400 API_215 PORTFOLIO_HAS_NO_VAULT_ON_CHAIN— portfolio has no smart account on the recipient’s chain.400 API_219 WITHDRAW_AS_USDC_UNSUPPORTED_CHAIN— the recipient’s chain has no canonical USDC to swap into (the default settlement asset).400 API_221 UNSUPPORTED_SETTLEMENT_ASSET—settlementAssetIdis not an allowed settlement asset on the chain (must be that chain’s USDC or USDT).400 API_220 NOTHING_TO_LIQUIDATE— no holding on the chain clears the swap threshold.401whenx-api-keyis missing or invalid.403when the API key lacks theportfolios:withdrawscope, or the recipient is Solana and the tenant’s Solana B2B API access is not enabled.404 API_200 PORTFOLIO_NOT_FOUND—portfolioIddoesn’t exist or belongs to a different tenant.500on unexpected server errors.