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 EIP-712 authorization to swap them all to USDC.
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 an EIP-712 typed-data authorization
that swaps them all to USDC and delivers the USDC 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 - EVM only.
recipientAccountId is a chain-bound CAIP-10
identifier (eip155:<chainId>:<address>). 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.
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.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.404 API_200 PORTFOLIO_NOT_FOUND—portfolioIddoesn’t exist or belongs to a different tenant.500on unexpected server errors.