Trading API
Get an API key, onboard your account and place, check and cancel your first order.
Last updated
This guide takes a managed account from zero to a resting order, then cancels it. It takes about five minutes. Every example uses curl; any HTTP client works the same way.
1. Get an API key
- Open markets.xyz/api-access.
- Connect your master wallet: the Hyperliquid account that holds your funds.
- Select Create API key and sign the message in your wallet. Signing is free and sends no transaction; it proves you control the wallet.
Your account is created and the key is shown, once. Keys start with hlk_; store yours in a secret manager.
Make sure the master address has deposited on Hyperliquid. Hyperliquid rejects every action from an account that has never deposited.
Set the key in your shell for the examples below:
export API_KEY=hlk_...Check the key works:
curl -s https://hl-api-production-65c8.up.railway.app/v1/account -H "Authorization: Bearer $API_KEY"{
"name": "acme",
"master_address": "0x2289fc466745c0fc5e38a6fc63ededdf9e04e56f",
"status": "active",
"signing_mode": "managed",
"builder": { "address": "0x…", "fee_tenths_bps": 50, "fee_percent": "0.05%" }
}2. Onboard your account
On the same page, select Approve and sign the two requests your wallet shows. You do this once.
Coming back later with a key you already have? Choose Use it instead and paste it.
Onboarding explains what each signature does.
Confirm the account is ready:
curl -s https://hl-api-production-65c8.up.railway.app/v1/managed-agent -H "Authorization: Bearer $API_KEY"{
"agent": {
"agent_address": "0x31c7…cd02",
"approved": true,
"approved_at": "2026-09-29T17:51:02.004Z"
},
"account_mode": "unifiedAccount"
}3. Place an order
Place a post-only limit buy of 0.01 ETH at $2,500, well below the market so it rests on the book. Give every order a client order id (cloid, a UUID) so you can find it again:
curl -s -X POST https://hl-api-production-65c8.up.railway.app/v1/orders \
-H "Authorization: Bearer $API_KEY" \
-H 'content-type: application/json' \
-d '{
"orders": [{
"coin": "ETH",
"side": "buy",
"px": "2500",
"sz": "0.01",
"type": { "limit": { "tif": "Alo" } },
"cloid": "7f1c1d2e-4b5a-4c3d-9e8f-0a1b2c3d4e5f"
}]
}'{
"status": "submitted",
"outcome": "ok",
"response": { "results": [{ "status": "resting", "oid": 123456789 }] }
}results has one entry per order, in the order you sent them. resting means the order is on the book; oid is Hyperliquid's order id.
4. Check the result
Look the order up by its cloid (or its oid):
curl -s https://hl-api-production-65c8.up.railway.app/v1/orders/7f1c1d2e-4b5a-4c3d-9e8f-0a1b2c3d4e5f \
-H "Authorization: Bearer $API_KEY"Or list everything open:
curl -s https://hl-api-production-65c8.up.railway.app/v1/open-orders -H "Authorization: Bearer $API_KEY"5. Cancel it
curl -s -X POST https://hl-api-production-65c8.up.railway.app/v1/orders/cancel \
-H "Authorization: Bearer $API_KEY" \
-H 'content-type: application/json' \
-d '{ "cancels": [{ "coin": "ETH", "cloid": "7f1c1d2e-4b5a-4c3d-9e8f-0a1b2c3d4e5f" }] }'{
"status": "submitted",
"outcome": "ok",
"response": { "results": [{ "status": "success" }] }
}Next steps
- Placing orders: market orders, take profit and stop loss, modifies, leverage and the dead man's switch.
- Errors and limits: what each status code means and how to handle it.
- The interactive reference at https://hl-api-production-65c8.up.railway.app/docs.