# Build Order

Build order action (no signature). Accepts human-readable or wire format. Injects builder fee, returns hash to sign.

:::info
Exchange API calls do not consume Quicknode API credits. Transactions through this endpoint are appended with a builder fee. See [hyperliquidapi.com](https://hyperliquidapi.com) for a full breakdown. To white-label with your own builder code, [contact us](https://www.quicknode.com/contact-us).
:::

## Parameters

- **action** (object (REQUIRED)): Order action object
  - **type** (string (optional)): Action type ("order")
  - **orders** (array (optional)): Array of order objects
    - **asset** (string (optional)): Asset name (e.g., "BTC", "HYPE", "xyz:SILVER")
    - **side** (string (optional)): Order side ("buy" or "sell")
    - **price** (string (optional)): Limit price (omit for market orders)
    - **size** (string (optional)): Order size/quantity
    - **tif** (string (optional)): Time in force: "ioc", "gtc", "alo", or "market"

- **vaultAddress** (string (optional)): Optional vault address

- **priorityFee** (integer (optional)): Optional priority fee in tenths of a basis point (e.g. 10000 = 1 basis point). Charged from undelegated staking HYPE balance. Use Build Priority Funding Deposit to fund this balance. Not supported for HIP-4 orders.

## Returns

- **hash** (string): Hash to sign with wallet (0x-prefixed hex string)

- **nonce** (integer): Unique nonce for this action (timestamp in milliseconds)

- **action** (object): Processed action object in wire format with builder fee injected
  - **type** (string): Action type ("order")
  - **orders** (array): Array of order objects in wire format
    - **a** (integer): Asset index (0 for BTC, 1 for ETH, etc.)
    - **b** (boolean): Buy side (true for buy, false for sell)
    - **p** (string): Price as a stringified number
    - **s** (string): Size/quantity as a stringified number
    - **r** (boolean): Reduce-only flag (true for reduce-only orders)
    - **t** (object): Order type specification
      - **limit** (object): Limit order type
        - **tif** (string): Time in force ("Ioc", "Gtc", "Alo")
  - **grouping** (string): Order grouping strategy: "na" (Normal Action), "normalTpsl" (Normal with TP/SL), or "positionTpsl" (Position TP/SL)

- **isSpot** (boolean): Whether this is a spot market order

- **builderFee** (string): Builder fee as percentage string (e.g., "0.04%")

- **builderFeeRaw** (integer): Builder fee in basis points (e.g., 40 = 0.04%)

- **builder** (string): Builder address (0x-prefixed hex string)

- **priorityFee** (integer): Priority fee in tenths of a basis point, if specified in the request

- **nextStep** (string): Instructions for next step: sign the hash with private key (ECDSA), then POST /exchange with action, nonce, and signature (r, s, v)

## Code Examples

### CURL

```sh
curl -s -X POST https://docs-demo.hype-mainnet.quiknode.pro/hypercore/exchange \
  -H "Content-Type: application/json" \
  -d '{
  "action": {
    "type": "order",
    "orders": [
      {
        "asset": "BTC",
        "side": "buy",
        "price": "100000",
        "size": "0.001",
        "tif": "ioc"
      }
    ]
  }
}'
```

### JAVASCRIPT

```js
const axios = require('axios');

const data = {
  action: {
    type: "order",
    orders: [
      {
        asset: "BTC",
        side: "buy",
        price: "100000",
        size: "0.001",
        tif: "ioc"
      }
    ]
  }
};

axios.post('https://docs-demo.hype-mainnet.quiknode.pro/hypercore/exchange', data, {
  headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
```

### PYTHON

```py
import requests
import json

url = "https://docs-demo.hype-mainnet.quiknode.pro/hypercore/exchange"

payload = json.dumps({
  "action": {
    "type": "order",
    "orders": [
      {
        "asset": "BTC",
        "side": "buy",
        "price": "100000",
        "size": "0.001",
        "tif": "ioc"
      }
    ]
  }
})

headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

### RUBY

```rb
require "uri"
require "json"
require "net/http"

url = URI("https://docs-demo.hype-mainnet.quiknode.pro/hypercore/exchange")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "action": {
    "type": "order",
    "orders": [
      {
        "asset": "BTC",
        "side": "buy",
        "price": "100000",
        "size": "0.001",
        "tif": "ioc"
      }
    ]
  }
})

response = https.request(request)
puts response.read_body
```

