US ETF REST API documentation
Authenticate with an API key and call Data Captain endpoints for the ETF universe, batch prices, market status, screener, rankings, heatmap, backtesting, and portfolio tools. Official TypeScript and Python SDKs included below.
Official SDKs
Use the official client libraries instead of hand-rolling HTTP calls. Same API key, typed methods for screener, rankings, heatmap, backtest, and portfolio endpoints.
JavaScript / TypeScript
npm · datacaptain@0.1.0
npm install datacaptainimport { DataCaptain } from "datacaptain";
const dc = new DataCaptain({ apiKey: process.env.DATACAPTAIN_API_KEY });
const rankings = await dc.etf.rankings({ category: "return", period: "1y" });Python
PyPI · datacaptain@0.1.0
pip install datacaptainfrom datacaptain import DataCaptain dc = DataCaptain(api_key="YOUR_API_KEY") rankings = dc.etf_screener(return_min=10, period="1y")
Full SDK docs with install + examples →
Packages: npm · PyPI. Source in packages/datacaptain and packages/datacaptain-python.
Authentication
Include your API key in the x-api-key header for all requests.
x-api-key: YOUR_API_KEYErrors & rate limits
Failed responses use a consistent JSON envelope. Include errorId when contacting support.
{
"success": false,
"error": {
"code": "RATE_LIMIT",
"message": "Daily rate limit exceeded. Upgrade your plan for more requests.",
"errorId": "a1b2c3d4e5f6",
"hint": "Check X-RateLimit-Remaining on responses, or GET /v1/developer/usage"
}
}UNAUTHORIZED· HTTP 401 — Missing/invalid JWT or API keyFORBIDDEN· HTTP 403 — Plan gate blocked this path (upgrade required)NOT_FOUND· HTTP 404 — Unknown route or symbolVALIDATION_ERROR· HTTP 400 — Bad query/body parametersRATE_LIMIT· HTTP 429 — Daily API-key quota or IP limit exceededINTERNAL_ERROR· HTTP 500 — Unexpected server failure — include errorId in support tickets
Rate-limit headers
X-RateLimit-Limit— Your plan's daily request capX-RateLimit-Remaining— Requests left today for this API key
Official SDKs expose lastRateLimit / last_rate_limit from these headers after each call. Prefer GET /v1/developer/usage for dashboards.
ETF Endpoints
/v1/etf/list?limit=48&category=technology&sort=return&sortDir=descFreecache: 60sPaginated US ETF universe with filters, sorting, enrichment (issuer, category, expense, AUM), and optional stats. Returns { data, total, limit, offset, stats? }.
/v1/etf/:symbolFreecache: 60sETF research profile — price, metrics, performance periods, OHLCV history, dividends, similar ETFs, AI summary, and risk block.
/v1/etf/heatmap?basket=broad&period=1yFreecache: 60sETF performance heatmap cells by return % for a preset basket or custom symbols.
/v1/etf/heatmap/basketsFreecache: 60sList heatmap basket presets — { baskets: [{ id, label, symbols }] }.
/v1/etf/screener?returnMin=10&expenseMax=0.2&period=1y&sort=returnFreecache: 60sScreen ETFs by return, yield, volatility, expense, AUM, Sharpe, issuer/category flags. Free plan: top 10.
/v1/etf/rankings?metric=return&period=1y&limit=20Freecache: 60sETF leaderboards by return, yield, volatility, CAGR, Sharpe, expense, AUM, or drawdown. Free plan: top 10.
/v1/stocks/prices?symbols=SPY,QQQ,VOOFreecache: 60sBatch ETF prices — latest close for up to 50 tickers. Cached 60s.
/v1/stocks/:symbol/history?startDate=2020-01-01&endDate=2024-12-31Freecache: 60sHistorical OHLCV bars for charts and research. Free plan.
Market
/v1/market/statusFreecache: 30sUS market session status from NYSE calendar (holidays + early closes). Regular 09:30–16:00 ET.
Backtesting & Portfolio
/v1/backtest/buy-and-holdPaidMulti-strategy ETF backtest (also accepts GET). Returns equity curve, tradeEvents, dividendEvents, OHLCV prices, drawdownCurve, Sharpe/Sortino, and more. Paid plan.
/v1/backtest/comparePaidCompare multiple ETFs with the same strategy settings. Returns winner, ranked list, and per-symbol results. Paid plan.
/v1/portfolio/rebalancePaidCompare current holdings to target weights and get buy/sell suggestions. Paid plan. Also accepts GET with JSON query strings.
Developer
/v1/developer/usageFreeUsage stats — plan, requests today, remaining, daily limit, series, endpoint analytics.
WebSocket (Real-Time)
Real-time ETF price streaming (when enabled). Subscribe to ETF symbols for periodic updates.
Subscribe:
{"action":"subscribe","symbols":["SPY","QQQ"]}