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

# Place order | Hyperliquid exchange

> Places one or multiple orders on the Hyperliquid exchange. Supports limit orders, market orders, and trigger orders (stop-loss/take-profit).

<Info>
  You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown.
</Info>

<Note>
  This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details.
</Note>

Places one or multiple orders on the Hyperliquid exchange. Supports limit orders, market orders, and trigger orders (stop-loss/take-profit).

## Parameters

### Required parameters

* `action` (object, required) — The order action object containing:
  * `type` (string) — Must be `"order"`
  * `orders` (array) — Array of order objects with:
    * `a` (number) — Asset index (see asset notation below)
    * `b` (boolean) — Is buy order (true for buy/long, false for sell/short)
    * `p` (string) — Limit price (use "0" for market orders)
    * `s` (string) — Size in units of the base asset
    * `r` (boolean) — Reduce only order
    * `t` (object) — Order type specification:
      * For limit orders: `{"limit": {"tif": "Alo" | "Ioc" | "Gtc"}}`
      * For trigger orders: `{"trigger": {"isMarket": boolean, "triggerPx": string, "tpsl": "tp" | "sl"}}`
    * `c` (string, optional) — Client order ID (128-bit hex string)
  * `grouping` (string) — Order grouping: `"na"` | `"normalTpsl"` | `"positionTpsl"`
  * `builder` (object, optional) — Builder fee configuration:
    * `b` (string) — Builder address to receive fees
    * `f` (number) — Fee in tenths of a basis point

* `nonce` (number, required) — Current timestamp in milliseconds (must be recent)

* `signature` (object, required) — EIP-712 signature of the action

### Optional parameters

* `vaultAddress` (string, optional) — Address when trading on behalf of a vault or subaccount
* `expiresAfter` (number, optional) — Timestamp in milliseconds after which the order is rejected

## Asset notation

For perpetuals, use the index from the `universe` field in the meta response. For spot assets, use `10000 + index` where index is from `spotMeta.universe`.

Example: `PURR/USDC` spot has index 0 in spot metadata, so use asset `10000`.

## Order types

### Time in Force (TIF) for limit orders

* `Alo` — Add liquidity only (post-only), canceled if would immediately match
* `Ioc` — Immediate or cancel, unfilled portion canceled
* `Gtc` — Good til canceled, rests on book until filled or canceled

### Trigger orders

* `tp` — Take profit order
* `sl` — Stop loss order
* `isMarket` — Whether to place market order when triggered
* `triggerPx` — Price at which to trigger the order

## Returns

Returns an object with order placement status:

* `status` — `"ok"` if successful
* `response` — Contains order details:
  * `type` — `"order"`
  * `data.statuses` — Array of status objects for each order:
    * `resting` — Order placed on book with `oid` (order ID)
    * `filled` — Order immediately filled with `totalSz`, `avgPx`, and `oid`
    * `error` — Error message if order failed

## Example request

<CodeGroup>
  ```shell cURL theme={"system"}
  curl -X POST https://api.hyperliquid.xyz/exchange \
    -H "Content-Type: application/json" \
    -d '{
      "action": {
        "type": "order",
        "orders": [{
          "a": 0,
          "b": true,
          "p": "50000",
          "s": "0.01",
          "r": false,
          "t": {"limit": {"tif": "Gtc"}}
        }],
        "grouping": "na"
      },
      "nonce": 1234567890123,
      "signature": {...}
    }'
  ```

  ```python Python (hyperliquid-python-sdk) theme={"system"}
  from hyperliquid.exchange import Exchange
  from hyperliquid.utils import constants
  import eth_account

  # Initialize with your private key. The public mainnet API is used
  # because this signing endpoint is not served through Chainstack.
  account = eth_account.Account.from_key("0x...")
  exchange = Exchange(account, constants.MAINNET_API_URL)

  # Place a limit buy order for BTC.
  order_result = exchange.order(
      name="BTC",
      is_buy=True,
      sz=0.01,
      limit_px=50000,
      order_type={"limit": {"tif": "Gtc"}},
      reduce_only=False,
  )

  print(order_result)
  ```

  ```typescript TypeScript (@nktkas/hyperliquid) theme={"system"}
  import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
  import { privateKeyToAccount } from "viem/accounts";

  // The default HttpTransport targets the public mainnet API because
  // this signing endpoint is not served through Chainstack.
  const wallet = privateKeyToAccount("0x...");
  const transport = new HttpTransport();
  const exchange = new ExchangeClient({ transport, wallet });

  // Place a limit buy order for asset index 0 (BTC perpetual).
  const result = await exchange.order({
    orders: [{
      a: 0,
      b: true,
      p: "50000",
      s: "0.01",
      r: false,
      t: { limit: { tif: "Gtc" } },
    }],
    grouping: "na",
  });

  console.log(result);
  ```
