# stockmarketapi.ai

> REST API providing structured financial data for 2,373 public companies
> across 8 global stock exchanges: NYSE, NASDAQ, LSE, TSE, TSX, HKEX, ASX,
> and Euronext. Rich profiles, multi-year financial statements, computed
> valuation ratios, price history, and 3,229 ASX annual report PDFs
> (3,204 converted to LLM-ready markdown). Built for AI agents
> and automated trading.

## Documentation

- [API reference (Swagger UI)](https://stockmarketapi.ai/api/docs): interactive docs from the OpenAPI spec.
- [OpenAPI 3.1 spec](https://stockmarketapi.ai/api/openapi.json): machine-readable endpoint schema.
- [Full endpoint reference for LLMs](https://stockmarketapi.ai/llms-full.txt): every endpoint with parameters, in markdown.
- [AI agent setup hub](https://stockmarketapi.ai/ai-agents): per-agent setup for Claude Code, Cursor, Codex CLI, Gemini CLI.
- [AI agent skill file](https://stockmarketapi.ai/skill.md): usage patterns, code examples, and conventions for programmatic consumers.
- [Covered companies directory](https://stockmarketapi.ai/companies): crawlable page per covered company with data-coverage detail.
- [Pricing](https://stockmarketapi.ai/pricing): Free, Pro ($19/mo), Pro Plus ($49/mo). Card or USDC crypto.

## Supported exchanges

- [NYSE](https://stockmarketapi.ai/exchanges/nyse): ~2,400 listings (New York Stock Exchange)
- [NASDAQ](https://stockmarketapi.ai/exchanges/nasdaq): ~3,700 listings
- [LSE](https://stockmarketapi.ai/exchanges/lse): ~1,900 listings (London Stock Exchange)
- [TSE](https://stockmarketapi.ai/exchanges/tse): ~3,900 listings (Tokyo Stock Exchange)
- [TSX](https://stockmarketapi.ai/exchanges/tsx): ~1,500 listings (Toronto Stock Exchange)
- [HKEX](https://stockmarketapi.ai/exchanges/hkex): ~2,500 listings (Hong Kong Exchange)
- [ASX](https://stockmarketapi.ai/exchanges/asx): ~2,200 listings (Australian Securities Exchange)
- [Euronext](https://stockmarketapi.ai/exchanges/euronext): ~1,500 listings (Paris, Amsterdam, Brussels)

## Market indices with live membership API

- [S&P 500](https://stockmarketapi.ai/markets/sp500): 502 members — live membership API at GET /api/v1/indices/SP500
- [NASDAQ 100](https://stockmarketapi.ai/markets/nasdaq100): 102 members — live membership API at GET /api/v1/indices/NASDAQ100
- [Dow Jones Industrial Average](https://stockmarketapi.ai/markets/dow30): 30 members — live membership API at GET /api/v1/indices/DOW30
- [S&P/ASX 200](https://stockmarketapi.ai/markets/asx200): 199 members — live membership API at GET /api/v1/indices/ASX200

## Index information pages (no membership API)

Constituent membership for these indices is not available via the API — the
pages below describe the index itself only:

- [FTSE 100](https://stockmarketapi.ai/markets/ftse100): index profile page only
- [Nikkei 225](https://stockmarketapi.ai/markets/nikkei225): index profile page only

## Data resources

- [List all indices](https://stockmarketapi.ai/api/v1/indices): returns all supported indices with member counts.
- [ASX 200 members (live JSON)](https://stockmarketapi.ai/api/v1/indices/ASX200): all 200 ASX companies.
- [Company profile](https://stockmarketapi.ai/api/v1/companies/BHP): description, industry, HQ, employees, market cap, markdown profile URL.
- [Financials](https://stockmarketapi.ai/api/v1/companies/BHP/financials): multi-year financial statements.
- [Metrics summary](https://stockmarketapi.ai/api/v1/companies/BHP/metrics/summary): P/E, P/B, ROE, ROA, margins, EPS, debt/equity.
- [Filings](https://stockmarketapi.ai/api/v1/companies/BHP/filings?source=asx): annual report PDFs + LLM-ready markdown.
- [News & announcements](https://stockmarketapi.ai/api/v1/companies/BHP/news): recent press releases and ASX announcements.
- [Top companies](https://stockmarketapi.ai/api/v1/stats/top-companies): live mega-cap table with P/E, EPS, volume.
- Complete missing data (paid tiers): `POST /api/v1/companies/{ticker}/complete` queues an on-demand backfill for an untracked or incomplete ticker (creating the company if new); poll `GET /api/v1/companies/{ticker}/completion` for progress_pct and a time estimate.

## Agentic payments (x402)

AI agents can subscribe autonomously using USDC on Base via the x402 protocol:

- `POST /payments/agent-subscribe` — gasless EIP-712, returns API key in two HTTP calls
- Plans: monthly ($19), yearly ($179.40), monthly_plus ($49), yearly_plus ($479.40)
- [Route catalog](https://stockmarketapi.ai/api/v1/agentic/routes): machine-readable x402 pricing

## Authentication

Include an `X-API-Key` header on every request. Keys are free:

```
POST /api/v1/auth/keys
Content-Type: application/json
{"email": "you@example.com"}
```

## Key facts for LLM summarisation

- **8 exchanges**: NYSE, NASDAQ, LSE, TSE, TSX, HKEX, ASX, Euronext
- **Active companies**: 2,373
- **4 index membership lists**: S&P 500 (502), NASDAQ 100 (102), Dow Jones Industrial Average (30), S&P/ASX 200 (199)
- **3,229** ASX annual + half-year report PDFs, **3,204** as LLM-ready markdown
- Company news & ASX announcements with dates, categories, and source links
- 13 computed ratios: P/E, P/B, P/S, ROE, ROA, gross/operating/net margins, EPS, debt-to-equity, current ratio
- Financials refreshed daily (prices) and per-filing (statements)
- Payments via Stripe (card) or USDC crypto (Base, Solana) via x402 protocol
