Orders API
View and manage trading orders.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/orders | List orders |
| GET | /api/v1/orders/:orderId | Get order details |
| GET | /api/v1/orders/:orderId/status | Get order status |
| POST | /api/v1/orders | Place a new order |
| DELETE | /api/v1/orders/:orderId | Cancel an order |
| GET | /api/v1/orders/open-trades | Get open trades |
List Orders
Retrieve orders with optional filtering.
GET /api/v1/orders
Authorization: Bearer <access_token>
Query Parameters
| Parameter | Type | Description |
|---|---|---|
accountId | string | Filter by account ID |
status | string | Filter by status (OPEN, FILLED, CANCELLED, REJECTED) |
symbol | string | Filter by symbol |
limit | number | Max results (default: 50) |
offset | number | Pagination offset |
Response
{
"orders": [
{
"id": "uuid",
"accountId": "uuid",
"brokerOrderId": "ORD123456",
"symbol": "AAPL",
"side": "BUY",
"orderType": "LIMIT",
"quantity": 100,
"filledQuantity": 100,
"limitPrice": 150.00,
"avgFillPrice": 149.95,
"status": "FILLED",
"timeInForce": "DAY",
"createdAt": "2026-02-25T10:00:00Z",
"filledAt": "2026-02-25T10:00:15Z"
}
],
"total": 150,
"limit": 50,
"offset": 0
}
Get Order Details
GET /api/v1/orders/:orderId
Authorization: Bearer <access_token>
Response
{
"id": "uuid",
"accountId": "uuid",
"brokerOrderId": "ORD123456",
"symbol": "AAPL",
"side": "BUY",
"orderType": "LIMIT",
"quantity": 100,
"filledQuantity": 100,
"limitPrice": 150.00,
"stopPrice": null,
"avgFillPrice": 149.95,
"status": "FILLED",
"timeInForce": "DAY",
"duration": "DAY",
"createdAt": "2026-02-25T10:00:00Z",
"updatedAt": "2026-02-25T10:00:15Z",
"filledAt": "2026-02-25T10:00:15Z",
"account": {
"id": "uuid",
"name": "My Trading Account"
}
}
Place Order
Submit a new order for execution.
POST /api/v1/orders
Authorization: Bearer <access_token>
Content-Type: application/json
{
"accountId": "uuid",
"symbol": "AAPL",
"side": "BUY",
"orderType": "LIMIT",
"quantity": 100,
"limitPrice": 150.00,
"timeInForce": "DAY"
}
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | Target account ID |
symbol | string | Yes | Stock symbol |
side | string | Yes | BUY or SELL |
orderType | string | Yes | See Order Types |
quantity | number | Yes | Number of shares |
limitPrice | number | Conditional | Required for LIMIT orders |
stopPrice | number | Conditional | Required for STOP orders |
timeInForce | string | No | See Time in Force |
Response
{
"success": true,
"order": {
"id": "uuid",
"brokerOrderId": "ORD123457",
"status": "PENDING",
"message": "Order submitted successfully"
}
}
Cancel Order
Cancel a pending order.
DELETE /api/v1/orders/:orderId
Authorization: Bearer <access_token>
Response
{
"success": true,
"message": "Order cancellation requested",
"orderId": "uuid"
}
Order Statuses
| Status | Description |
|---|---|
PENDING | Order submitted, awaiting execution |
OPEN | Order is active in the market |
PARTIALLY_FILLED | Some shares filled |
FILLED | Order completely filled |
CANCELLED | Order cancelled by user |
REJECTED | Order rejected by broker |
EXPIRED | Order expired (e.g., DAY order at market close) |
Order Sides
| Side | Description |
|---|---|
BUY | Buy to open or cover |
SELL | Sell to close or short |
BUY_TO_COVER | Buy to cover short position |
SELL_SHORT | Sell short |
Error Responses
Invalid Order
{
"error": "INVALID_ORDER",
"message": "Limit price is required for LIMIT orders"
}
Insufficient Buying Power
{
"error": "INSUFFICIENT_FUNDS",
"message": "Insufficient buying power for this order"
}
Order Not Found
{
"error": "ORDER_NOT_FOUND",
"message": "Order with ID xyz not found"
}
Trading Mode Mismatch
{
"error": "MODE_MISMATCH",
"message": "Cannot place live order while in paper mode"
}