Browse the docs

Chart API: OHLCV history

Daily OHLCV history back to 1970 and intraday bars for stocks, indices, crypto, currencies and futures, in the YH chart shape, with dividends and splits.

GET/v8/finance/chart/{symbol}

Request

curl -H "x-api-key: $KEY" \
  "https://api.stockdataapi.com/v8/finance/chart/AAPL?range=1y&interval=1d&events=div,split"

Send your key in the x-api-key header. Try it in the browser with your own key.

Parameters

symbol
pathstringrequired
Symbol such as AAPL, BRK-B, ^GSPC, ES=F, BTC-USD or M&M.NS. Letters, digits and . ^ = & -, at most 20 characters, case-insensitive. Percent-encode ^, = and & in a URL (%5EGSPC, ES%3DF, M%26M.NS).
interval
querystring
Bar size: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo or 3mo. 60m and 1h are the same bars.
Default: 1d
range
querystring
1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max, or any N followed by d, wk, mo or y. Nd counts trading sessions; mo, y and ytd are calendar arithmetic in the exchange's timezone.
period1
queryinteger
Window start in epoch seconds. Takes precedence over range.
period2
queryinteger
Window end in epoch seconds; defaults to now. Must not precede period1.
events
querystring
div and/or split, comma- or pipe-separated, to add dividends and splits.
comparisons
querystring
Comma list of up to 10 symbols to overlay on the base symbol's timestamp grid.
backAdjust
queryboolean
true back-adjusts a continuous futures symbol (ES=F, NQ=F, YM=F, RTY=F) across contract rolls, the way TradingView's B-ADJ does. Daily and intraday intervals only; meta.backAdjust lists the rolls applied.
includePrePost
queryboolean
Accepted for compatibility. Bars are regular-session only, and meta.includePrePost says so.

Also accepted, for compatibility with existing clients, and ignored: region, lang.

Behavior

  • Bars arrive as meta, timestamp, indicators.quote, and indicators.adjclose for daily and coarser bars.
  • Give range or period1/period2 (the period wins). Neither means the whole history (max).
  • A window of more than 50,000 bars is refused with a 400 naming the limit, never truncated. So are comparison overlays totalling more than 50,000 rows.
  • Intraday lookback is bounded by the source: 1m bars for 7 days, 2m–90m for 59 days, hourly for 729 days. A window reaching further back is served from the oldest bar available and labelled with X-Window-Clamped and meta.windowClamped.
  • Bars follow the exchange's own calendar and timezone; futures sessions start at the 18:00 ET reopen. meta.chartPreviousClose is the close of the bar before the served window.
  • A daily chart serves the session in progress from the live quote, so its last candle tracks the market.
  • After a split or dividend is reported, the stored history is restated; until that completes the response carries X-Data-Freshness: partial.
  • An unknown base symbol is a 404 with a YH-style chart.error envelope; unknown comparison symbols are simply omitted.

Example response

{
  "chart": {
    "result": [
      {
        "meta": {
          "symbol": "AAPL",
          "currency": "USD",
          "exchangeName": "NMS",
          "instrumentType": "EQUITY",
          "dataGranularity": "1d",
          "timezone": "EDT"
        },
        "timestamp": [1786175881, 1786262281],
        "indicators": {
          "quote": [
            { "open": [104.0, 103.0], "close": [105.0, 104.5],
              "high": [106.0, 105.1], "low": [103.5, 102.8],
              "volume": [41000000, 38000000] }
          ]
        }
      }
    ],
    "error": null
  }
}
json

Every plan includes this endpoint.

Create your free key