Skip to main content
Lending advances funds from Vanish’s trading accounts into a one-time wallet and runs your own instructions against them in the same transaction - deploying into any lending provider you choose. Unlike a trade, the wallet is reused for the life of the position. A position is opened, then settled when you are done. There is no deposit step of its own - the funds are advanced by Vanish. Initiate still validates balances before it signs anything, and rejects with a 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
Vanish picks the route by transaction size: a signed 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 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
/borrow/commit must be called for every lending action - success, failure, or expiry. Until it is, the action stays in a pending state. Lending returns the same statuses as a trade except rejected, which applies to deposits only - see Commit Status.
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 smart_wallet_id.
Reference: Create One-Time Wallet · Open Position · Commit Lending Action

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
The response matches the commit above with action_type set to settle. Once a settle with cleanup_leftover_sol is committed, the position’s status becomes closed.
Reference: Settle Position · Commit Lending Action

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.
Reference: Get Positions · Get Pending Lending Actions

Next Steps

  • Trading - Execute a private swap against a funded balance.
  • Error Handling - Commit statuses and recovering interrupted flows.