Markets.xyz

Trading API

Positions, open orders, fills, order status, prices, market metadata and the order book.

Last updated

Read endpoints return Hyperliquid's own JSON, passed through unchanged, so Hyperliquid's documentation of each response applies as is. Account reads are always for your account's master address.

Endpoints marked dex cover the main perpetuals by default; add ?dex=xyz for a HIP-3 dex.

Your account

Endpoint

Returns

Hyperliquid request

GET /v1/positions (dex)

Positions, margin summary and account value

clearinghouseState

GET /v1/spot-balances

Spot token balances

spotClearinghouseState

GET /v1/open-orders (dex)

Open orders, including trigger orders

frontendOpenOrders

GET /v1/fills

Your most recent fills

userFills

GET /v1/orders/{id}

One order's status, by oid or cloid

orderStatus

GET /v1/rate-limit

Your Hyperliquid request allowance

userRateLimit

bash
curl -s https://hl-api-production-65c8.up.railway.app/v1/positions -H "Authorization: Bearer $API_KEY"

Fills

Without parameters, GET /v1/fills returns your most recent fills. For a time range, pass start_time and optionally end_time, in unix milliseconds:

bash
curl -s "https://hl-api-production-65c8.up.railway.app/v1/fills?start_time=1790400000000&end_time=1790486400000" \
  -H "Authorization: Bearer $API_KEY"

Hyperliquid caps how many fills one response holds. To walk a long history, request consecutive time windows.

Order status

GET /v1/orders/{id} takes Hyperliquid's oid or your cloid:

bash
curl -s https://hl-api-production-65c8.up.railway.app/v1/orders/7f1c1d2e-4b5a-4c3d-9e8f-0a1b2c3d4e5f \
  -H "Authorization: Bearer $API_KEY"

It reports the order's current state (open, filled, cancelled, triggered and so on), or unknownOid when Hyperliquid doesn't know the id. This is the call to make after an ambiguous 502, but an order placed a moment ago can still read unknownOid while it is live: look again after a second before treating it as not placed (see Placing orders).

Market data

Endpoint

Returns

Hyperliquid request

GET /v1/market/mids (dex)

Mid price of every market

allMids

GET /v1/market/meta (dex)

Market metadata (size decimals, max leverage) and live context (mark price, funding, open interest)

metaAndAssetCtxs

GET /v1/market/book/{coin}

Order book, best levels on each side

l2Book

bash
curl -s https://hl-api-production-65c8.up.railway.app/v1/market/book/ETH -H "Authorization: Bearer $API_KEY"

Market metadata changes rarely. Cache it and refresh every few minutes rather than fetching it before each order.

Anything else

POST /v1/info forwards any Hyperliquid info request, for data the endpoints above don't cover. Send the request body exactly as Hyperliquid documents it:

bash
curl -s -X POST https://hl-api-production-65c8.up.railway.app/v1/info \
  -H "Authorization: Bearer $API_KEY" \
  -H 'content-type: application/json' \
  -d '{ "type": "spotMeta" }'

Account settings

Endpoint

Returns

GET /v1/account

Your account: master address, signing mode, rate limit and current builder fee

GET /v1/account/status

Onboarding checklist, read live from Hyperliquid

GET /v1/managed-agent

Your trading agent and account mode

GET /v1/builder-fee

The builder fee, and whether your approval covers it

GET /v1/actions

Your recent actions and their results, newest first

GET /v1/actions is a log of every action the API sent for you, with the request, the exchange's response and the latency. Page through it with limit (1 to 500, default 50) and before, set to the previous page's next_before.