Skip to main content
Each venue keeps its own balance: USDC in Hyperliquid spot, pUSD on Polymarket, and USD on Kalshi and Polymarket US. GET /v1/balances shows them all. Lean routes an order to the venues that can pay for it, so fund the venues you want orders to reach. Deposits, withdrawals and transfers through Lean cover Polymarket and Hyperliquid only. Fund your Kalshi and Polymarket US accounts on those venues directly. A test key needs no funding. It trades against simulated balances. See Test mode and live mode.

Deposit through Lean’s addresses only

Send funds only to the deposit addresses Lean gives the trading account. Each address bridges into the right balance for you: Supported assets include USDC, USDT, ETH and DAI on Polygon, Base, Arbitrum, Optimism, Ethereum, BSC and Solana. The Polymarket bridge sets a minimum deposit per asset, and a deposit below it may not be credited. Relay publishes no fixed minimum for Hyperliquid deposits, and neither does a pUSD transfer straight to the Polymarket wallet.
Never send funds to Hyperliquid’s own bridge. A deposit there lands in Hyperliquid perps, not in spot where Lean’s orders trade, so it is not available to the API.

Network fees

A deposit is an ordinary token transfer: the sender pays that network’s usual fee. After that, you need no gas. Hyperliquid orders are signed actions with no gas, and Polymarket actions are paid for by Polymarket’s relayer.

Deposits through the API

Withdrawals through the API

A key can withdraw only when it was created for it. Create the key in the Lean app under Settings, API keys, or with Create an API key, and send:
  • scopes with withdraw. A key without it is refused with 403 FORBIDDEN. The withdraw scope is separate from trade, so a key that trades cannot withdraw unless you add it.
  • maxWithdrawalMicros, the largest single withdrawal, and dailyWithdrawalLimitMicros, the total the key may withdraw in any rolling 24 hours. Both are optional and in millionths of a dollar. Leave one out for no limit of that kind. When you set both, the daily limit must be at least the single one.
A withdrawal names where the money comes from, where it goes and how much moves:
  • source is the venue and the asset held there.
  • destination is the chain, the asset and the address paid.
  • amount is how much of the source asset leaves the venue.
Each venue pays out USDC, on any of the chains the Lean app withdraws to: destination.chain is one of polygon, arbitrum, base, optimism, ethereum, bsc or solana. The address must suit the chain: a 0x address for every chain except solana, which takes a Solana address. Any other pair, or an address the chain cannot take, is refused with 400 VALIDATION_ERROR, and the message says what is supported. A live withdrawal sends real funds:
  • The venue’s fee comes out of the amount. The response gives fee and net_amount, the amount the destination is quoted to receive. Both come from the venue’s quote when the withdrawal is made, so the amount that arrives can differ slightly.
  • The account must have trading enabled. Creating a live key that can trade or withdraw in the Lean app enables it for the whole account, so there is nothing else to switch on. If it isn’t enabled, the withdrawal is refused with 403 FORBIDDEN and details.reason ACCOUNT_NOT_DELEGATED.
  • Pausing trading for the key or its account also pauses its withdrawals. A paused key’s withdrawal is refused with 503 FEATURE_DISABLED and details.reason TRADING_PAUSED.
  • Each withdrawal is submitted to the venue once. It starts pending and becomes completed once the venue pays it, or failed when the venue refuses it. A failed withdrawal pays nothing, even though it still shows the quoted fee and net_amount, and failure_reason says why. Read it back with Get a withdrawal to follow it.
  • A Polymarket withdrawal is completed once the pUSD has left the account for Polymarket’s bridge. The bridge then pays the USDC on the chain you named, usually within a few minutes, so check the destination before relying on the funds. A Hyperliquid withdrawal is completed once the USDC has arrived on the chain you named.
  • Only one Hyperliquid withdrawal runs at a time for an account. Another one started before it settles is refused with 409 CONFLICT and details.reason WITHDRAWAL_IN_PROGRESS.
A test withdrawal takes simulated cash from a venue’s test balance, moves no real funds, charges no fee and is completed at once.
The response echoes source, destination and amount, and adds fee, net_amount, status and failure_reason. Get a withdrawal and List withdrawals return the same fields.
  • client_withdrawal_id makes the call safe to repeat. Sending the same request again returns the first withdrawal and takes nothing more. Reusing the ID with a different venue, amount or destination is refused with 409 CONFLICT, and details.withdrawal_id names the first one.
  • A withdrawal over the key’s single limit, over its daily limit or over the venue’s available cash is refused with 422 VALIDATION_ERROR. See Errors.
  • List withdrawals shows the account’s withdrawals in the key’s mode, newest first, with next_cursor for the next page and an optional venue filter. Get a withdrawal reads one by id.
  • Reset test mode deletes the test withdrawals and gives their cash back.

Using funds on either venue

You don’t need to move funds between venues. Lean routes each order to the best venue, and when the cash is on the other venue, POST /v1/orders moves it and buys in the same call. See Paying from the other venue. To sign that payment yourself, see Advanced: self-signed routed orders. To move cash between your own venues without an order, use Transfers. They work with test keys today. Shares can’t move between venues. A sell is placed on the venues that hold the shares.