# Open a trade (options, stocks or futures)

`POST https://app.skylit.ai/api/nexus/v1/trades`

API: Nexus.

One route for every asset class. `assetClass` picks the book.

- **Options** are bought to open. Send `contract` as shorthand (like `SPY 600C 10/16`), or `ticker`, `strike`, `direction` and `expiration`. Not both. 1 to 1,000 contracts. A market order fills now at the ask. `"orderType": "limit"` with `limitPrice` rests at your price: it fills at your limit when the ask comes down to it (at the ask right away if the ask's already there when you send it). `timeInForce` is `day` (until 4:00 pm ET; sent after the close, it works the next session) or `gtc` (until 4:00 pm ET on the contract's last trading day).
- **Stocks** take `ticker`, `side` (`buy` or `sell`, where `sell` opens a short) and `quantity`, 1 to 100,000 shares. A market order fills now at the last trade, and refuses a price more than 15 seconds old (`503 stale_quote`). `"orderType": "limit"` with `limitPrice` fills at your limit when a trade prints at or through it (at the last trade right away if it's already there when you send it). `"orderType": "stop"` with `stopPrice` waits for a trade through your stop, then fills at the next trade. Resting stock orders only fill between 9:30 am and 4:00 pm ET (1:00 pm on early-close days), and `gtc` works for 90 days.
- **A resting options or stock open holds back buying power** (contracts x limit x 100, or shares x limit or stop, a short included) until it fills, is cancelled or expires. It answers `201` with the order (`"status": "working"`). If the market's already through your price it fills right away, with `"status": "filled"`, `fillPrice`, `tradeId` and `meta.fill`. Manage it with the Options and stocks resting orders routes. A limit or stop fill isn't posted to Discord and isn't copied.
- **Futures** take `ticker` (a product like `NQ` for the front month, or one contract like `NQZ26`), `side`, `quantity` (1 to 100) and optionally `account`. A market order fills now. `orderType: "limit"` with `limitPrice`, or `"stop"` with `stopPrice`, rests until the market trades through it. `"stop_limit"` takes both: nothing happens until a trade hits your stop, then it works as a limit at `limitPrice` and only fills at that price or better. A buy's limit has to be at or above its stop, a sell's at or below. Add `stopLoss`, `takeProfit` and `trailingStop` for a bracket on any order type: each leg is an order of its own, `held` while the entry rests and `working` once it fills. A resting order can wait on a quiet market. A market order needs a trade in the last 15 seconds to open or add.
- **reduceOnly** stops a sell from opening a short when a stop already took you flat a second earlier. With `reduceOnly: true` the order goes through only if it shrinks what you hold, checked when it books. Otherwise it answers `422 reduce_only_would_open` and nothing is placed. It works on a market order with no bracket.
- Futures go to your practice account unless `account` names another: `"agent"` (your bot's account), `"evaluation"` or `"funded"` when you have exactly one running, or an account id from capabilities. Evaluation and funded accounts keep all their rules (daily loss, max loss, contract cap). Challenge entries can't be traded through the API.
- **`"account": "agent"`** sends an options or stock order to your bot's own paper wallet instead of yours. It holds back the bot's buying power and its trades stay private.
- Already hold the contract? Don't send a second open (`409 duplicate_position`, with `tradeId`): add to it with `POST /api/nexus/v1/trades/{id}/adds`. A limit buy on a contract you hold adds to that position when it fills.
- Add `"test": true` to check and price the order without placing it. See Test orders in the intro.

A new options or stock market trade answers `201` with the trade. A resting options or stock order answers `201` with the order. A futures order answers `201` with the order and its bracket. A repeated `clientOrderId` answers `200` with the first one.

## Authentication

Send your Skylit API key as a bearer token: `Authorization: Bearer <key>`. No other header is accepted.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Your `clientOrderId`, as a header instead of a body field. If you send both they must match. |

## Request body

`application/json`

```json
{
  "assetClass": "options",
  "contract": "string",
  "ticker": "string",
  "direction": "call",
  "strike": 0,
  "expiration": "string",
  "side": "buy",
  "quantity": 0,
  "price": 0,
  "ifOutside": "reject",
  "orderType": "market",
  "limitPrice": 0,
  "stopPrice": 0,
  "timeInForce": "day",
  "stopLoss": 0,
  "takeProfit": 0,
  "trailingStop": false,
  "reduceOnly": false,
  "account": "string",
  "port": "string",
  "clientOrderId": "string",
  "test": false
}
```

## Example request

```bash
curl "https://app.skylit.ai/api/nexus/v1/trades" \
  -H "Authorization: Bearer $SKYLIT_API_KEY"
```

## Responses

### 200

A repeated `clientOrderId`: the first order, with `meta.idempotentReplay: true`. Nothing new was placed.

Shape (placeholder values):

```json
{
  "data": {
    "id": "string",
    "userId": "string",
    "ticker": "string",
    "strike": 0,
    "expiration": "string",
    "direction": "call",
    "assetClass": "options",
    "averageEntryPrice": 0,
    "currentPrice": 0,
    "totalQuantity": 0,
    "remainingQuantity": 0,
    "status": "active",
    "entryDate": "string",
    "exitDate": "string",
    "exits": [
      {
        "id": "string",
        "price": 0,
        "quantity": 0,
        "date": "string",
        "type": "partial",
        "orderType": "string"
      }
    ],
    "source": "string",
    "portId": "string",
    "test": false
  },
  "meta": {
    "fill": {},
    "clientOrderId": "string",
    "idempotentReplay": false,
    "test": false,
    "notChecked": [
      "string"
    ],
    "discordRouting": {},
    "nothingToClose": false,
    "stillOpen": [
      "string"
    ],
    "tradeId": "string",
    "triggerOn": "string",
    "underlyingPrice": 0,
    "marketOpen": false,
    "firesNow": false,
    "wouldFireNow": false,
    "wouldFillNow": false,
    "wouldTriggerNow": false,
    "wouldRestBecause": "string",
    "alreadyCancelled": false
  }
}
```

### 201

Filled, or resting. An options or stock market order answers a `Trade`, an options or stock limit or stop a `WalletOrder`, futures a `FuturesOrder`. A test order is the same shape with `"test": true`.

The options trade, filled at the live ask.:

```json
{
  "data": {
    "id": "6f1c2a4e-8b1d-4c39-9a51-2d7e0b3c9f10",
    "userId": "0b8e5d2c-41a7-4f6e-9c3b-7a1d2e4f5a60",
    "ticker": "SPY",
    "strike": 600,
    "expiration": "2026-10-16",
    "direction": "call",
    "assetClass": "options",
    "tradeType": "simulated",
    "executionStatus": "simulated",
    "averageEntryPrice": 1.84,
    "totalQuantity": 2,
    "remainingQuantity": 2,
    "status": "active",
    "entryDate": "2026-10-09T14:32:05Z",
    "source": "api",
    "createdAt": "2026-10-09T14:32:05Z",
    "updatedAt": "2026-10-09T14:32:05Z"
  },
  "meta": {
    "fill": {
      "price": 1.84,
      "priceSource": "market"
    },
    "clientOrderId": "bot-0142"
  }
}
```

Your price was inside the window, so it was taken. bid and ask are the quote it was checked against.:

```json
{
  "data": {
    "id": "29d0e1f2-a3b4-4c5d-8e6f-809102132435",
    "userId": "0b8e5d2c-41a7-4f6e-9c3b-7a1d2e4f5a60",
    "ticker": "SPY",
    "strike": 600,
    "expiration": "2026-10-16",
    "direction": "call",
    "assetClass": "options",
    "tradeType": "simulated",
    "executionStatus": "simulated",
    "averageEntryPrice": 1.84,
    "totalQuantity": 2,
    "remainingQuantity": 2,
    "status": "active",
    "entryDate": "2026-10-09T14:32:05Z",
    "source": "api"
  },
  "meta": {
    "fill": {
      "price": 1.84,
      "priceSource": "client",
      "bid": 1.82,
      "ask": 1.86
    }
  }
}
```

A stock buy is a long: direction call, strike 0, today's date.:

```json
{
  "data": {
    "id": "3ae1f2a3-b4c5-4d6e-9f80-910213243546",
    "userId": "0b8e5d2c-41a7-4f6e-9c3b-7a1d2e4f5a60",
    "ticker": "AAPL",
    "strike": 0,
    "expiration": "2026-10-09",
    "direction": "call",
    "assetClass": "stocks",
    "tradeType": "simulated",
    "executionStatus": "simulated",
    "averageEntryPrice": 254.31,
    "totalQuantity": 50,
    "remainingQuantity": 50,
    "status": "active",
    "entryDate": "2026-10-09T14:33:40Z",
    "source": "api"
  },
  "meta": {
    "fill": {
      "price": 254.31,
      "priceSource": "market"
    }
  }
}
```

The futures order, filled at the last trade plus one tick.:

```json
{
  "data": {
    "id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
    "assetClass": "futures",
    "source": "api",
    "account": {
      "id": "3c2b1a90-5e4d-4f3a-8b2c-1d0e9f8a7b6c",
      "kind": "practice",
      "name": "Paper"
    },
    "symbol": "NQZ26",
    "side": "buy",
    "quantity": 1,
    "role": "entry",
    "orderType": "market",
    "status": "filled",
    "fillPrice": 25312.25,
    "placedAt": "2026-10-09T14:35:10Z",
    "filledAt": "2026-10-09T14:35:10Z"
  },
  "meta": {
    "fill": {
      "price": 25312.25,
      "priceSource": "market"
    },
    "clientOrderId": "bot-0143"
  }
}
```

The limit order resting, with its stop and target held until it fills.:

```json
{
  "data": {
    "id": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e",
    "assetClass": "futures",
    "source": "api",
    "account": {
      "id": "8d7c6b5a-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
      "kind": "evaluation",
      "name": "50K Evaluation"
    },
    "symbol": "NQZ26",
    "side": "buy",
    "quantity": 1,
    "role": "entry",
    "orderType": "limit",
    "status": "working",
    "limitPrice": 25300,
    "placedAt": "2026-10-09T14:36:00Z",
    "bracket": [
      {
        "id": "c3d4e5f6-a7b8-4c9d-8e0f-2a3b4c5d6e7f",
        "assetClass": "futures",
        "source": "api",
        "account": {
          "id": "8d7c6b5a-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
          "kind": "evaluation",
          "name": "50K Evaluation"
        },
        "symbol": "NQZ26",
        "side": "sell",
        "quantity": 1,
        "role": "stop_loss",
        "orderType": "stop",
        "status": "held",
        "stopPrice": 25280,
        "placedAt": "2026-10-09T14:36:00Z",
        "parentId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e"
      },
      {
        "id": "d4e5f6a7-b8c9-4d0e-9f1a-3b4c5d6e7f80",
        "assetClass": "futures",
        "source": "api",
        "account": {
          "id": "8d7c6b5a-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
          "kind": "evaluation",
          "name": "50K Evaluation"
        },
        "symbol": "NQZ26",
        "side": "sell",
        "quantity": 1,
        "role": "take_profit",
        "orderType": "limit",
        "status": "held",
        "limitPrice": 25340,
        "placedAt": "2026-10-09T14:36:00Z",
        "parentId": "b2c3d4e5-f6a7-4b8c-9d0e-1f2a3b4c5d6e"
      }
    ]
  }
}
```

It only took 1 off the long. Had it been bigger than the position, or on the same side, it would have answered 422 reduce_only_would_open.:

```json
{
  "data": {
    "id": "4bf2a3b4-c5d6-4e7f-8091-021324354657",
    "assetClass": "futures",
    "source": "api",
    "account": {
      "id": "8d7c6b5a-4e3f-4a2b-9c1d-0e1f2a3b4c5d",
      "kind": "evaluation",
      "name": "50K Evaluation"
    },
    "symbol": "NQZ26",
    "side": "sell",
    "quantity": 1,
    "role": "entry",
    "orderType": "market",
    "status": "filled",
    "fillPrice": 25318,
    "placedAt": "2026-10-09T14:52:31Z",
    "filledAt": "2026-10-09T14:52:31Z"
  },
  "meta": {
    "fill": {
      "price": 25318,
      "priceSource": "market"
    },
    "clientOrderId": "nq-trim-0001"
  }
}
```

A test trade. Nothing was placed: it lives in your test log.:

```json
{
  "data": {
    "id": "e5f6a7b8-c9d0-4e1f-8a2b-4c5d6e7f8091",
    "userId": "0b8e5d2c-41a7-4f6e-9c3b-7a1d2e4f5a60",
    "ticker": "SPY",
    "strike": 600,
    "expiration": "2026-10-16",
    "direction": "call",
    "assetClass": "options",
    "averageEntryPrice": 1.84,
    "currentPrice": 1.84,
    "totalQuantity": 2,
    "remainingQuantity": 2,
    "status": "active",
    "entryDate": "2026-10-09T14:40:12Z",
    "test": true
  },
  "meta": {
    "test": true,
    "fill": {
      "price": 1.84,
      "priceSource": "market"
    }
  }
}
```

The limit order, resting. It holds back 2 x 2.00 x 100 = $400 of buying power.:

```json
{
  "data": {
    "id": "5b0e9a6c-3f1d-4c2e-9a7b-1d2e3f4a5b6c",
    "assetClass": "options",
    "source": "api",
    "book": "main",
    "clientOrderId": "spy-dip-0001",
    "ticker": "SPY",
    "strike": 600,
    "direction": "call",
    "expiration": "2026-10-16",
    "side": "buy",
    "positionEffect": "open",
    "quantity": 2,
    "filledQuantity": 0,
    "orderType": "limit",
    "timeInForce": "day",
    "status": "working",
    "limitPrice": 2,
    "reservedCents": 40000,
    "placedAt": "2026-10-12T14:31:07Z",
    "expiresAt": "2026-10-12T20:00:00Z"
  },
  "meta": {
    "clientOrderId": "spy-dip-0001"
  }
}
```

AAPL was already trading under the limit, so it filled right away at the last trade.:

```json
{
  "data": {
    "id": "7d2f4a1b-6c3e-4f5a-8b9c-0d1e2f3a4b5c",
    "assetClass": "stocks",
    "source": "api",
    "book": "main",
    "clientOrderId": "aapl-dip-01",
    "ticker": "AAPL",
    "direction": "long",
    "side": "buy",
    "positionEffect": "open",
    "quantity": 25,
    "filledQuantity": 25,
    "orderType": "limit",
    "timeInForce": "day",
    "status": "filled",
    "limitPrice": 185,
    "fillPrice": 184.9,
    "tradeId": "9e8d7c6b-5a4f-4e3d-8c2b-1a0f9e8d7c6b",
    "reservedCents": 0,
    "placedAt": "2026-10-12T14:35:02Z",
    "filledAt": "2026-10-12T14:35:02Z",
    "expiresAt": "2026-10-12T20:00:00Z"
  },
  "meta": {
    "clientOrderId": "aapl-dip-01",
    "fill": {
      "price": 184.9,
      "quantity": 25,
      "priceSource": "market"
    }
  }
}
```

The short stop, resting. It holds back 25 x 180.00 = $4,500, the same as a buy.:

```json
{
  "data": {
    "id": "1c2d3e4f-5a6b-4c7d-8e9f-0a1b2c3d4e5f",
    "assetClass": "stocks",
    "source": "api",
    "book": "main",
    "clientOrderId": "api-7e6d5c4b-3a2f-4e1d-9c0b-8a7f6e5d4c3b",
    "ticker": "AAPL",
    "direction": "short",
    "side": "sell",
    "positionEffect": "open",
    "quantity": 25,
    "filledQuantity": 0,
    "orderType": "stop",
    "timeInForce": "gtc",
    "status": "working",
    "stopPrice": 180,
    "reservedCents": 450000,
    "placedAt": "2026-10-12T14:36:10Z",
    "expiresAt": "2027-01-10T21:00:00Z"
  }
}
```

The stop-limit, resting until a trade hits 25350.:

```json
{
  "data": {
    "id": "c3d4e5f6-a7b8-4c9d-8e0f-1a2b3c4d5e6f",
    "assetClass": "futures",
    "source": "api",
    "account": {
      "id": "3c2b1a90-5e4d-4f3a-8b2c-1d0e9f8a7b6c",
      "kind": "practice",
      "name": "Paper"
    },
    "symbol": "NQZ26",
    "side": "buy",
    "quantity": 1,
    "role": "entry",
    "orderType": "stop_limit",
    "status": "working",
    "limitPrice": 25355,
    "stopPrice": 25350,
    "placedAt": "2026-10-12T14:40:00Z"
  }
}
```

The trade, on your bot's agent wallet. It never shows anywhere public.:

```json
{
  "data": {
    "id": "4a5b6c7d-8e9f-4a0b-9c1d-2e3f4a5b6c7d",
    "userId": "0b8e5d2c-41a7-4f6e-9c3b-7a1d2e4f5a60",
    "ticker": "SPY",
    "strike": 600,
    "expiration": "2026-10-16",
    "direction": "call",
    "assetClass": "options",
    "averageEntryPrice": 1.86,
    "totalQuantity": 2,
    "remainingQuantity": 2,
    "status": "active",
    "entryDate": "2026-10-12T14:41:30Z",
    "source": "api"
  },
  "meta": {
    "fill": {
      "price": 1.86,
      "priceSource": "market"
    },
    "clientOrderId": "agent-0001"
  }
}
```

### 400

The request was refused before anything was traded. Codes: `bad_request`, `bad_contract`, `invalid_quantity`, `invalid_price`, `unsupported_asset_class`, `unsupported_order_type`, `only_market_orders`, `limit_price_required` (a limit with no `limitPrice`), `invalid_limit_price` (not in cents, or outside 0.01 to 99,999.99 for options or 999,999.99 for stocks), `stop_price_required` (a stop with no `stopPrice`), `invalid_stop_price` (not in cents, or outside 0.01 to 999,999.99), `invalid_take_profit`, `test_orders_unavailable`, `test_modify_unavailable`, `bad_symbol` (a quotes symbol that isn't OCC).

A typo in the body.:

```json
{
  "error": {
    "code": "bad_request",
    "message": "Unknown field \"quantitty\". See the trades API docs for the fields you can send."
  }
}
```

### 401

No key, or a key that isn't valid. Codes: `missing_api_key`, `invalid_api_key`.

No key sent.:

```json
{
  "error": {
    "code": "missing_api_key",
    "message": "Send your Skylit API key in the Authorization header: Authorization: Bearer YOUR_SKYLIT_API_KEY."
  }
}
```

### 403

The key works but the account can't do this. Codes: `account_suspended`, `nexus_access_denied`, `futures_access_denied`.

The account doesn't include Nexus.:

```json
{
  "error": {
    "code": "nexus_access_denied",
    "message": "This Skylit account doesn't include Nexus, so it can't place Nexus trades."
  }
}
```

### 404

Not on your account. Codes: `trade_not_found`, `account_not_found`, `order_not_found`.

Not your trade, or no such trade.:

```json
{
  "error": {
    "code": "trade_not_found",
    "message": "No trade with that id on your account."
  }
}
```

### 409

The order clashes with what you hold or sent before. Codes: `duplicate_position` (with `tradeId`: add to it instead), `trade_closed`, `open_position_limit` (open positions plus resting opens through the API are at 50), `working_order_limit` (50 options and stock orders already resting through the API), `position_size_limit` (an add would take the position past 1,000 contracts or 100,000 shares), `client_order_id_used`, `request_in_progress`, `account_locked`, `account_busy`, `account_ended`, `order_not_working` (it already filled, expired, or was cancelled or rejected), `stop_triggered` (a stop that's been set off is filling now, so it can't be cancelled or changed).

You already hold this contract.:

```json
{
  "error": {
    "code": "duplicate_position",
    "message": "You already hold an open position on this contract. Add to it with POST /api/nexus/v1/trades/{id}/adds (the id is tradeId), or close it first.",
    "tradeId": "6f1c2a4e-8b1d-4c39-9a51-2d7e0b3c9f10"
  }
}
```

### 422

Read fine, but the market or the account says no. Codes: `market_closed`, `contract_expired`, `contract_not_offered`, `price_outside_market`, `insufficient_buying_power`, `account_not_tradable`, `account_ambiguous`, `reduce_only_would_open`, `order_refused`, `order_rejected` (a resting order that tried to fill right away and couldn't; `orderId` points to it). A resting order that can't be covered answers `insufficient_buying_power` with `orderId` too: it's recorded as rejected.

Outside market hours.:

```json
{
  "error": {
    "code": "market_closed",
    "message": "The market is closed for this contract right now, so nothing was filled."
  }
}
```

### 429

Over a rate limit. Wait `Retry-After` seconds, then retry. Codes: `rate_limited`, and `stream_limit_reached` (too many live streams open: 3 per key, 6 per account).

Headers: `Retry-After`, `X-RateLimit-Limit`, `X-RateLimit-Remaining`.

Too many writes from this key.:

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests (limit 30). Slow down and retry in 12 seconds."
  }
}
```

### 500

Something went wrong on our side. If you sent a `clientOrderId`, retry with the same one. Code: `internal_error`.

Retry with the same clientOrderId.:

```json
{
  "error": {
    "code": "internal_error",
    "message": "Something went wrong on our side. If you sent a clientOrderId, retry with the same one (it can't fill twice). Otherwise check your account before retrying."
  }
}
```

### 503

Try again in a moment (honour `Retry-After` when it's sent). Codes: `stale_quote` (the quote, or a stock's last trade, is more than 15 seconds old, so nothing filled), `no_live_price`, `rules_pending`, `unavailable`, `auth_unavailable`, `access_check_unavailable`, `api_keys_unavailable`, `trades_api_disabled`, `stream_unavailable` (the live stream isn't on, or the server is restarting: try again shortly, or poll the reads).

Headers: `Retry-After`.

No live price right now.:

```json
{
  "error": {
    "code": "no_live_price",
    "message": "There's no live price for this contract right now, so nothing was filled. Try again in a moment."
  }
}
```
