> ## Documentation Index
> Fetch the complete documentation index at: https://docs.b3os.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Hyperliquid Update Leverage

Update leverage and margin mode for an asset on Hyperliquid perpetual DEX. Supports cross (shared margin) and isolated (per-position margin) modes. Ideal for: risk management, adjusting margin requirements, and position sizing.

![Hyperliquid Update Leverage logo](https://cdn.b3.fun/hyperliquid-logo.png)
Catalog action Hyperliquid wallet

Update leverage and margin mode for an asset on Hyperliquid perpetual DEX. Supports cross (shared margin) and isolated (per-position margin) modes. Ideal for: risk management, adjusting margin requirements, and position sizing.

**Review wallet and value movement**

This action can require a wallet connector, gas, token movement, or an external side effect. Test with simulation or a controlled amount before using it in a live workflow.

## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `hyperliquid-update-leverage` |
| Category | Hyperliquid |
| Connector | `wallet` |
| Requires gas | No |
| Funds movement | None declared |
| Tags | `hyperliquid`, `perps`, `leverage`, `margin`, `risk` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dex` | `string` | No | HIP-3 DEX name for TradFi markets. Omit for standard crypto perps. xyz = trade.xyz \(stocks, indices, commodities\), flx = flx.finance, vntl = vntl.exchange |
| `coin` | `string` | Yes | Asset symbol \(e.g., BTC, ETH, SOL\) |
| `leverage` | `number` | Yes | Leverage multiplier \(e.g., 5 for 5x\) |
| `leverageType` | `string` | Yes | Margin mode: cross \(shared margin\) or isolated \(per-position margin\) |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `status` | `string` | Yes | Leverage update outcome |
| `coin` | `string` | No | Asset symbol |
| `leverage` | `number` | No | New leverage value |
| `leverageType` | `string` | No | Margin mode \(cross/isolated\) |
| `skipped` | `boolean` | No | True if leverage was already at the requested setting \(no-op\) |

## Examples

**Workflow node**

```json
{
  "type": "hyperliquid-update-leverage",
  "payload": {
    "coin": "example-coin",
    "leverage": 1,
    "leverageType": "cross"
  },
  "children": [],
  "connector": {
    "type": "wallet",
    "id": "conn_wallet"
  }
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/hyperliquid-update-leverage/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "coin": "example-coin",
    "leverage": 1,
    "leverageType": "cross"
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.