NO QUOTE FEED

AI stock index API

Daily historical data for the HAI Composite, an equal-weighted index of 53 publicly traded AI stocks, and for every constituent: index levels, OHLCV prices and a one-call matrix of closes. JSON or CSV, over plain HTTPS GET. Free and open: no sign-up and no key for up to 10 requests per 5 minutes.

One request
curl "https://happyai.today/api/v1/index/history?range=1y"
Endpoints
5
read-only GET
Constituents
53
AI stocks in the index
Formats
JSON · CSV
history endpoints
Ranges
6
1m · 3m · 6m · ytd · 1y · max
Refresh
15 min
hourly outside US market hours
Access
Public
10 requests per 5 minutes without a key

Quick start

  1. Call any endpoint under https://happyai.today/api/v1. No key and no sign-up: you get 10 requests per 5 minutes per IP address.
  2. Need more? Ask for an API key and send it in the X-API-Key header. Requests with a key are not rate limited.
One year of index levels — no key
curl "https://happyai.today/api/v1/index/history?range=1y"
The same, with a key
curl -H "X-API-Key: $HAI_API_KEY" \
  "https://happyai.today/api/v1/index/history?range=1y"
Response
{
  "index": "HAI Composite",
  "range": "1m",
  "base": 1000,
  "baseDate": "2025-10-23",
  "from": "2026-10-26",
  "to": "2026-11-25",
  "count": 22,
  "data": [
    {
      "date": "2026-10-26",
      "level": 1251.08
    },
    {
      "date": "2026-10-27",
      "level": 1263.9
    }
  ]
}

Access & keys

Without a key
10 requests
per 5 minutes, per IP address
With an API key
No rate limit
issued on request

The API is public. Past the limit, requests without a key get 429 with a Retry-After header until the five-minute window clears. The limit is enforced at the edge and is approximate: a short burst can slip a few requests over before it takes hold.

For higher rates, request an API key: write to admin@lunaratech.com and say what you are building. A key looks like hai_ followed by 40 letters and digits. It is shown once when it is created; only a hash of it is stored, so a lost key is replaced, not recovered. Send it one of three ways:

WhereHowUse it for
HeaderX-API-Key: hai_…Recommended.
Bearer tokenAuthorization: Bearer hai_…Clients that only speak bearer auth.
Query string?api_key=hai_…Spreadsheets and tools that cannot set headers. URLs end up in logs and history, so prefer a header.

Treat a key like a password: keep it on your server, out of browser code and public repositories. If one leaks, ask for it to be revoked; a revoked key stops working within a few minutes. A request that sends an unknown or expired key is refused with 403, not served at the public rate.

Every response carries Access-Control-Allow-Origin: *, so a web page can call the API without a key. Requests that set a key header are not supported from a browser.

Endpoints

EndpointReturnsFormats
GET /indexThe HAI Composite's latest level, base and constituent count.JSON
GET /index/historyDaily HAI Composite levels.JSON, CSV
GET /constituentsEvery stock in the index, with its segment, weight and the dates its history covers.JSON
GET /constituents/{symbol}/historyDaily open, high, low, close and volume for one constituent.JSON, CSV
GET /constituents/historyDaily closes for every constituent on one shared date axis. As CSV: one row per day, one column per symbol.JSON, CSV

Base URL https://happyai.today/api/v1. All endpoints are read-only GET requests over HTTPS.

Index summary

GET /api/v1/index

The HAI Composite's latest level, base and constituent count.

base, baseDate
The index was set to base on baseDate. Levels are comparable across the whole history.
asOf
Date of the latest level (New York trading day).
level
Latest index level.
changePct
Percent change from the previous level.
JSON
{
  "index": "HAI Composite",
  "description": "Equal-weighted index of the AI stocks tracked by HAI Terminal. Each day's return is the mean of the constituents' daily returns.",
  "weighting": "equal",
  "currency": "USD",
  "base": 1000,
  "baseDate": "2025-10-23",
  "constituents": 53,
  "asOf": "2026-11-25",
  "level": 1284.37,
  "changePct": 0.4132
}

Index history

GET /api/v1/index/history?range=1y&format=json

Daily HAI Composite levels.

from, to, count
First date, last date and number of rows returned.
data[].date
Trading day, YYYY-MM-DD.
data[].level
Index level at the close.
JSON
{
  "index": "HAI Composite",
  "range": "1m",
  "base": 1000,
  "baseDate": "2025-10-23",
  "from": "2026-10-26",
  "to": "2026-11-25",
  "count": 22,
  "data": [
    {
      "date": "2026-10-26",
      "level": 1251.08
    },
    {
      "date": "2026-10-27",
      "level": 1263.9
    }
  ]
}
CSV (format=csv)
date,level
2026-10-26,1251.08
2026-10-27,1263.9

Constituents

GET /api/v1/constituents

Every stock in the index, with its segment, weight and the dates its history covers.

data[].symbol
Ticker. Use it in the constituent history endpoint.
data[].segment
One of semis, platforms, software, infra, robotics.
data[].weight
Index weight. Equal weighting: 1 ÷ the number of constituents.
data[].firstDate, lastDate
The span of daily history available for the symbol.
JSON
{
  "index": "HAI Composite",
  "weighting": "equal",
  "count": 53,
  "data": [
    {
      "symbol": "NVDA",
      "name": "NVIDIA",
      "segment": "semis",
      "segmentLabel": "Semiconductors",
      "weight": 0.0189,
      "thesis": "Dominant supplier of AI training and inference accelerators.",
      "firstDate": "2025-10-23",
      "lastDate": "2026-11-25"
    }
  ]
}

Constituent history

GET /api/v1/constituents/{symbol}/history?range=1y&format=json

Daily open, high, low, close and volume for one constituent.

