Skip to main content
POST
Error

Authorizations

Authorization
string
header
required

A Lean API key, sent as Authorization: Bearer <key>. A test key (lean_sk_test_...) simulates orders and fills with no money; a live key (lean_sk_live_...) trades for real within the key's limits. Every successful response says which mode answered in data.livemode.

Body

application/json
market_id
string
required

The market whose shares are sold.

Required string length: 1 - 512
venue
enum<string>
required

The venue holding the shares to sell. Every venue runs stop losses and take profits.

Available options:
kalshi,
polymarket,
polymarket_us,
hyperliquid
type
enum<string>
required

stop_loss sells once the best bid falls to trigger_price or below; take_profit sells once it rises to trigger_price or above.

Available options:
stop_loss,
take_profit
trigger_price
string
required

The best bid, in dollars per share between 0.0001 and 0.9999, that starts the sale. A stop_loss must be below the current best bid and a take_profit above it, or the request is refused, since the sale would start at once. A stop_loss is also refused when the market has no bid.

quantity
string
required

Shares to sell. Together with the account’s other stop losses on these shares, at most what the account holds.

Pattern: ^\d+(?:\.\d+)?$
slippage_limit
string

How far below trigger_price the sale may fill, in dollars above 0 and at most 0.2, on the market’s price tick and below trigger_price. Defaults to 0.05.

expires_at
string<date-time>

When the stop loss lapses if it has not started selling. Omit to keep it until canceled.

Response

The stop loss, watching the market

success
enum<boolean>
required
Available options:
true
data
object
required
meta
object
required