Stax API Docs

API Reference

Build, backtest, deploy, and manage investment strategies programmatically. 21 endpoints across 5 resource types.

BASE URLhttps://api.staxlabs.org/api/v1

Getting 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

bash
git clone https://github.com/Stax-app/stax-skill.git ~/.claude/skills/stax

Then use /stax in any Claude Code session.

Install via Codex

bash
git clone https://github.com/Stax-app/stax-skill.git ~/.codex/skills/stax

CLI Setup

bash
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)

bash
stax login

Opens a browser tab for zero-paste OAuth. Key is saved to ~/.stax/config.json.

One-liner for agents / CI

bash
stax login --key sk_<id>_<secret>

Environment variable

bash
export STAX_API_KEY="sk_<id>_<secret>"

Request header format

Header
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

bash
stax

Launches the REPL. Browse presets, configure strategies, run backtests — all from a guided prompt.

Direct commands

bash
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>

PresetMomentumKey FiltersTop N
Momentum Quality80%ROE ≥ 15%, rev growth ≥ 10%10
Classic Value0%P/E ≤ 15, P/B ≤ 1.515
Dividend Compounder30%div yield ≥ 2%, payout ≤ 60%20
Cash Machine20%FCF yield ≥ 5%, debt/eq ≤ 1.012
Large Cap Core50%market cap ≥ $50B20

Endpoints

Core

3 endpoints

Strategies

5 endpoints

Deployments

6 endpoints

Account

4 endpoints

Community

3 endpoints

Metrics

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

CategoryCountExamples
Profitability12return_on_equity, net_profit_margin, gross_profit_margin, return_on_assets
Valuation14price_to_earnings_ratio, price_to_book_ratio, ev_to_ebitda, price_to_sales_ratio
Growth8revenue_growth, earnings_growth, free_cash_flow_growth, dividend_growth
Liquidity6current_ratio, quick_ratio, cash_ratio, debt_to_equity
Momentum4price_change_1m, price_change_3m, price_change_6m, price_change_12m
Size3market_cap, enterprise_value, shares_outstanding

Filter operators

OperatorDescription
gteGreater than or equal to a raw value
lteLess than or equal to a raw value
gtStrictly greater than a raw value
ltStrictly less than a raw value
percentile_gteAbove the Nth percentile in the universe
percentile_lteBelow 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.

10 / day
Pro
50 / day
Elite
500 / day
Unlimited

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.

LimitValue
Max symbols per backtest1,000
Max date range5 years
Max initial capital$100,000,000
Equity curve max points500
Max trades in response10,000
Max API keys per account5

Stax Labs API v1

Claude Code Skill