Skip to main content
Adjust the margin on an isolated position.
The examples on this page use Hyperliquid (provider: 'hyperliquid'). Replace the provider value with any supported DEX from getProviders().

USER_AGENT mode

const result = await perps.updatePositionMargin({
  provider: 'hyperliquid',
  address: userAddress,
  asset: { assetId: 'BTC', market: 'hyperliquid' },
  action: 'add',
  amount: '500.00',
});

USER mode

const { actions } = await perps.buildPositionMargin({
  provider: 'hyperliquid',
  address: userAddress,
  asset: { assetId: 'BTC', market: 'hyperliquid' },
  action: 'remove',
  amount: '200.00',
});

// Sign and submit as usual...
API Reference: POST /actions