S&P 500 API (GSPC): Live Index Level from JSON
An S&P 500 API is a REST endpoint that returns the S&P 500 as JSON. On Indices-API the ticker is GSPC (same code as Yahoo’s ^GSPC, without the caret). Call GET /api/latest with base=USD and symbols=GSPC: rates.GSPC is the inverse quote (index units per 1 USD); rates.USDGSPC is already the index level. That USD prefix exists on the latest endpoint only.
The same call can pull Nasdaq Composite (IXIC), Dow Jones (DJI), NYSE Composite (NYA), or EGX 30 (EGX-30). PRO is $49.99/mo (1,000 calls, then $0.064987; 5 indices per request; 10-minute updates) with a 7-day trial. Docs: indices-api.com/documentation.
Request: latest GSPC (and NYA, EGX-30)
curl "https://indices-api.com/api/latest?access_key=YOUR_KEY&base=USD&symbols=NYA,EGX-30,GSPC"
Query params from the docs: access_key (required), base (optional, default USD), symbols (required, comma-separated). Update cadence is 60 minutes, 10 minutes, or 60 seconds depending on the plan.
Response: GSPC plus USDGSPC
Envelope from the official Latest Rates docs (sample date 2024-10-10 — copy the curl with your key for today’s print). Trailing commas and the [...] placeholder from the doc page are removed so this is valid JSON:
{
"success": true,
"timestamp": 1728588840,
"base": "USD",
"date": "2024-10-10",
"rates": {
"EGX-30": 0.0015791959638306,
"GSPC": 0.0001732354668436,
"NYA": 0.000051351995333131,
"USDEGX-30": 633.2336346493283,
"USDGSPC": 5772.489999999927,
"USDNYA": 19473.43999999987
}
}
timestamp is UNIX time of the quote. To display “S&P 500 in points”, prefer rates.USDGSPC (~5772.49 in this sample). The invert matches: 1 / 0.0001732354668436 ≈ 5772.49. Same rule the docs give for NYA: 1 / 0.000051351995333131 = 19473.43, which is USDNYA.
Request: historical index by calendar date
The dated endpoint’s history for most symbols starts October 2024. Docs example — NYSE Composite on 2024-10-09:
curl "https://indices-api.com/api/2024-10-09?access_key=YOUR_KEY&base=USD&symbols=NYA"
{
"success": true,
"historical": true,
"date": "2024-10-09",
"base": "USD",
"rates": {
"NYA": 5.0157670637649e-5
}
}
The JSON adds "historical": true. There is no USDNYA on this envelope — invert 1 / rates.NYA if you need the USD level. Swap NYA for GSPC for S&P 500 on that date. Time-series: /api/timeseries (30 days on PRO). Do not set end_date to today if the product follows the same rule as the other FX-style APIs — use a prior day, and /api/latest for the last print.
PHP: latest GSPC
Official Sample Code on the docs is PHP cURL against /api/latest. Same pattern with symbols=GSPC so you can read rates.USDGSPC:
$endpoint = 'latest';
$access_key = 'YOUR_KEY';
$ch = curl_init('https://indices-api.com/api/' . $endpoint . '?access_key=' . $access_key . '&base=USD&symbols=GSPC');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
$exchangeRates = json_decode($json, true);
echo $exchangeRates['rates']['USDGSPC'];
The docs sample echoes rates.NYA. On latest, prefer the USD-prefixed key for the index level. Convert uses the same cURL wrapper with $endpoint = 'convert' — see #phpcurl.
Go live with GSPC
1. Register and start the 7-day Pro trial ($49.99/mo after).
2. Confirm GSPC on the symbols page (or GET /api/symbols).
3. Call https://indices-api.com/api/latest?access_key=YOUR_KEY&base=USD&symbols=GSPC
4. Render rates.USDGSPC. Cache to 10 minutes on PRO so a dashboard refresh does not burn the 1,000 calls.
Support: [email protected], Monday–Friday 12:00–21:00 UTC.
FAQ: S&P 500 API (GSPC)
What ticker is the S&P 500?
GSPC. Not a free-text “sp500” string and not ^GSPC. Nasdaq Composite is IXIC, Dow Jones Industrial Average is DJI. See the symbols list.
Why is rates.GSPC a tiny decimal?
With base=USD the rate is index units per 1 USD. The level you chart is rates.USDGSPC on /api/latest, or 1 / rates.GSPC anywhere else.
Is the docs sample today’s S&P 500?
No. The Latest Rates sample is dated 2024-10-10 with USDGSPC ≈ 5772.49. Always hit /api/latest with your key for the current print.
How far back can I go?
The historical URL documents coverage from October 2024 for most symbols. For a window, use /api/timeseries (30 days on PRO). OHLC is /api/open-high-low-close/YYYY-MM-DD.
Start the 7-day trial and call GSPC →