{symbol} is a constituent ticker such as NVDA, in any letter case. The constituents endpoint lists the valid ones.

adjusted
Prices are adjusted for splits and dividends.
data[].open … close
Daily prices in USD.
data[].volume
Shares traded.
JSON
{
  "symbol": "NVDA",
  "name": "NVIDIA",
  "range": "1m",
  "adjusted": true,
  "currency": "USD",
  "from": "2026-10-26",
  "to": "2026-11-25",
  "count": 22,
  "data": [
    {
      "date": "2026-10-26",
      "open": 213.105,
      "high": 217.75,
      "low": 212.61,
      "close": 216,
      "volume": 90829289
    }
  ]
}
CSV (format=csv)
date,open,high,low,close,volume
2026-10-26,213.105,217.75,212.61,216,90829289

All constituents, one call

GET /api/v1/constituents/history?range=1y&format=json

Daily closes for every constituent on one shared date axis. As CSV: one row per day, one column per symbol.

symbols
Constituents, in column order.
dates
Trading days, oldest first.
closes[symbol]
One close per entry in dates. null (an empty CSV cell) when the symbol has no bar that day.
JSON
{
  "index": "HAI Composite",
  "range": "1m",
  "field": "close",
  "adjusted": true,
  "from": "2026-10-26",
  "to": "2026-11-25",
  "count": 22,
  "symbols": [
    "NVDA",
    "AMD",
    "AVGO"
  ],
  "dates": [
    "2026-10-26",
    "2026-10-27"
  ],
  "closes": {
    "NVDA": [
      216,
      217.94
    ],
    "AMD": [
      531.28,
      540.1
    ],
    "AVGO": [
      329.17,
      null
    ]
  }
}
CSV (format=csv)
date,NVDA,AMD,AVGO
2026-10-26,216,531.28,329.17
2026-10-27,217.94,540.1,

Parameters

History endpoints take two optional query parameters.

ParameterValuesMeaning
range1mLast 30 days
3mLast 91 days
6mLast 182 days
ytdSince 1 January
1yLast 365 days (default)
maxEverything on record
formatjsonJSON object with metadata and a data array (default)
csvHeader row, then one row per trading day

Ranges count back in calendar days from the most recent trading day on record. Need a custom window? Request a wider range and filter on date; rows are always sorted oldest first.

Errors

Errors use ordinary HTTP status codes and a JSON body with a stable code to branch on and a message for people.

StatusCodeMeaning
400invalid_rangerange is not one of the supported values.
400invalid_formatformat is not json or csv, or csv was asked of a JSON-only endpoint.
403invalid_api_keyThe key is not recognised or has been revoked.
403expired_api_keyThe key has passed its expiry date.
404unknown_symbolThe symbol is not an index constituent.
404not_foundNo such endpoint or API version.
405method_not_allowedThe API is read-only. Use GET.
429rate_limitedToo many requests without an API key. Wait five minutes, or use a key.
Error body
{
  "error": {
    "code": "invalid_range",
    "message": "range must be one of 1m, 3m, 6m, ytd, 1y, max.",
    "docs": "https://happyai.today/developers/"
  }
}

Data notes

How the index is built
Each day's index return is the simple mean of the constituents' daily returns: an equal-weighted basket, rebalanced daily. The level started at 1000 on the base date. ETFs shown on the site are not in the index.
Constituents change
Stocks are added and dropped as the AI landscape moves. A new name joins from its second trading day on record, so it never causes a jump in the level. Past levels are not restated for changes in membership.
Freshness
Data is rebuilt every 15 minutes during US market hours and hourly otherwise. During the session the latest row is the day in progress, built from delayed quotes; it settles after the close.
Adjusted prices
Constituent prices are adjusted for splits and dividends, so earlier rows can be revised after a corporate action. Index levels inside roughly the last year can shift slightly for the same reason; older levels are fixed.
Caching
Responses can be cached for 60 seconds. Daily history does not need polling faster than that; once a minute at most is plenty.
Terms
The data is provided as is, for information only, with no guarantee of accuracy or availability. Nothing here is investment advice.

Code examples

curl — full NVDA history to a CSV file
curl -o nvda.csv \
  "https://happyai.today/api/v1/constituents/NVDA/history?range=max&format=csv"
Python — pandas
import io, os
import pandas as pd
import requests

BASE = "https://happyai.today/api/v1"
# Works without a key (10 requests per 5 minutes). A key lifts the limit.
KEY = os.environ.get("HAI_API_KEY")
HEADERS = {"X-API-Key": KEY} if KEY else {}

def frame(path, **params):
    r = requests.get(f"{BASE}{path}", headers=HEADERS,
                     params={**params, "format": "csv"}, timeout=30)
    r.raise_for_status()
    return pd.read_csv(io.StringIO(r.text), parse_dates=["date"], index_col="date")

index = frame("/index/history", range="max")           # date -> level
closes = frame("/constituents/history", range="1y")    # date x symbol
returns = closes.pct_change().mean(axis=1)             # the index's daily return
JavaScript — Node 18+
const BASE = "https://happyai.today/api/v1";

async function hai(path, params = {}) {
  const url = new URL(BASE + path);
  for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
  // No key is needed for light use; set HAI_API_KEY to lift the rate limit.
  const key = process.env.HAI_API_KEY;
  const res = await fetch(url, { headers: key ? { "X-API-Key": key } : {} });
  const body = await res.json();
  if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);
  return body;
}

const { data } = await hai("/constituents/NVDA/history", { range: "3m" });
console.log(data.at(-1)); // { date, open, high, low, close, volume }

In Google Sheets, =IMPORTDATA("https://happyai.today/api/v1/index/history?range=1y&format=csv") pulls the index straight into a sheet. A machine-readable description of the API is at /openapi.json.