> 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. HyperLink is a prime broker for Hyperliquid.

## Three steps

1. Point your client at the [base URL](#base-url).
2. Create an agent wallet (your API key) in the web app or with `approveAgent`. See [Authentication & Keys](/api/api-keys.md).
3. Sign each request with EIP-712 and POST it to `/exchange`.

There are no bearer tokens or API secrets. Authentication is the signature on each request.

## Base URL

The HyperLink API base URL is `https://api.hyperlink.xyz`. WebSocket connects at `wss://api.hyperlink.xyz/ws`.

{% hint style="info" %}
The network chainId (999) is the HyperEVM network ID, used for direct on-chain contract calls such as staking. It is **not** the chainId used in EIP-712 signatures. See [Authentication & Keys](/api/api-keys.md).
{% endhint %}

## Endpoints

| Method | Path        | Purpose                                                                                    |
| ------ | ----------- | ------------------------------------------------------------------------------------------ |
| `POST` | `/exchange` | Trading actions **and** read queries. There is no separate `/info` host.                   |
| `GET`  | `/ws`       | WebSocket subscriptions and signed `post` actions. See [WebSocket API](/api/websocket.md). |

## Request envelope

Every action and query POSTed to `/exchange` uses this envelope:

```json
{
  "action": { "type": "...", "...": "..." },
  "signature": { "r": "0x...", "s": "0x...", "v": 27 },
  "nonce": 1748438400000,
  "expiresAfter": 1748438460000,
  "vaultAddress": "0x0000000000000000000000000000000000000000"
}
```

| Field          | Required | Notes                                                   |
| -------------- | -------- | ------------------------------------------------------- |
| `action`       | Yes      | The action or query object; `type` selects the variant. |
| `signature`    | Yes      | EIP-712 signature with `r`, `s`, `v`.                   |
| `nonce`        | Yes      | Unix time in **milliseconds**, single-use per signer.   |
| `expiresAfter` | No       | Millisecond timestamp; must be `>=` `nonce`.            |
| `vaultAddress` | No       | Act on behalf of a vault or sub-account.                |

Write actions return `{ "status": "ok" | "err", "response": { ... } }`; read queries return raw JSON.

## First request

Use a Hyperliquid SDK pointed at the HyperLink base URL. It handles EIP-712 signing and the order envelope for you.

```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"])

# Point the client at the HyperLink base URL.
exchange = Exchange(agent, base_url="https://api.hyperlink.xyz")

# Place a resting limit buy: 0.1 BTC at 50000, good-til-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"),  # HyperLink requires a cloid
)
print(result)
```

{% hint style="info" %}
HyperLink **requires** a client order id (`cloid`) on every order. Pass it via your SDK's `cloid` parameter, or the `c` field in a raw request.
{% endhint %}

For TypeScript, use [nktkas/hyperliquid](https://github.com/nktkas/hyperliquid) with the same base URL.

## Coming from Hyperliquid?

| Stays the same                                   | Changes                                                         |
| ------------------------------------------------ | --------------------------------------------------------------- |
| Order structures, EIP-712 signing, asset indexes | Base URL points to HyperLink                                    |
| Hyperliquid trading SDKs and tooling             | Balances are private; deposits and withdrawals are on HyperCore |

Private read queries use signed `POST /exchange` requests. There is no separate HyperLink `/info` host.

## Next steps

* [Authentication & Keys](/api/api-keys.md): create agent keys and sign requests.
* [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.
