Markets.xyz

Trading API

The error shape, what each status code means and the API's limits.

Last updated

Error shape

Errors from the API itself share one shape:

json
{ "error": { "code": "unknown_asset", "message": "unknown coin \"NOPE\"" } }

Branch on code, which is stable. message is for people and may change. Every response, errors included, carries an x-request-id header; include it when you report a problem.

When Hyperliquid itself rejects a request, the response has the usual trading shape instead, with "status": "rejected" and Hyperliquid's reason in response.error.

Status codes

Status

code

Meaning

What to do

200

Submitted. Individual items may still have failed.

Check every entry in response.results

400

bad_request

Malformed request, or not possible (such as closing a position you don't have, a price off the tick, an unknown dex or an id that isn't one)

Fix the request

400

unknown_asset

No market by that name

Check the coin; HIP-3 needs its dex: prefix

401

unauthorized

API key missing, invalid or revoked

Check the header and the key

403

forbidden

Account disabled

Contact us

404

not_found

No such resource on your account

Check the id

410

expired

A prepared action was submitted after its signing window

Prepare it again

412

precondition_failed

Account not onboarded: the trading agent or the builder fee is not approved yet

Finish onboarding

422

exchange_rejected

Hyperliquid rejected the whole request

Read response.error; fix before retrying

429

rate_limited

Over your request rate

Wait for Retry-After (seconds), then retry

502

upstream_error

The call to Hyperliquid failed; the action may or may not have executed

Check the order's status before retrying

504

The request took too long

Check the order's status before retrying

A 502 or 504 on a trading request is ambiguous: see Handling a 502.

Common exchange rejections

Message

Cause

Must deposit before performing actions

The master account has never deposited on Hyperliquid

User or API Wallet 0x… does not exist

The trading agent isn't approved, or was revoked on Hyperliquid

Order must have minimum value of $10.

The order is worth under $10, including a small partial close

Insufficient margin to place order.

Not enough collateral for the order at your leverage

A price off the tick (Hyperliquid's Price must be divisible by tick size.) or a size off the lot never reaches Hyperliquid: the API answers 400 first, naming the order. See Placing orders.

Limits

Limit

Value

Requests per second, per account

10 by default, burst of the same; can be raised

Orders, cancels or modifies per batch

50

Request body

256 KiB

Time allowed for a call to Hyperliquid

5 seconds

Prices and sizes

Up to 8 decimals

Hyperliquid's own per-address limits apply on top; check them with GET /v1/rate-limit. A revoked API key or a disabled account stops working within 30 seconds.