API Reference
Build, backtest, deploy, and manage investment strategies programmatically. 21 endpoints across 5 resource types.
https://api.staxlabs.org/api/v1Getting Started
Works with Claude Code, OpenAI Codex, and the Stax CLI. Install once, then use /stax in any Claude Code session or run commands directly from the terminal.
Install via Claude Code
git clone https://github.com/Stax-app/stax-skill.git ~/.claude/skills/stax
Then use /stax in any Claude Code session.
Install via Codex
git clone https://github.com/Stax-app/stax-skill.git ~/.codex/skills/stax
CLI Setup
cd cli && ./setup.sh && stax login
Authentication
All API requests (except GET /health) require a Bearer token. Keys are scoped to your account and can be revoked at any time.
Browser flow (recommended)
stax login
Opens a browser tab for zero-paste OAuth. Key is saved to ~/.stax/config.json.
One-liner for agents / CI
stax login --key sk_<id>_<secret>
Environment variable
export STAX_API_KEY="sk_<id>_<secret>"
Request header format
Authorization: Bearer sk_<id>_<secret>
The secret portion of your key is shown once at creation time. Store it immediately. Keys are hashed at rest — Stax cannot retrieve a lost secret.
CLI
The Stax CLI mirrors the full API surface. Run interactively or chain commands in scripts.
Interactive mode
stax
Launches the REPL. Browse presets, configure strategies, run backtests — all from a guided prompt.
Direct commands
stax backtest # Run a backtest stax screen # Screen the stock universe stax strategies list # List saved strategies stax deploy # Deploy a strategy stax deployments # View active deployments stax account # Show tier, usage, and keys
Built-in presets
Run any preset with stax backtest --preset <name>
| Preset | Momentum | Key Filters | Top N |
|---|---|---|---|
| Momentum Quality | 80% | ROE ≥ 15%, rev growth ≥ 10% | 10 |
| Classic Value | 0% | P/E ≤ 15, P/B ≤ 1.5 | 15 |
| Dividend Compounder | 30% | div yield ≥ 2%, payout ≤ 60% | 20 |
| Cash Machine | 20% | FCF yield ≥ 5%, debt/eq ≤ 1.0 | 12 |
| Large Cap Core | 50% | market cap ≥ $50B | 20 |
Endpoints
Core
3 endpointsStrategies
5 endpointsDeployments
6 endpointsAccount
4 endpointsCommunity
3 endpointsMetrics
Fundamental metrics power both the screening endpoint and strategy filters. All metrics support raw-value operators (gte, lte, gt, lt) and percentile operators (percentile_gte, percentile_lte) that rank within the current screened universe.
Metric categories
| Category | Count | Examples |
|---|---|---|
| Profitability | 12 | return_on_equity, net_profit_margin, gross_profit_margin, return_on_assets |
| Valuation | 14 | price_to_earnings_ratio, price_to_book_ratio, ev_to_ebitda, price_to_sales_ratio |
| Growth | 8 | revenue_growth, earnings_growth, free_cash_flow_growth, dividend_growth |
| Liquidity | 6 | current_ratio, quick_ratio, cash_ratio, debt_to_equity |
| Momentum | 4 | price_change_1m, price_change_3m, price_change_6m, price_change_12m |
| Size | 3 | market_cap, enterprise_value, shares_outstanding |
Filter operators
| Operator | Description |
|---|---|
| gte | Greater than or equal to a raw value |
| lte | Less than or equal to a raw value |
| gt | Strictly greater than a raw value |
| lt | Strictly less than a raw value |
| percentile_gte | Above the Nth percentile in the universe |
| percentile_lte | Below the Nth percentile in the universe |
Rate Limits
Backtest requests are metered per calendar day (UTC). Limits reset at 00:00 UTC. Screening, strategy CRUD, and deployment management are not metered.
Check your current usage at any time with GET /account or stax account. The response includes rateLimits.remaining and rateLimits.resetAt.
Guardrails
Hard limits enforced on every request to keep compute times deterministic.
| Limit | Value |
|---|---|
| Max symbols per backtest | 1,000 |
| Max date range | 5 years |
| Max initial capital | $100,000,000 |
| Equity curve max points | 500 |
| Max trades in response | 10,000 |
| Max API keys per account | 5 |
Stax Labs API v1
Claude Code Skill