Dow Jones U.S. Top-Cap Index (DJUSTP) Price API Integration Guide for Node.js
If you need to chart the Dow Jones U.S. Top-Cap Index or alert on a move in DJUSTP, you need to distinguish the index quote from its inverse USD rate and keep historical observations separate from the latest value. This guide shows how to request the latest data from Node.js, read the returned fields, and make one time-series request for a historical chart.
Confirm the symbol and get an API key
The symbol used in this integration is DJUSTP. Check its current availability and specifications on the Indices-API Symbols page before building a production dependency on it.
Requests use an API key in the access_key query parameter. Keep that key on your server rather than embedding it in browser-side dashboard code: a browser request would expose the key to anyone inspecting the application. For local development, store it in an environment variable.
The latest endpoint provides the current available quote. For chart backfills, use the time-series endpoint and check the Indices-API Documentation for the request format, date limits and features available on your plan.
Request the latest DJUSTP quote
Replace YOUR_API_KEY with your key to run this request. The pipe filters the response locally for the DJUSTP symbol; it is not an API-side symbol filter.
curl -fsS 'https://indices-api.com/api/latest?access_key=YOUR_API_KEY' | grep 'DJUSTP'
Depending on JSON formatting, grep may print only the line containing the symbol rather than the complete response. For an application, parse the JSON and check both the request result and the returned data rather than relying on text matching.
The following is the provided response for this quote:
{"data":{"success":true,"timestamp":1795480800,"date":"2026-11-24","base":"USD","rates":{"DJUSTP":0.00056568764990723,"USD":1,"USDDJUSTP":1767.7599999999914}}}
For this response, the useful fields are inside data:
successindicates whether the API reports a successful result. Check it before consuming rates.baseisUSD. TheDJUSTPrate is expressed relative to that base; it is not the same number as the inverse quote.rates.DJUSTPis the DJUSTP-per-USD rate in this response.rates.USDDJUSTPis its inverse, the corresponding USD-per-DJUSTP quote. Use the latter when your interface needs the quoted DJUSTP value in the USD direction, and label the direction explicitly.dateis the response’s data date.timestampis a Unix timestamp in seconds; convert it to a timezone-aware display rather than treating it as a JavaScript millisecond timestamp.
Do not label rates.DJUSTP as the index price in USD: its direction is the inverse of rates.USDDJUSTP. The exact precision displayed in a dashboard is a presentation decision; retain the original values when storing data or calculating changes.
Read the latest value and backfill a series in Node.js
The following sample makes the latest request and reads both quote directions. If you also set TIMESERIES_URL to a time-series request URL constructed from the documentation, it makes one additional request and reads the dated DJUSTP observations.
Set INDICES_API_KEY in your environment before running it. For the optional backfill, configure the time-series URL with the documented date parameters; the code adds the access key itself. Do not put a key in the URL you store as configuration.
const apiKey = process.env.INDICES_API_KEY;
const seriesUrl = process.env.TIMESERIES_URL;
if (!apiKey) {
throw new Error("Set INDICES_API_KEY before running this script.");
}
async function getJson(url) {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`Indices-API request failed: HTTP ${response.status}`);
}
const payload = await response.json();
// The latest response shown above wraps its result in data.
// The supplied time-series format has its fields at the top level.
const result = payload.data ?? payload;
if (result.success !== true) {
throw new Error("Indices-API did not report a successful result.");
}
return result;
}
function positiveNumber(value, label) {
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
throw new Error(`Missing or invalid ${label}.`);
}
return value;
}
async function main() {
const latestUrl = new URL("https://indices-api.com/api/latest");
latestUrl.searchParams.set("access_key", apiKey);
const latest = await getJson(latestUrl);
if (latest.base !== "USD") {
throw new Error("Unexpected base for the latest quote.");
}
const perUsd = positiveNumber(latest.rates?.DJUSTP, "DJUSTP rate");
const usdQuote = positiveNumber(latest.rates?.USDDJUSTP, "USDDJUSTP rate");
if (typeof latest.timestamp !== "number" ||
!Number.isFinite(latest.timestamp)) {
throw new Error("Missing or invalid timestamp.");
}
console.log({
date: latest.date,
timestampUtc: new Date(latest.timestamp * 1000).toISOString(),
base: latest.base,
djustpPerUsd: perUsd,
usdPerDjustp: usdQuote
});
if (seriesUrl) {
const url = new URL(seriesUrl);
if (url.protocol !== "https:" || url.hostname !== "indices-api.com") {
throw new Error("TIMESERIES_URL must use https://indices-api.com.");
}
url.searchParams.set("access_key", apiKey);
const series = await getJson(url);
if (series.base !== "USD" || !series.rates) {
throw new Error("Unexpected time-series response.");
}
const points = Object.entries(series.rates)
.sort(([a], [b]) => a.localeCompare(b))
.map(([date, rates]) => {
const rate = positiveNumber(rates?.DJUSTP, `DJUSTP rate for ${date}`);
return {
date,
djustpPerUsd: rate,
usdPerDjustp: 1 / rate
};
});
console.log({
startDate: series.start_date,
endDate: series.end_date,
points
});
}
}
main().catch((error) => {
console.error(error.message);
process.exitCode = 1;
});
The sample requires a JavaScript runtime with fetch available. Its latest request uses the supplied USDDJUSTP field directly. For the time series, it reads each date’s rates.DJUSTP value and calculates its reciprocal so the chart can use the same quote direction. Keep the original rate as well, and confirm the time-series quote convention in the documentation before combining it with another data source.
The time-series URL is configuration rather than a hard-coded guess at the request format. Construct it using the documented endpoint and date parameters, then set it as TIMESERIES_URL. The code makes one time-series call when that variable is present; without it, the script runs only the latest request. If a returned date lacks DJUSTP, the script stops rather than silently inserting a zero.
Make the chart and alerts reliable
Choose a consistent quote direction
A latest card and a historical chart should use the same direction. If the latest card displays USD per DJUSTP but the chart plots DJUSTP per USD, the two views can move in opposite directions and confuse users. Store the base and rate alongside each observation so that future consumers know what they are plotting.
Apply the same rule to alerts. A percentage change calculated from the inverse rate is not the same percentage change calculated from the USD-direction quote. Choose a direction first, calculate the change in that direction, and include the data timestamp and direction in the alert.
Handle dates, gaps and freshness
A time-series request returns daily observations for the requested period, subject to availability and the limits of your plan. Its end_date cannot be today. Select an earlier end date, and consult the documentation for the applicable date limits and request rules before scheduling a backfill.
Trading days are not the same as calendar days. Weekends, market holidays and other unavailable observations can leave gaps in a series. Do not fill a missing date with zero or assume every gap represents a market move; preserve returned dates and make any carry-forward or interpolation policy explicit in the chart.
The latest endpoint’s update frequency depends on the subscription plan; published intervals include every 60 minutes and every 10 minutes. Polling faster than the available update interval does not guarantee a new quote. Cache the most recent successful response, record when you fetched it, and display its API timestamp so users can distinguish retrieval time from data time.
Convert the Unix timestamp to UTC for storage and comparison. Convert to a user’s preferred timezone only for display, with the timezone shown. The response’s date and timestamp serve different purposes, so do not derive a trading session date solely from the viewer’s local clock.
For a shared dashboard, request the latest quote on the server and serve a cached result to clients instead of making a separate upstream request for every browser view. On an error, keep the last successful quote only if you clearly mark it as stale; do not overwrite it with an empty response. Review current plan terms and documentation for request allowances and any pagination rules before scaling a backfill.
For teams exploring additional integration options, the Indices-API MCP page describes the available MCP integration. The REST workflow above remains appropriate when your Node.js service needs direct control over caching and chart data.
FAQ
Which field should I use for the latest DJUSTP quote?
In the supplied latest response, rates.USDDJUSTP is the USD-direction quote, while rates.DJUSTP is its inverse relative to the USD base. Keep the direction visible in labels and calculations.
Can a time-series request end today?
No. Set end_date to an earlier date and check the documentation for the request’s date limits. Use the latest endpoint separately for the most recent available quote.
Why does my chart have missing dates?
Not every calendar date is a trading day, and observations may be unavailable for other reasons. Plot the dates returned by the API rather than assuming a daily value exists for every weekend or holiday.
How often should I refresh the latest quote?
Match your polling and cache policy to the update frequency available on your plan. Retain the API timestamp so your application can show the age of the data, not just the time your server last fetched it.
Ready to integrate DJUSTP? Register for a free Indices-API key, then verify the current plan terms and use the latest request above to test your Node.js integration.