</CodeGroup>

## Response examples

### Successful resting order

```json theme={"system"}
{
  "status": "ok",
  "response": {
    "type": "order",
    "data": {
      "statuses": [{
        "resting": {
          "oid": 77738308
        }
      }]
    }
  }
}
```

### Filled order

```json theme={"system"}
{
  "status": "ok",
  "response": {
    "type": "order",
    "data": {
      "statuses": [{
        "filled": {
          "totalSz": "0.02",
          "avgPx": "1891.4",
          "oid": 77747314
        }
      }]
    }
  }
}
```

### Error response

```json theme={"system"}
{
  "status": "ok",
  "response": {
    "type": "order",
    "data": {
      "statuses": [{
        "error": "Order must have minimum value of $10."
      }]
    }
  }
}
```

## Use cases

* **Spot and perpetual trading** — Execute trades on Hyperliquid's order books
* **Algorithmic trading** — Place orders programmatically with custom logic
* **Risk management** — Set stop-loss and take-profit orders
* **Market making** — Place limit orders to provide liquidity

<Note>
  Orders consume address-based rate limits. The `expiresAfter` field consumes 5x rate limit when orders expire due to staleness.
</Note>

<Warning>
  Always ensure your system clock is synchronized. Nonce must be within a reasonable time window of the current server time or the request will be rejected.
</Warning>


## OpenAPI

