400 if there is insufficient balance for the token. Every request except the commit needs a signature - see Signing.
Lending endpoints are namespaced under
/borrow in the API - the paths are the API’s own names, and the flow is the one described here.Open a Position
1
Get a one-time wallet for the position
POST /borrow/smart-wallet
Response
protocol_label is free-form text identifying the provider this position belongs to - any lending provider works, since your instructions are passed through unchanged. Store smart_wallet_id against the position: every later call identifies it by that, and the wallet is provisioned once, not per action.2
Build your instructions
Assemble your own deposit or open instructions into a single unsigned transaction, with the wallet
address as the signer and fee payer. Base64-encode it as main_tx.Vanish appends its own instruction, signs the result, and simulates it before returning. A transaction that fails simulation is rejected rather than submitted.3
Open the position
POST /borrow/initiate
Response
transaction for you to broadcast, or - if it is too large - a two-transaction Jito bundle Vanish submits itself, in which case transaction is null and jito_bundle_id is set.4
Broadcast if needed, then commit
Broadcast The funds now sit in the one-time wallet and the position is open. Advancing more into the same position repeats these steps with the same
transaction if it is non-null; if jito_bundle_id is set instead, Vanish has already submitted it. Then commit either way:POST /borrow/commit
Response
smart_wallet_id.Settle
Settling returns the advanced funds to Vanish’s trading accounts, wrapped around your own withdraw or close instructions. Check Position State first.1
Settle the position
Build
main_tx exactly as when opening - unsigned, with the position’s one-time wallet as signer - using your close instructions.POST /borrow/settle
Settle always returns a signed
transaction and jito_bundle_id is always null - there is no bundle route here, so you always broadcast it yourself.2
Broadcast and commit
POST /borrow/commit
action_type set to settle. Once a settle with cleanup_leftover_sol is committed, the position’s status becomes closed.Position State
POST /borrow/positions returns every one-time wallet a user holds a position in, with balances read live from chain. It is read-only.
Response
status is open until a settle with cleanup_leftover_sol is committed. Filter on has_active_balance rather than a dust threshold of your own - it is true only when the wallet holds a non-SOL token with a positive balance.
If the on-chain balance lookup fails for a wallet, its
balances comes back as an empty array rather than the whole call failing. Treat an empty list as unknown, not as a confirmed zero balance.Next Steps
- Trading - Execute a private swap against a funded balance.
- Error Handling - Commit statuses and recovering interrupted flows.
