All /api/* routes marked [auth] require an active session cookie. Obtain one via POST /api/login.
Bridge endpoints authenticate via a shared secret (BRIDGE_HEARTBEAT_SECRET) sent in the request body or as a query parameter. No session cookie required.
Webhook endpoints authenticate via TV_WEBHOOK_SECRET in the JSON payload body ("secret": "...").
Authenticate the operator session.
Request:
{ "password": "your-dashboard-password" }Response:
{ "ok": true }Sets a session cookie. If DASHBOARD_PASSWORD is not configured, always succeeds.
Clear the session.
Response: { "ok": true }
Check authentication state.
Response:
{ "authenticated": true, "password_required": true }Returns the full in-memory state dict with all computed flags, lock states, connectivity indicators, and tempo token status.
This endpoint also runs self-healing logic (releases expired locks, backfills missing fields for older Firestore snapshots, computes zone type).
Response: Full state dict — see services/state_manager.py for the complete structure.
Create a market or pre-order entry.
Request (asset-aware entry):
{
"asset": "ES",
"trade_mode": "SCALP", // or "RUNNER"
"order_type": "market", // or "preorder"
"direction": "BUY", // required in FREE zone; omit in NORMAL zone
"entry_size_mode": "6pt", // or "9pt"
"entry_override": false // true = bypass structural gates (use with care)
}Constraint checks (in order):
- Daily stop not triggered
- Post-exit cooldown not active
- 5-minute candle lock not active
- No existing pending order
- No open position (no pyramiding)
- Heartbeat fresh (< 10 minutes)
- Tempo token READY
- Zone entry gate: 8pt/12pt structure agrees or FREE zone with explicit direction
Response (success):
{ "ok": true, "order": { "id": "...", "symbol": "MESM6", "side": "BUY", "qty": 5 }, "state": {...} }Response (blocked):
{ "ok": false, "error": "5 MIN LOCK ACTIVE — one trade already used this candle (04:23 remaining)" }Bridge polling endpoint. Returns orders with status: "PENDING" for the bridge to claim and execute.
Query params:
secret— must equalBRIDGE_HEARTBEAT_SECRETlimit— max results (default: 20)owner— claimant identifier (default: "bridge")
Response:
{
"ok": true,
"orders": [
{ "id": "...", "asset": "MESM6", "exchange": "CME", "side": "BUY", "qty": 5, "mode": "A", "env": "LIVE", "kind": "ENTRY" }
]
}Report execution status for an order. Called by the VPS bridge.
Request:
{
"status": "FILLED", // WORKING | FILLED | REJECTED | CANCELLED
"extra": {
"fill_price": 5250.25,
"symbol": "MESM6",
"side": "BUY",
"qty": 5
}
}Manually exit an open position.
Request:
{ "asset": "ES", "force": false }force: true bypasses the initial exit lock (emergency override).
Response: { "ok": true, "order": { "id": "..." } }
Close all open positions across all assets.
Request:
{ "force": true }Response:
{
"ok": true,
"orders": [{ "asset": "ES", "order_id": "...", "side": "SELL", "qty": 5 }],
"skipped": []
}Add to an open position (only available when scale_in_available = true).
Request:
{ "asset": "ES" }Enable/disable the protect feature (soft stop based on open points).
Request:
{
"asset": "ES",
"enabled": true,
"threshold": -2.0 // allowed: -2.0 or 0.5 points
}Enable/configure the points TP (auto-exit at target open points).
Request:
{ "asset": "ES", "enabled": true, "target": 15.0 }Arm/disarm the signal-count TP (exits after N opposite 6pt bars).
Request (toggle arm):
{ "asset": "ES", "tp_arm": "toggle" }Request (set target):
{ "asset": "ES", "tp_target": 3, "reset": true }Toggle the 8pt next-bar exit (exits on the next 8pt bar after arming).
Request:
{ "asset": "ES" }Toggle the 6pt flip exit (exits when 6pt bar flips opposite to position).
Request:
{ "asset": "ES" }Toggle the 4pt invalidation exit (exits when 4pt bar flips opposite to position).
Request:
{ "asset": "ES" }Set the auto-exit timeframe. Currently locked to "6pt" — this endpoint is a no-op that confirms the setting.
Request:
{ "asset": "ES" }Create a next-bar entry intent. The system marks READY on the next 6pt bar and auto-expires one bar later if unused.
Request:
{ "asset": "ES" }Cancel an active entry intent.
Request:
{ "asset": "ES" }Cancel an active pre-order.
Request:
{ "asset": "ES" }Always returns 423 — manual 2.5pt lock management is disabled. The lock is automatic only.
Manually consume one daily trade counter slot. Used for reconciliation.
Switch between DEMO and LIVE execution modes.
Request:
{ "env": "LIVE" }VPS bridge status update. Requires secret in body.
Request:
{
"secret": "...",
"tsConnected": true,
"mdConnected": true,
"repoOk": true,
"account": "U12345",
"tradeRoute": "PAPER",
"lastRapiEventUtc": "2024-01-15T14:32:00Z"
}PnL and position update from the VPS bridge. Triggers daily stop check and auto-exit evaluation.
Request:
{
"secret": "...",
"realized": 250.0,
"unrealized": -125.0,
"accountBalance": 50125.0,
"symbols": [
{ "symbol": "MESM6", "position": 5, "openPnl": -125.0 }
]
}All webhook endpoints accept POST and require "secret": "{{TV_WEBHOOK_SECRET}}" in the body.
Price connectivity heartbeat. Updates last_heartbeat_ts and last_price.
{ "secret": "...", "symbol": "ES", "price": 5250.25, "timestamp": 1705329120 }4pt Renko bar update.
{ "secret": "...", "asset": "ES", "color": "green", "bar_id": "2024-01-15T14:30:00" }2.5pt Renko bar update.
6pt Renko bar update (main/tempo timeframe).
8pt Renko bar update (structure timeframe).
12pt Renko bar update (macro timeframe).
1pt Renko visual update (no behavioral effect).
1pt Renko visual update (alternate endpoint alias).
Horizontal price level exit trigger. Creates an exit order for the named asset.
{ "secret": "...", "asset": "ES" }