Trading

Position management endpoints. Require Privy JWT authentication.

Open a position

post

Opens a perpetual or delta-neutral position on Hyperliquid via the user's agent wallet.

Order types:

  • market (default): IOC limit at mark price with 5% slippage buffer

  • limit: GTC limit at the specified limitPrice

  • pro: Delta-neutral two-leg execution (short perp + long spot for positive funding). Pro mode with side=long returns 422 until the HyperEVM lending vault launches.

TP/SL: Include tpPrice and/or slPrice to bundle OCO take-profit and stop-loss orders with the entry order (normalTpsl grouping).

Requires an active agent wallet approval (via /api/auth/approve-agent).

Authorizations
AuthorizationstringRequired

Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com.

Body
coinstringRequired

Asset symbol (uppercase).

Example: BTC
sidestring · enumRequired

Position direction. In delta-neutral (pro) mode with side=long, the negative-funding path is blocked until the HyperEVM lending vault launches.

Example: shortPossible values:
sizenumber · doubleRequired

Position size in USDC notional.

Example: 5000
leverageinteger · min: 1 · max: 10Optional

Leverage multiplier. Defaults to 1.

Default: 1Example: 1
orderTypestring · enumOptional

Order type. pro triggers delta-neutral two-leg execution (perp + spot).

Default: marketExample: marketPossible values:
limitPricenumber · doubleOptional

Required when orderType is limit. Ignored for market orders.

Example: 95000
reduceOnlybooleanOptional

If true, the order only reduces an existing position.

Default: falseExample: false
tpPricenumber · doubleOptional

Take profit trigger price. Set to 0 or omit to disable.

Example: 90000
slPricenumber · doubleOptional

Stop loss trigger price. Set to 0 or omit to disable.

Example: 100000
spotLimitPricenumber · doubleOptional

Spot leg limit price for delta-neutral (pro) orders. Set to 0 or omit for market execution.

Example: 0
Responses
chevron-right
200

Order submitted successfully.

application/json
Responseone of
or
post
/api/positions

Close a position

delete

Closes an open position for the given coin. The id path parameter is the coin symbol (e.g. BTC), not a numeric order ID. Hyperliquid positions are keyed by coin.

Submits a reduce-only IOC market order for the full current position size.

Authorizations
AuthorizationstringRequired

Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com.

Path parameters
idstringRequired

Coin symbol of the position to close (uppercase). Example: BTC, ETH.

Example: BTC
Responses
chevron-right
200

Close order submitted.

application/json
delete
/api/positions/{id}

Last updated

Was this helpful?