> ## Documentation Index
> Fetch the complete documentation index at: https://developer.copper.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Trading on Hyperliquid

## API trading

Copper provides a dedicated API proxy for clients trading on Hyperliquid, routing all order requests through Copper's platform rather than directly to the exchange endpoint. This intermediary layer enables operational safeguards such as policy engine controls, and governance requirements before orders reach the market.

To trade on Hyperliquid via API directly from your Copper MPC wallet address, you must delegate Hyperliquid trading permissions to Copper's dedicated API wallet. This will enable you to submit trades through the Copper Hyperliquid API. The Copper API wallet can submit trades requested on your behalf but cannot **initiate withdrawals**. You can revoke this access at any point.

## Setting up your agent (API) wallet

Before you set up your agent wallet, create your Copper Service User API key using the standard setup process. Then, you configure your agent wallet from the "Hyperliquid API Wallet" dashboard in Copper.

* This dashboard only appears if you have at least one activated Hyperliquid wallet with HypeCORE funds.
  * Activate HypeEVM and HypeCORE in your portfolio.
  * Bridge USDC from ETH to HypeCORE. This requires two steps: ETH to HypeEVM, then HypeEVM to HypeCORE.
  * The Hyperliquid API Wallet should appear on your dashboard.
* From the dashboard click the "+" button.
* On first setup, you will be asked to acknowledge and download a legal addendum before you can continue.

Once acknowledged, you can proceed to link your Hyperliquid API wallet.

* You will be asked to provide:
  * Validity length (Max 180 days)
* You will be asked to sign a transaction using your Copper MPC wallet to link the Copper API wallet to the Master Wallet.
* Once this transaction is executed, the API wallet is granted trading rights on behalf of the Master Wallet for the full validity period. *The API wallet never has withdrawal rights.*
* From here the API wallet will have access to trade with any funds sitting in the HypeCORE balance on the Master Wallet.
* You can revoke the agent permission from your dashboard at any point.

<Note>
  You can have a maximum of one API wallet associated to a single portfolio at a time. This applies to trades submitted through the API and through the trading UI.
</Note>

Once your API wallet is activated, you can trade on Hyperliquid using the native Hyperliquid API and submit to the Copper API proxy.

## Submitting a trade through the Copper API

The proxy is designed to mirror the Hyperliquid API as closely as possible, minimising integration overhead while adding Copper's pre-trade validation and audit layer. However the core structure of the request differs in one key area: **authentication and routing parameters**.

Note: Copper charges a small on-chain fee for product maintenance and order execution.

### Direct Hyperliquid request

When submitting directly to Hyperliquid, the client is responsible for signing the request with their wallet's private key. The payload includes:

* `action` — the order details
* `nonce` — a Unix timestamp in milliseconds, used to prevent replay attacks
* `signature` — a cryptographic signature generated by the client's wallet (`r`, `s`, `v` components)

**See below a sample direct API call to Hyperliquid**

```json theme={"system"}
{
  "action": {
    "type": "order",
    "orders": [
      {
        "a": "3",
        "b": true,
        "p": "64107",
        "s": "0.0012",
        "r": false,
        "t": { "limit": { "tif": "Gtc" } }
      }
    ],
    "grouping": "na"
  },
  "nonce": 1234567890123,
  "signature": {
    "r": "0xabc123...",
    "s": "0xdef456...",
    "v": 28
  }
}
```

### Copper proxy request

When submitting through the Copper proxy, the `nonce` and `signature` fields are **removed**. Copper's backend generates these using its own agent wallet on the client's behalf. In their place, two Copper-specific fields are required for routing and audit:

* `organizationId` — your Copper organisation identifier
* `portfolioId` — the specific portfolio from which the trade should be executed

The `action` payload is **identical** to what you would send directly to Hyperliquid — no changes are needed there.

**See below a sample API call via the Copper API proxy**

Endpoint: `POST https://api.copper.co/platform/exchange`

```json theme={"system"}
{
  "action": {
    "type": "order",
    "orders": [
      {
        "a": "3",
        "b": true,
        "p": "64107",
        "s": "0.0012",
        "r": false,
        "t": { "limit": { "tif": "Gtc" } }
      }
    ],
    "grouping": "na"
  },
  "organizationId": "clientOrgName",
  "portfolioId": "abcde12345"
}
```

**The**  `action`  **payload**

The `action` object follows the Hyperliquid specification exactly. Refer to the [Hyperliquid Exchange Endpoint documentation](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order) for the full field reference. The example above places a limit order (Good-till-cancelled) for asset index `3`, buying `0.0012` units at a limit price of `64107`.

| Field | Description |
| - | - |
| `a` | Asset index |
| `b` | Side — `true` = buy, `false` = sell |
| `p` | Limit price |
| `s` | Size |
| `r` | Reduce-only flag |
| `t` | Order type — `limit` with time-in-force (`Gtc`, `Ioc`, `Alo`) |
| `grouping` | Order grouping — typically `"na"` |

The Copper proxy is designed to be a minimal-friction integration for existing Hyperliquid users. If you are already integrated with Hyperliquid, migrating to the Copper proxy requires only:

1. Changing the **endpoint URL** to Copper's proxy
2. Removing the `nonce` and `signature` fields
3. Adding your `organizationId` and `portfolioId`

The `action` payload requires no changes.
