Trades

Update Trade Leverage

Sets cross or isolated leverage for a perpetual market, up to that market's maximum. Returns a trade recording the submission. Requires an Idempotency-Key.

post/trades/leverage

Headers

Idempotency-Keystring required

Required. Reuse the same key when retrying, including after a submission_unknown outcome; a new key submits a new trade.

Request body

account_idstring required

The account or user that owns the trading wallet, prefixed biz_ or user_.

leverageinteger required

Leverage multiplier, such as 10 for 10x. Capped at the market's maximum.

margin_mode'cross' | 'isolated' required

cross shares margin across positions; isolated limits margin to this market's position.

marketstring required

Perpetual market on the provider, such as ETH.

metadataobject nullable

Free-form string-to-string annotations stored on the trade.

provider'hyperliquid' required

Example request

{
  "account_id": "biz_xxxxxxxxxxxxxx",
  "leverage": 5,
  "margin_mode": "isolated",
  "market": "ETH",
  "provider": "hyperliquid"
}

Response

leverage submission recorded

account_idstring nullable required

The account that owns the trading wallet, prefixed biz_. null when a user owns it.

completed_atstring nullable required

When the submission finished, as an ISO 8601 timestamp, or null while it is pending or its outcome is unknown.

created_atstring required

When the trade was submitted, as an ISO 8601 timestamp.

failure_code'pre_submission_error' | 'provider_rejected' | 'provider_outcome_unknown' | 'null' nullable required

Why the trade failed or has an unknown outcome, or null otherwise.

idstring required

Trade ID, prefixed trop_.

instrument_type'perpetual' required

The kind of instrument traded.

metadataobject required

String-to-string annotations you provided when submitting the trade.

object'trade' required
operation_type'create_orders' | 'cancel_orders' | 'update_leverage' required

create_orders places orders, cancel_orders cancels a submitted batch, and update_leverage sets a market's leverage.

provider'hyperliquid' required

Trading venue the trade was submitted to.

status'pending' | 'submitted' | 'completed' | 'failed' | 'submission_unknown' required

Submission status, not fill status. completed means the provider response was recorded, even if individual orders were rejected. Never resubmit a submission_unknown trade with a new idempotency key.

trade_idstring nullable required

For a cancellation, the ID of the canceled trade, prefixed trop_. null otherwise.

updated_atstring required

When the trade last changed, as an ISO 8601 timestamp.

user_idstring nullable required

The user who owns the trading wallet, prefixed user_. null when an account owns it.

Example response

{
  "account_id": "biz_xxxxxxxxxxxxxx",
  "cancellations": [
    {
      "id": "trdcloid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "status": "canceled"
    }
  ],
  "completed_at": "2026-01-01T12:00:00.000Z",
  "created_at": "2026-01-01T12:00:00.000Z",
  "failure_code": "pre_submission_error",
  "id": "trop_xxxxxxxxxxxxxx",
  "instrument_type": "perpetual",
  "leverage": {
    "leverage": 5,
    "margin_mode": "isolated",
    "market": "ETH"
  },
  "metadata": {},
  "object": "trade",
  "operation_type": "cancel_orders",
  "orders": [
    {
      "average_price": {
        "amount": "-2.50",
        "currency": "usd",
        "decimals": 2,
        "display_decimals": 2
      },
      "hyperliquid": {
        "trigger_price": {
          "amount": "-2.50",
          "currency": "usd",
          "decimals": 2,
          "display_decimals": 2
        }
      },
      "object": "trading_order",
      "order_type": "limit",
      "price": {
        "amount": "-2.50",
        "currency": "usd",
        "decimals": 2,
        "display_decimals": 2
      },
      "side": "buy",
      "status": "open"
    }
  ],
  "provider": "hyperliquid",
  "requested_orders": [
    {
      "client_order_id": "trdcloid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "market": "ETH",
      "order_type": "stop_loss",
      "parent_client_order_id": "trdcloid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "price": {
        "amount": "-2.50",
        "currency": "usd",
        "decimals": 2,
        "display_decimals": 2
      },
      "side": "sell",
      "size": "0.02",
      "trigger_price": {
        "amount": "-2.50",
        "currency": "usd",
        "decimals": 2,
        "display_decimals": 2
      }
    }
  ],
  "status": "completed",
  "trade_id": "trop_xxxxxxxxxxxxxx",
  "updated_at": "2026-01-01T12:00:00.000Z"
}

Changes

Changed in 3 of the 74 revisions of this API.5

    • ○

      the security scope crypto_wallet:trade was added to the endpoint's security scheme bearerAuth

      api-security-scope-added

    • ○

      the security scope crypto_wallet:manage was removed from the endpoint's security scheme bearerAuth

      api-security-scope-removed

    • ○

      the security scope crypto_wallet:trade was added to the endpoint's security scheme bearerAuth

      api-security-scope-added

    • ○

      the security scope crypto_wallet:manage was removed from the endpoint's security scheme bearerAuth

      api-security-scope-removed

    • ○

      endpoint added

      endpoint-added

Of the 74 revisions, 1 has no diff computed.