For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

  1. Create an agent wallet, which is your API key, in the web app or with approveAgent. See Authentication & Keys.

  2. Store the agent private key in AGENT_PRIVATE_KEY.

  3. Install the HyperLink Python SDK and send a signed /exchange request.

Base URL

  • HTTP: https://api.hyperlink.xyz

  • WebSocket: wss://api.hyperlink.xyz/ws

Endpoints

Method
Path
Purpose

POST

/exchange

Signed trading actions and private read queries.

GET

/ws

WebSocket subscriptions and signed post actions. See WebSocket API.

POST

/handshake

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.

Need
What to do

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.

  1. Create a fresh X25519 keypair. Send POST /handshake with clientPubKey as the hex-encoded 32-byte public key. Require status: "ok" and data.success: true. In data, enclave_pub, enclave_signer, session_id, and signature are byte arrays; timestamp is Unix milliseconds.

  2. Verify the secp256k1 signature (r || s || v) over keccak256(enclave_pub || session_id || uint64_be(timestamp)), without an Ethereum message prefix. Require the recovered address to equal enclave_signer and registry enclaveSigner; match enclave_pub to registry x25519PublicKey. Use EnclaveKeyRegistry getCurrentEnclaveWithPCRs() and require enclaves(version) to be active, valid, and unrevoked.

  3. Derive the X25519 shared secret using your private key and enclave_pub. Apply HKDF-SHA256 with salt hyperlink-e2e-v1, info hyperlink-e2e-v1 key, and output length 32 bytes.

  4. 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. Send POST /exchange with session_id (hex), nonce (base64), and ct (base64 ciphertext followed by the 16-byte authentication tag).

  5. 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

Last updated