Orders API
Auto-generated from
openapi-snapshot.json. Do not edit by hand — changes are overwritten byscripts/docs/generate_api_reference.py.
7 endpoints in this group.
GET /api/orders/
List Orders
List orders, newest first. Optional status / symbol filters.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | integer | optional | |
status | query | — | optional | |
symbol | query | — | optional | |
limit | query | integer | optional |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
GET /api/orders/blotter
List Orders Blotter
Blotter view with keyset cursor pagination (created_at DESC, id DESC).
Designed for mobile infinite-scroll:
- Stable under concurrent inserts (keyset > offset).
next_cursoris opaque base64 of(created_at, id).- Filters stack as AND.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | integer | optional | |
limit | query | integer | optional | Page size. Defaults to 50, hard cap 200 for mobile blotter scroll. |
cursor | query | — | optional | Opaque cursor from a previous page’s next_cursor. |
status | query | — | optional | |
symbol | query | — | optional | |
account_id | query | — | optional | |
side | query | — | optional | BUY or SELL |
from | query | — | optional | ISO-8601 lower bound on created_at (inclusive). |
to | query | — | optional | ISO-8601 upper bound on created_at (exclusive). |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
POST /api/orders/place
Place Order
Validate then submit to Schwab.
- On REJECTED: persists row with status=‘REJECTED’, does NOT call Schwab.
- On approved + paper_trading: persists row with status=‘PAPER_FILLED’.
- On approved + live: calls schwab_client.execute_order, persists with status=‘SUBMITTED’ (or ‘SUBMIT_FAILED’ on broker error).
P0-5: requires Idempotency-Key header. Replays return the exact
cached response. Every INSERT/UPDATE here is audited via trigger on
orders (see migration 0057_audit_log) attributed to user_id.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | integer | optional | |
Idempotency-Key | header | — | optional | Client-generated unique id for this request. |
Request body: application/json
Responses
| Code | Description |
|---|---|
201 | Successful Response |
422 | Validation Error |
POST /api/orders/preview
Preview Order
Run validate_trade() without submitting. Safe dry-run for UI.
P1-8: attaches any non-blocking wash-sale warnings. The warning is
informational only and does not affect decision.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
tenant_id | query | integer | optional |
Request body: application/json
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
GET /api/orders/{order_id}
Get Order
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
order_id | path | integer | required | |
tenant_id | query | integer | optional |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
POST /api/orders/{order_id}/cancel
Cancel Order
Cancel an open order. Mutation audited via mutations_audit_log
trigger on orders (see migration 0057_audit_log).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
order_id | path | integer | required | |
tenant_id | query | integer | optional |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |
GET /api/orders/{order_id}/status
Refresh Order Status
Pull latest status from Schwab and persist.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
order_id | path | integer | required | |
tenant_id | query | integer | optional |
Responses
| Code | Description |
|---|---|
200 | Successful Response |
422 | Validation Error |