> For the complete documentation index, see [llms.txt](https://docs.hyperlink.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperlink.xyz/api/setup.md).

# API Quickstart

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](/api/api-keys.md).
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](/api/websocket.md). |

## 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](/api/exchange-methods.md). EIP-712 signatures use Hyperliquid-compatible signing chainIds, not the HyperEVM network chainId `999`; see [Authentication & Keys](/api/api-keys.md).

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

```bash
pip install hyperlink-python-sdk
```

```python
import os
from eth_account import Account
from hyperliquid.exchange import Exchange
from hyperliquid.utils.types import Cloid

# Your API key is the agent private key. Keep it in an env var, never hardcode.
agent = Account.from_key(os.environ["AGENT_PRIVATE_KEY"])

# The HyperLink SDK defaults to the HyperLink base URL. Set it explicitly if your client code passes a URL.
exchange = Exchange(agent, base_url="https://api.hyperlink.xyz")

# Place a resting limit buy: 0.1 BTC at 50000, good-till-cancel.
result = exchange.order(
    name="BTC",
    is_buy=True,
    sz=0.1,
    limit_px=50000,
    order_type={"limit": {"tif": "Gtc"}},
    cloid=Cloid.from_str("0x1234567890abcdef1234567890abcdef"),  # required
)
print(result)
```

For TypeScript and longer SDK examples, see [SDKs](/api/sdks.md).

## 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](https://github.com/hyperlink-xyz/hyperlink-python-sdk/pull/1) 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](/api/sdks.md). For every signed read query and schema, see [Exchange Methods](/api/exchange-methods.md).

## Next steps

* [Authentication & Keys](/api/api-keys.md): create agent keys and sign requests.
* [SDKs](/api/sdks.md): Python and TypeScript client examples.
* [Exchange Methods](/api/exchange-methods.md): actions, queries, and schemas.
* [WebSocket API](/api/websocket.md): real-time subscriptions.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hyperlink.xyz/api/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
