Agent API
Programmatic access to mylittlechart terminal
Overview
mylittlechart exposes a local REST API on port 17420. It lets AI agents,
scripts, and automation tools read live market data, inspect chart state, control
indicators and drawing objects, and capture chart screenshots — all without any
network round-trips to an external server.
- Listens exclusively on
localhost:17420— never exposed to the network - All data is read from the running terminal process in real time
- Write operations are queued and applied on the next render frame
- One screenshot endpoint is synchronous (5 s timeout)
- No cloud relay, no telemetry, no data leaves your machine
The API server starts automatically with the terminal. No configuration is required to use it locally. Add an API key in User Settings → API Keys to enable authenticated access.
Authentication
Pass your API key as a Bearer token in the Authorization header, or as a query parameter:
Authorization: Bearer YOUR_API_KEY
GET http://localhost:17420/api/v1/bars?api_key=YOUR_API_KEY&symbol=BTCUSDTAccess Tiers
| Tier | Capabilities | Created by |
|---|---|---|
| none | Open access — only if the key registry is empty (local dev mode). Health endpoint is always open. | — |
| read_only | GET all data endpoints. Cannot modify charts, indicators, or drawings. | User Settings UI |
| read_write | All read operations plus POST/PATCH/DELETE for chart control, indicators, and drawings. | User Settings UI |
| admin | All operations including API key management (list, create, delete). | Terminal UI only |
Admin keys can only be created from inside the terminal's User Settings panel. They cannot be created via the API itself — this prevents privilege escalation from a compromised key.
When the key registry is empty, the API runs in open access mode — all endpoints are accessible without authentication. This is the default for fresh installs and local development. Add any key in User Settings to lock it down.
Quick Start
# Health check — no auth required curl http://localhost:17420/api/v1/health # Get 100 candles for BTCUSDT 1H on Binance curl -H "Authorization: Bearer YOUR_KEY" \ "http://localhost:17420/api/v1/bars?exchange=binance&symbol=BTCUSDT&timeframe=1H&limit=100" # List all open windows curl -H "Authorization: Bearer YOUR_KEY" \ http://localhost:17420/api/v1/windows # Capture a screenshot of chart 0 in tab 0 of window 0 curl -X POST -H "Authorization: Bearer YOUR_KEY" \ http://localhost:17420/api/v1/windows/0/tabs/0/charts/0/screenshot # Switch the symbol on a chart (read_write tier) curl -X PATCH -H "Authorization: Bearer YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"symbol":"ETHUSDT","exchange":"binance"}' \ http://localhost:17420/api/v1/windows/0/tabs/0/charts/0/symbol
import requests BASE = "http://localhost:17420/api/v1" HEADERS = {"Authorization": "Bearer YOUR_KEY"} # Fetch recent bars resp = requests.get( f"{BASE}/bars", headers=HEADERS, params={ "exchange": "binance", "symbol": "BTCUSDT", "timeframe":"1H", "limit": 200, }, ) bars = resp.json()["bars"] print(f"Received {len(bars)} candles") # Take a screenshot and save it import base64, pathlib r = requests.post(f"{BASE}/windows/0/tabs/0/charts/0/screenshot", headers=HEADERS) png = base64.b64decode(r.json()["screenshot"]) pathlib.Path("chart.png").write_bytes(png)
CLI Tool
zengeld-agent is a standalone binary that ships with the terminal. It wraps
common API operations behind a simple command-line interface and handles authentication,
retries, and output formatting automatically.
# Binary is placed next to the terminal executable on install # Windows: %LOCALAPPDATA%\mylittlechart\zengeld-agent.exe # Linux / macOS: ~/.local/share/mylittlechart/zengeld-agent # Or build from source cargo build --release --bin zengeld-agent
Configuration file
Place a TOML config at ~/.zengeld-agent.toml to avoid passing flags every time:
# zengeld-agent configuration api_key = "your_key_here" base_url = "http://localhost:17420" # default, change for SSH tunnels timeout = 10 # seconds output = "json" # "json" | "pretty" | "csv"
Usage examples
# Print terminal health zengeld-agent health # Fetch 500 candles as CSV zengeld-agent bars --exchange binance --symbol BTCUSDT --tf 1H --limit 500 --output csv # Save screenshot to file zengeld-agent screenshot --window 0 --tab 0 --chart 0 --out chart.png # List all indicators on a chart zengeld-agent indicators --window 0 --tab 0 --chart 0 # Watch indicator values in real time (polling) zengeld-agent watch --indicator rsi_0 --interval 500ms
Endpoint Reference
All endpoints are prefixed with /api/v1. All responses are JSON unless noted.
{ "status": "ok", "version": "0.4.1", "uptime_s": 3842, "windows": 2, "exchanges": ["binance", "bybit"] }
exchange, symbol, timeframe, limit (max 5000), before (unix ms).
{ "exchange": "binance", "symbol": "BTCUSDT", "timeframe": "1H", "bars": [ { "t": 1741996800000, // open time unix ms "o": 83412.5, "h": 84100.0, "l": 82990.0, "c": 83850.0, "v": 1284.37 }, // ... ] }
{"from_ms": 0, "to_ms": 0, "price_min": 0, "price_max": 0}. All fields optional.
{"symbol": "ETHUSDT", "exchange": "binance"}.
{"type": "rsi", "params": {"period": 14}}. Returns the assigned indicator ID.
{"params": {"period": 21}}.
limit, before.
{ "indicator_id": "rsi_0", "type": "rsi", "params": { "period": 14 }, "series": [ { "t": 1741996800000, "v": 58.34 }, { "t": 1742000400000, "v": 61.07 }, // ... ] }
{"type": "hline", "price": 83000, "color": "#F4CD63", "label": "Support"}.
q (name search), category (trend, oscillator, volume, …).
{"width": 1920, "height": 1080}.
{ "screenshot": "iVBORw0KGgoAAAANSUhEUgAA...", // base64-encoded PNG "width": 1920, "height": 1080, "captured_at":1741996800000 }
{"label": "my-script", "tier": "read_only"}. Admin keys cannot be created here — use the terminal UI.
Write Semantics
POST, PATCH, and DELETE endpoints return 202 Accepted immediately.
The command is enqueued and applied on the terminal's next render frame (typically
under 16 ms). This keeps the API non-blocking and consistent with the terminal's
own frame-based update model.
- Commands are processed in order — multiple writes to the same chart are serialized
- If the terminal is minimized, writes still apply (rendering is paused but state updates are not)
- There is no rollback — invalid parameter values are silently clamped or ignored
- The
/screenshotendpoint is the only exception: it is synchronous and waits for a rendered frame before returning (5 s hard timeout)
{ "accepted": true, "queued_at": 1741996800123 }
Response Format
All responses are JSON with Content-Type: application/json. HTTP status codes follow REST conventions:
| Status | Meaning |
|---|---|
| 200 OK | Successful read. Body contains requested data. |
| 202 Accepted | Write command queued. Will be applied on next frame. |
| 400 Bad Request | Missing or invalid parameters. Body: {"error": "..."}. |
| 401 Unauthorized | No key provided but registry is non-empty. |
| 403 Forbidden | Key exists but tier is insufficient for this endpoint. |
| 404 Not Found | Window, tab, chart, or object ID does not exist. |
| 408 Request Timeout | Screenshot timed out (terminal may be overloaded). |
| 500 Internal Error | Unexpected terminal error. Body: {"error": "..."}. |
{ "error": "window 3 does not exist", "code": "NOT_FOUND" }
Rate Limits
The API has no hard rate limit for local connections. However, the screenshot endpoint is bounded by the terminal's frame rate — back-to-back screenshot calls will queue and each waits for a fresh rendered frame. For continuous monitoring, poll at most once per second per chart to avoid piling up queued captures.
- Data endpoints (
/bars,/indicators/*/values) read from in-memory cache — very fast - Write endpoints are fire-and-forget from the API perspective
- Screenshot is CPU/GPU bound — budget ~50–200 ms per call depending on chart complexity