For the complete documentation index, see llms.txt. This page is also available as Markdown.

Prepare a position close

Prepare a position close

post

Build an unsigned reduce-only market order that closes an open position.

Same prepare → sign → execute flow as /api/v1/perp/order: sign the returned eip712 payload and submit it to /api/v1/perp/execute. This call closes nothing on its own.

size is how much of the position to close — pass the position's full size to close it completely. is_buy is the side of the closing order, which is the opposite of the position: true closes a short, false closes a long. price is the current mark price and is only used to derive the slippage-adjusted limit, since the order is immediate-or-cancel and reduce-only.

Read the position's size and side from /api/v1/perp/positions rather than tracking them yourself — fills, funding and partial closes all move them. As with /api/v1/perp/order, the response echoes the rounded size and effective price encoded in the signed action.

Authorizations
apikeystringRequired

API key for authentication

Body

Prepare a market close for an existing position.

wallet_addressstringRequired

Wallet address on Hyperliquid

Example: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
coinstringRequired

Asset symbol

Example: BTC
sizenumberRequired

How much of the position to close, in units of the asset. Pass the position's full size (from /api/v1/perp/positions) to close it completely.

Example: 0.01
pricenumberRequired

Current mark price, used only to derive the slippage-adjusted limit — the close is always an immediate-or-cancel reduce-only order

Example: 65000
is_buybooleanRequired

Side of the closing order, which is the opposite of the position: true closes a short (buy to close), false closes a long (sell to close)

slippagenumber · max: 0.5Optional

Slippage tolerance as a fraction, not a percentage (0.03 = 3%)

Default: 0.03Example: 0.03
Responses
200

Successful Response

application/json
post/api/v1/perp/close

Last updated

Was this helpful?