API Reference

Base URL: https://api.quantfetch.ai

All endpoints return JSON. All requests must include Authorization: Bearer <api_key> header.

Authentication

Authenticate with an API key passed as a Bearer token in the Authorization header:

# All requests Authorization: Bearer qfp_your_api_key_here Content-Type: application/json

Get your API key from the CLI:

quant > /api-key # Or via the API: POST /api/v1/auth/register POST /api/v1/auth/login

Endpoints

GET /api/v1/credits

Get current credit balance and subscription tier for the authenticated user.

{ "balance": 1847, "tier": "pro", "resets_at": "2026-05-01T00:00:00Z", "monthly_included": 2000 }
POST /api/v1/credits/purchase

Create a Polar.sh checkout session to purchase a credit top-up pack.

Body:

packstring"1000" | "5000" | "20000"
{ "checkout_url": "https://polar.sh/checkout/...", "session_id": "ps_" }
POST /api/v1/analyze

Run 4-agent AI analysis (valuation, fundamentals, technicals, sentiment) on a single ticker. Costs 25 credits.

Body:

tickerstringStock symbol, e.g. "AAPL"
{ "signal": "BUY", "confidence": 78, "valuation": { "intrinsic_value": 187.40, "upside": "23%" }, "fundamentals": { "verdict": "positive", "details": "..." }, "technicals": { "signal": "bullish", "details": "..." }, "sentiment": { "score": 73, "verdict": "bullish" }, "risk": { "var_30d": 4200, "max_drawdown": "-12.3%" } }
POST /api/v1/risk

Get risk metrics for a portfolio or single position. Costs 15 credits.

Body:

tickerstringStock symbol (optional if holdings provided)
holdingsarrayArray of {symbol, quantity, avg_cost}
{ "portfolio_volatility": 0.18, "var_95": 8400, "max_drawdown": "-12.3%", "sharpe_ratio": 1.34, "beta": 1.12, "position_risks": [...] }
POST /api/v1/backtest

Run a Python trading strategy against historical data. Costs 200–500 credits depending on date range.

Body:

strategystringPython code — must define `generate_signals(price_data)`
tickersarrayList of symbols, e.g. ["AAPL", "MSFT"]
start_datestringYYYY-MM-DD
end_datestringYYYY-MM-DD (default: today)
POST /api/v1/subscriptions/tiers

List available subscription tiers.

{ "tiers": [{ "id": "free", "name": "Free", "price": 0, "credits": 100 }, ...] }
POST /api/v1/subscriptions/subscribe

Subscribe to a tier via Polar.sh checkout.

tierstring"pro" | "alpha"
GET /api/v1/sec/companies

List SEC-registered companies in the QuantFetch database.

searchstringOptional name/CIK search
limitintDefault 50, max 500
GET /api/v1/sec/filings

Search SEC filings (10-K, 10-Q, 8-K, etc.)

tickerstringStock symbol
form_typestring"10-K" | "10-Q" | "8-K" | "13F" | "4"
sincedateYYYY-MM-DD — optional date filter
GET /api/v1/sec/13f/{ticker}

Get latest 13F institutional holdings for a ticker.

GET /api/v1/sec/insider/{ticker}

Get insider trades (Form 4) for a ticker.

GET /api/v1/prices/{ticker}

Get OHLCV price data.

startdateYYYY-MM-DD
enddateYYYY-MM-DD
intervalstring"1d" | "1h" | "5m"
GET /api/v1/news

Get financial news and earnings announcements.

tickerstringOptional ticker filter
limitintDefault 20

Error Responses

{ "error": "insufficient_credits", "message": "Not enough credits. Required: 25. Balance: 12.", "code": 402 }
401Invalid or missing API key
402Insufficient credits for this operation
403Feature not available on your tier
404Ticker or resource not found
429Rate limit exceeded. Upgrade for higher limits.
500Internal server error

Full OpenAPI 3.1 schema available at: GET /docs/api.json