API Quickstart
Quickstart for HyperLink's API: base URLs, request signing, and a working code example to start trading Hyperliquid markets programmatically today.
HyperLink mirrors Hyperliquid's /exchange action format and EIP-712 signing, so point an existing Hyperliquid trading client at the HyperLink base URL.
Quickstart
Create an agent wallet, which is your API key, in the web app or with
approveAgent. See Authentication & Keys.Store the agent private key in
AGENT_PRIVATE_KEY.Install the HyperLink Python SDK and send a signed
/exchangerequest.
Base URL
HTTP:
https://api.hyperlink.xyzWebSocket:
wss://api.hyperlink.xyz/ws
Endpoints
POST
/exchange
Signed trading actions and private read queries.
Request envelope
SDKs build the /exchange envelope for you: action, signature, nonce, plus optional expiresAfter and vaultAddress. There are no bearer tokens or API secrets; authentication is the signature on each request.
For raw request fields, response shapes, and signed read query schemas, see Exchange Methods. EIP-712 signatures use Hyperliquid-compatible signing chainIds, not the HyperEVM network chainId 999; see Authentication & Keys.
First request
Use the HyperLink Python SDK. It is a minimal fork of the Hyperliquid Python SDK with HyperLink defaults and signed private reads. The import paths still use hyperliquid.*.
HyperLink requires a client order ID (cloid) on every order. Pass it through the SDK's cloid parameter or the raw order action's c field.
For TypeScript and longer SDK examples, see SDKs.
Migrate from Hyperliquid
Trading actions need one change: set the base URL to HyperLink. Order structures, asset indexes, and EIP-712 signing stay Hyperliquid-compatible. The HyperLink Python SDK PR shows the minimal changes needed to add HyperLink support to a Hyperliquid SDK fork.
Trading actions
Use the HyperLink Python SDK, or keep your Hyperliquid client and set the HyperLink base URL.
Private account reads
Send signed POST /exchange queries instead of public /info account-state calls.
Public market data
Keep using Hyperliquid public /info for meta, allMids, l2Book, and candleSnapshot.
The HyperLink Python SDK adds helpers for signed private reads. In other SDKs, build those as raw signed requests, or see SDKs. For every signed read query and schema, see Exchange Methods.
Optional end-to-end encryption
Orders and cancellations support optional client-to-enclave encryption over HTTPS. Encrypt the complete signed envelope; signatures remain required. The SDK examples above do not enable encryption. Ordinary private reads such as openOrders do not support this wrapper.
Create a fresh X25519 keypair. Send
POST /handshakewithclientPubKeyas the hex-encoded 32-byte public key. Requirestatus: "ok"anddata.success: true. Indata,enclave_pub,enclave_signer,session_id, andsignatureare byte arrays;timestampis Unix milliseconds.Verify the secp256k1
signature(r || s || v) overkeccak256(enclave_pub || session_id || uint64_be(timestamp)), without an Ethereum message prefix. Require the recovered address to equalenclave_signerand registryenclaveSigner; matchenclave_pubto registryx25519PublicKey. Use EnclaveKeyRegistrygetCurrentEnclaveWithPCRs()and requireenclaves(version)to be active, valid, and unrevoked.Derive the X25519 shared secret using your private key and
enclave_pub. Apply HKDF-SHA256 with salthyperlink-e2e-v1, infohyperlink-e2e-v1 key, and output length 32 bytes.Encrypt the envelope's UTF-8 JSON with AES-256-GCM, a fresh cryptographically random 12-byte nonce, and AAD
hyperlink-e2e-v1 || session_id. SendPOST /exchangewithsession_id(hex),nonce(base64), andct(base64 ciphertext followed by the 16-byte authentication tag).Responses use the same fields. Require the matching session ID; authenticate and decrypt with the same key and AAD, using the response's nonce. Parse the decrypted JSON normally. Reject plaintext errors or authentication failures; never silently fall back to unencrypted requests.
|| concatenates bytes; uint64_be is an unsigned 8-byte big-endian integer. Strings are UTF-8; keys and session IDs are raw bytes in cryptographic operations. Sessions expire after 30 minutes or 10 minutes idle; repeat the handshake when needed.
Next steps
Authentication & Keys: create agent keys and sign requests.
SDKs: Python and TypeScript client examples.
Exchange Methods: actions, queries, and schemas.
WebSocket API: real-time subscriptions.
Last updated