# IEX API (beta) — guide for AI agents > US equity market data derived from the IEX exchange feed: full-history daily > OHLC files per ticker, and a 15-minute-delayed intraday midquote API. > Base URL: https://iex.sparcero.com Version prefix: /api/beta ## Authentication Every request under /api/ needs a query parameter `api_key`: https://iex.sparcero.com/api/beta/...?api_key=spk_xxxxxx The key is a string starting with `spk_`. Ask the user for it; never invent one. Missing or unknown key -> HTTP 401 {"error":"Invalid API token."} ## Limits - 250,000 requests per key per day - 10,000 MB (10,000,000,000 bytes) of response data per key per day - Counters reset at 00:00 UTC - Exceeded -> HTTP 429 {"error":"Daily request limit exceeded."} or {"error":"Daily bandwidth limit exceeded."}. Do not retry until the next UTC day. - Daily files are large (full history since 2016). Download once and cache locally instead of re-fetching per question. ## Tickers Uppercase symbols as listed on US exchanges, e.g. AAPL, MSFT, SPY. Share classes / preferreds use a dash in file names: ABR-A, AAIC-B. An unknown ticker returns HTTP 404 {"error":"Not Found"} (daily files) or null / missing entries (midquote API). --------------------------------------------------------------------------- ## Part 1 — Daily OHLC files (JSONL) GET /api/beta/files/ticker/{TYPE}/{TICKER}.jsonl?api_key=... TYPE is one of: | TYPE | Contents | |-----------------|--------------------------------------------------| | ohclv | Daily OHLC + volume from trades on IEX | | midQuotesOHCL | Daily OHLC of the bid/ask midpoint | | bidQuotesOHCL | Daily OHLC of the best bid | | askQuotesOHCL | Daily OHLC of the best ask | (Note the spelling: "ohclv" and "OHCL", not "ohlc".) Response: Content-Type application/json, body is JSON Lines — one JSON object per line, one line per trading day, ascending by date, starting 2016-12-12 (or the ticker's first IEX day). Example line (ohclv): {"date":"2016-12-12","open":1132900,"high":1150000,"low":1125000,"close":1132100,"volume":351105,"last_timestamp":1481576394429003917} Example line (midQuotesOHCL / bidQuotesOHCL / askQuotesOHCL — no volume): {"date":"2016-12-12","open":1133150,"high":1136400,"low":1122050,"close":1128650,"last_timestamp":1481576399451172260} Fields: - date trading day, YYYY-MM-DD (US/Eastern session date) - open,high,low,close INTEGER prices in units of 1/10,000 USD. DIVIDE BY 10000 to get dollars: 1132900 -> 113.29 - volume (ohclv only) shares traded on IEX that day. This is IEX volume only, not consolidated market volume. - last_timestamp IEX exchange timestamp of the last event, nanoseconds since Unix epoch (UTC). Divide by 1e9 for seconds. Prices are NOT adjusted for splits or dividends. Detect splits yourself if you compute long-range returns. ### Example: Python import json, urllib.request url = "https://iex.sparcero.com/api/beta/files/ticker/ohclv/AAPL.jsonl?api_key=" + API_KEY with urllib.request.urlopen(url) as r: rows = [json.loads(line) for line in r.read().decode().splitlines() if line] for row in rows: for k in ("open", "high", "low", "close"): row[k] /= 10000 print(rows[-1]) ### Example: curl + jq (last 5 closes in dollars) curl -s "https://iex.sparcero.com/api/beta/files/ticker/ohclv/AAPL.jsonl?api_key=$KEY" \ | tail -n 5 | jq -c '{date, close: (.close/10000), volume}' --------------------------------------------------------------------------- ## Part 2 — Intraday midquote API (JSON, 15-minute delayed) Base: /api/beta/midquote/ Embargo: every record is filtered on its IEX timestamp; nothing newer than now - 900 s (+5 s margin) is ever returned. "Latest" means latest delayed. Prices here are DECIMAL USD (floats), not 1/10,000 integers. Timestamps `ts` are nanoseconds since epoch (UTC); `utc` is ISO-8601. Dates are YYYYMMDD. Session = one IEX trading day. Every successful response includes: "delay_seconds": 900, "as_of": "" Responses carry Cache-Control until the next minute boundary; polling faster than once per minute returns nothing new. ### GET /api/beta/midquote/latest/{TICKER} ### GET /api/beta/midquote/latest?tickers=AAPL,MSFT (max 200 tickers) Latest delayed quote per ticker plus the prior session's close. { "snapshot_minute": "20261110T2000Z", "data": { "AAPL": {"ts": 1794..., "utc": "2026-11-10T19:59:58+00:00", "mid": 351.2, "bid": 351.18, "ask": 351.22, "prev_close": 348.9, "prev_close_date": "20261109"}, "XXXX": null }, "delay_seconds": 900, "as_of": "..." } A ticker is null when it has no in-hours quote in the snapshot. Change % is not provided: compute (mid - prev_close) / prev_close yourself. Optional: max_age=SECONDS — treat quotes older than that as null. ### GET /api/beta/midquote/snapshot ### GET /api/beta/midquote/snapshot?tickers=AAPL,MSFT Whole market (or filtered) latest delayed quotes: {"snapshot_minute": "...", "count": 8123, "data": {"AAPL": {"ts": ..., "mid": ..., "bid": ..., "ask": ...}, ...}, ...} Tickers without a valid in-hours quote are omitted. Optional: max_age=SECONDS. The full snapshot is large; prefer `tickers=` or `latest` when you can. ### GET /api/beta/midquote/bars/{TICKER}?date=YYYYMMDD ### GET /api/beta/midquote/bars/{TICKER}?days=N (N = 1..5) One-minute bars. Without date/days: the most recent session. `days` wins over `date`. Sessions are returned oldest first. { "ticker": "AAPL", "sessions": [ {"date": "20261110", "count": 712, "wide_excluded": 3, "spikes_excluded": 1, "volume": 1438187, "open": 344.1, "close": 351.2, "prev_close": 348.9, "prev_close_date": "20261109", "series": [ BAR, BAR, ... ]} ], "session_count": 1, "total_bars": 712, "date": ..., "count": ..., "volume": ..., "prev_close": ..., "series": [...], "quality": "clean", "max_spread_bps": 100, "spike_pct": 0.25, "spike_window": 10, "delay_seconds": 900, "as_of": "..." } The top-level date/count/volume/prev_close/series duplicate the most recent session for convenience. For multi-day work iterate `sessions`. BAR fields: - minute HHMM (UTC) of the bar - ts IEX timestamp of the bar's closing quote, ns since epoch - utc ISO-8601 of ts - mid the bar's published price (= c) - o h l c midquote open/high/low/close for the minute - v shares traded on IEX in the minute - tc trade count - vw volume-weighted average trade price (null if no trades) - n number of valid quote updates - sp bid/ask spread at the closing quote, in basis points - ch cl high/low using only tight quotes - cn number of tight quotes (0 = no tight two-sided market this minute) - ok false = no trustworthy price this minute (only seen with quality=raw) Minutes with no activity have no bar — gaps are normal, do not assume a continuous series. Volume is IEX-only. ### GET /api/beta/midquote/intraday/{TICKER} Same parameters as `bars`, lighter payload: each series entry has only minute, ts, utc, mid. Use it for charts / price paths. ### GET /api/beta/midquote/sessions {"sessions": ["20261105", ..., "20261111"], "count": 5, ...} Trading days available for intraday (up to the last 5). Weekends, holidays and partial captures are excluded. For older history use the daily files (Part 1). ### GET /api/beta/midquote/status Pipeline health, no market data: {"servable_minute": "...", "tickers": 8123, "daemon_last_key": "202611101959", "daemon_updated": "...", "daemon_lag_minutes": 16, "caught_up": true, ...} If caught_up is false or other endpoints return 503, data is temporarily behind; wait and retry later. ### Optional parameters for bars / intraday - hours=ext|rth|all ext (default) 08:00–20:00 ET (pre-market + regular + after-hours) rth 09:30–16:00 ET (regular trading hours only) all no filter (debugging) - quality=clean|raw|strict clean (default) drops minutes whose book was wider than max_spread_bps and one-minute spikes that revert strict also drops any minute without a tight quote raw no filtering; flags kept in `ok` - max_spread_bps=N width threshold for clean (default 100, min 1) - spike_pct=N minimum % move to count as a spike (default 0.25) - spike_window=N bars each side used to judge spikes (default 10, 2..60) Use rth + clean for "regular session" analysis such as open/close prices. --------------------------------------------------------------------------- ## Errors All errors are JSON: {"error": "", ...extra} | HTTP | error | Meaning / action | |------|---------------------------------|-----------------------------------------| | 400 | invalid_ticker | Bad symbol format | | 400 | ticker_required | latest needs /{TICKER} or ?tickers= | | 400 | invalid_date | Use YYYYMMDD | | 400 | invalid_days | days must be 1..5 | | 401 | Invalid API token. | Missing/wrong api_key | | 404 | Not Found / 404 Not Found | Unknown ticker file or path | | 404 | not_a_trading_session | Date is weekend/holiday/not captured | | 404 | unknown_endpoint | Lists available midquote endpoints | | 429 | Daily ... limit exceeded. | Stop; resets 00:00 UTC | | 503 | no_data_available | Pipeline behind; retry in a few minutes | ## Which endpoint should I use? - Historical daily prices / returns / volume -> files/ticker/ohclv - Daily quote-based prices (no trade needed) -> files/ticker/midQuotesOHCL - Daily bid/ask range -> bidQuotesOHCL / askQuotesOHCL - "What is X trading at?" (15 min delayed) -> midquote/latest/{TICKER} - Many tickers at once -> midquote/latest?tickers=... - Intraday chart today / last few days -> midquote/intraday or bars - Which days have intraday data -> midquote/sessions ## Agent rules of thumb 1. Always include api_key; never print the user's real key in output. 2. Daily-file prices: divide by 10000. Midquote API prices: already dollars. 3. All data is delayed at least 15 minutes — say so when reporting prices. 4. Volume is IEX exchange volume only, a fraction of total US volume. 5. Daily prices are unadjusted for splits/dividends. 6. Cache daily files; they only gain one line per trading day.