Markets.xyz

Trading API

What the trading API is, managed and client-signed accounts, what you need and the fees.

Last updated

The Markets trading API lets your firm trade on Hyperliquid over plain REST: perpetuals, HIP-3 perpetuals (stocks, commodities and other markets deployed by third parties) and spot. You send JSON with an API key; the API turns each request into a Hyperliquid exchange action (asset ids, price and size rounding, nonces, the builder fee) and gets it to the exchange.

You don't need to learn Hyperliquid's wire format, signing scheme or asset numbering. You keep full custody: your funds stay in your own Hyperliquid account, and nothing the API holds can withdraw them.

Two ways to sign

Every Hyperliquid exchange action must be signed. Your account signs in one of two ways, chosen when we create it:

Mode

How it works

Best for

Managed

You send plain JSON and get the exchange's result back. The API signs with a trading agent it holds for your account.

Most firms. No signing code, lowest integration effort.

Client-signed

The API returns each action as EIP-712 typed data. You sign it with your own key and send back only the signature. The API never holds a key.

Firms that must hold every signing key themselves.

A trading agent (Hyperliquid calls it an API wallet) can place and cancel orders for your account but can never withdraw or transfer funds. Your master wallet approves it once, and can revoke it at any time on Hyperliquid.

The rest of these guides assume a managed account unless they say otherwise. Client-signed accounts covers the other mode.

What you need

  • A Hyperliquid account with funds. This is your master wallet: the address that holds your balance on Hyperliquid. Hyperliquid rejects every action from an account that has never deposited.
  • An API key (hlk_…), issued by us and bound to your master address.
  • Access to the master wallet for two one-time approvals. It never signs anything after onboarding.

Fees

Every order carries the Markets builder fee, on top of Hyperliquid's own trading fees. It is charged by Hyperliquid at fill time, in the same way as its own fee.

The fee falls as your 14-day trading volume grows:

14-day volume

Builder fee

Under $1M

5 bps (0.050%)

$1M or more

4 bps (0.040%)

$5M or more

3 bps (0.030%)

$20M or more

2.5 bps (0.025%)

$100M or more

2 bps (0.020%)

$500M or more

1 bp (0.010%)

$2.5B or more

0.5 bps (0.005%)

  • Spot buys carry no builder fee. Hyperliquid never pays a builder on a spot buy, so those orders go out with a zero fee.
  • GET /v1/account shows the fee on your orders right now, in builder.

During onboarding your master wallet approves the highest fee your account can be charged, the top tier. Volume only ever lowers the fee after that.

Where to go next

The interactive API reference, generated from the live request and response schemas, is at https://hl-api-production-65c8.up.railway.app/docs. You can try every endpoint from there with your API key.