````yaml openapi/hyperliquid_node_api/hypercore_exchange/exchange_place_order.json post /exchange
openapi: 3.0.0
info:
  title: Hyperliquid Exchange API
  version: 1.0.0
  description: >-
    API for trading operations on Hyperliquid exchange. **IMPORTANT**: All
    exchange endpoints require EIP-712 signatures for authentication. The
    examples shown will not work without proper signing. See the [Hyperliquid
    Python SDK](https://github.com/hyperliquid-dex/hyperliquid-python-sdk) for
    implementation examples.
servers:
  - url: https://api.hyperliquid.xyz
security: []
paths:
  /exchange:
    post:
      tags:
        - hyperliquid exchange
      summary: Place order
      operationId: placeOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                action:
                  type: object
                  properties:
                    type:
                      type: string
                      default: order
                      enum:
                        - order
                      description: Action type for placing orders
                    orders:
                      type: array
                      description: Array of order objects to place
                      items:
                        type: object
                        properties:
                          a:
                            type: integer
                            description: >-
                              Asset index (use universe index for perps, 10000 +
                              index for spot)
                            example: 0
                          b:
                            type: boolean
                            description: >-
                              Is buy order (true for buy/long, false for
                              sell/short)
                            example: true
                          p:
                            type: string
                            description: Limit price (use '0' for market orders)
                            example: '50000.0'
                          s:
                            type: string
                            description: Size in units of the base asset
                            example: '0.01'
                          r:
                            type: boolean
                            description: Reduce only order
                            example: false
                          t:
                            type: object
                            description: Order type specification
                            oneOf:
                              - type: object
                                properties:
                                  limit:
                                    type: object
                                    properties:
                                      tif:
                                        type: string
                                        enum:
                                          - Alo
                                          - Ioc
                                          - Gtc
                                        description: >-
                                          Time in force: Alo (add liquidity only),
                                          Ioc (immediate or cancel), Gtc (good til
                                          canceled)
                                    required:
                                      - tif
                              - type: object
                                properties:
                                  trigger:
                                    type: object
                                    properties:
                                      isMarket:
                                        type: boolean
                                        description: >-
                                          Whether to place market order when
                                          triggered
                                      triggerPx:
                                        type: string
                                        description: Price at which to trigger the order
                                      tpsl:
                                        type: string
                                        enum:
                                          - tp
                                          - sl
                                        description: Take profit (tp) or stop loss (sl)
                                    required:
                                      - isMarket
                                      - triggerPx
                                      - tpsl
                          c:
                            type: string
                            description: Client order ID (128-bit hex string, optional)
                        required:
                          - a
                          - b
                          - p
                          - s
                          - r
                          - t
                    grouping:
                      type: string
                      enum:
                        - na
                        - normalTpsl
                        - positionTpsl
                      default: na
                      description: Order grouping type
                    builder:
                      type: object
                      description: Optional builder fee configuration
                      properties:
                        b:
                          type: string
                          description: Builder address to receive fees
                        f:
                          type: number
                          description: Fee in tenths of a basis point
                      required:
                        - b
                        - f
                  required:
                    - type
                    - orders
                    - grouping
                nonce:
                  type: integer
                  description: Current timestamp in milliseconds
                  example: 1734567890123
                signature:
                  type: object
                  description: >-
                    EIP-712 signature of the action. REQUIRED for
                    authentication. Must be properly signed.
                  properties:
                    r:
                      type: string
                      description: R component of signature
                      example: >-
                        0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
                    s:
                      type: string
                      description: S component of signature
                      example: >-
                        0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
                    v:
                      type: integer
                      description: V component of signature
                      example: 28
                  required:
                    - r
                    - s
                    - v
                vaultAddress:
                  type: string
                  description: >-
                    Address when trading on behalf of a vault or subaccount
                    (optional)
                  example: '0x0000000000000000000000000000000000000000'
                  nullable: true
                expiresAfter:
                  type: integer
                  description: >-
                    Timestamp in milliseconds after which the order is rejected
                    (optional)
              required:
                - action
                - nonce
                - signature
            example:
              action:
                type: order
                orders:
                  - a: 0
                    b: true
                    p: '50000.0'
                    s: '0.01'
                    r: false
                    t:
                      limit:
                        tif: Gtc
                grouping: na
              nonce: 1705234567890
              signature:
                r: >-
                  0x0000000000000000000000000000000000000000000000000000000000000000
                s: >-
                  0x0000000000000000000000000000000000000000000000000000000000000000
                v: 27
              vaultAddress: null
      responses:
        '200':
          description: Order placement result
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Request status
                  response:
                    type: object
                    properties:
                      type:
                        type: string
                      data:
                        type: object
                        properties:
                          statuses:
                            type: array
                            items:
                              oneOf:
                                - type: object
                                  properties:
                                    resting:
                                      type: object
                                      properties:
                                        oid:
                                          type: integer
                                          description: Order ID
                                - type: object
                                  properties:
                                    filled:
                                      type: object
                                      properties:
                                        totalSz:
                                          type: string
                                          description: Total size filled
                                        avgPx:
                                          type: string
                                          description: Average fill price
                                        oid:
                                          type: integer
                                          description: Order ID
                                - type: object
                                  properties:
                                    error:
                                      type: string
                                      description: Error message
                example:
                  status: ok
                  response:
                    type: order
                    data:
                      statuses:
                        - resting:
                            oid: 77738308

````