Skip to main content

Close margin position

GET 

/v1/actions/loop/close

Close a leveraged position. Identify the collateral market with marketUidIn and debt market with marketUidOut. Omit account for quote-only (returns data.quotes with price deltas). Include account to build full transaction calldata (populates actions with alternatives, transactions, and permissions).

Response actions fields (when account is provided):

  • alternatives: DEX aggregator swap transactions sorted best-output-first. Pick one to execute.
  • transactions: Empty for close operations (no setup needed).
  • permissions: Lender withdrawal delegations (targeting the lending protocol contract). Only missing delegations are returned. Execute these first.

Request

Responses

Quote or full build response