U.S. 10 Year Treasury (US10Y) Historical Price API
Your task: backfill and chart a clean, daily history for the U.S. 10 Year Treasury benchmark so your dashboard can display rolling yield curves, compute term premia, or trigger alerts on basis-point moves. By the end of this guide, you’ll fetch a time series for the U.S. 10 Year Treasury (US10Y), understand how to interpret the response, and handle edge cases like weekends and end-of-day cutovers with Indices-API.
What you’ll build: a reliable US10Y timeseries for charts, backtests, and alerts
We’ll focus on two endpoints that matter for historical work:
- Latest: a quick probe to see the most recent snapshot and to wire up monitoring.
- Time-series: a date-ranged pull you can use to backfill and paginate long histories.
We’ll also touch on the Historical (single-day) endpoint for point-in-time queries. For full parameter coverage and response variants, see the Indices-API Documentation. If you are validating symbol codes, open the live catalog on the Indices-API Supported Symbols page first.
Symbol and units: confirm the exact code for the U.S. 10 Year Treasury
This article uses “US10Y” as the working symbol. Some feeds label the U.S. 10-year benchmark differently (e.g., “UST10Y” or exchange-specific codes). Do not guess: confirm the exact code in the live symbols catalog before you ship. If the symbol is not exactly “US10Y” in your plan, update your requests accordingly.
All Indices-API rates are delivered relative to USD by default, and responses include a unit descriptor (unit: "per index"). For US10Y, you’ll typically treat the returned value as the instrument’s normalized price or index value expressed against the USD base. If you maintain a yields database, map or transform the value consistently in your data model (e.g., convert to percentage points or basis points as your app expects).
Quick start: get an API key and validate a latest probe
Sign up for an API key (PRO $49.99/mo; 7‑day trial) to start calling endpoints from your dev environment. Use this link to create your account: Register. You can also browse the homepage while you work: indices-api.com.
We’ll begin with a latest request to verify access and symbol. Replace YOUR_API_KEY with your token.
curl: probe the latest endpoint for US10Y
curl -s "https://indices-api.com/api/latest?access_key=YOUR_API_KEY&symbols=US10Y"
Here is the exact JSON envelope returned during a live test (quoted verbatim):
{"success":false,"error":{"code":400,"type":"invalid_symbol","info":"One or more invalid symbols have been specified."}}
Interpreting this response:
- success: false indicates the request did not return data.
- error.code and error.type point to a symbol issue—verify your symbol spelling and availability in your plan.
- To proceed, confirm the exact 10-year benchmark code on the Symbols page, then retry the call with that code.
On a successful latest response, you will see fields you will rely on downstream:
- timestamp: Unix epoch of the quote snapshot you’re seeing.
- date: ISO date of the snapshot, useful for partitioning and caching.
- base: the base currency (USD by default).
- rates: a map of symbol → value. You’ll index into rates with your verified US10Y code.
- unit: descriptor string to clarify how to interpret numeric values (e.g., per index).
JavaScript example: handle errors and parse a valid latest print
This snippet calls the same latest endpoint, checks for an error envelope, and shows how you would read timestamp, date, base, and rates for your symbol when the symbol is valid.
async function fetchUS10YLatest() {
const url = "https://indices-api.com/api/latest?access_key=YOUR_API_KEY&symbols=US10Y";
const res = await fetch(url, { headers: { "Accept": "application/json" } });
const json = await res.json();
if (!json.success) {
// Handle errors exactly as provided by the API
console.error(`Indices-API error ${json.error?.code}: ${json.error?.type} - ${json.error?.info}`);
return null;
}
const { timestamp, date, base, rates, unit } = json;
// Replace 'US10Y' with the confirmed symbol code from the Symbols page
const symbol = "US10Y";
const latestValue = rates[symbol];
return { timestamp, date, base, symbol, latestValue, unit };
}
// Example usage:
fetchUS10YLatest().then(console.log).catch(console.error);
If your call returns the error envelope shown earlier, fix the symbol first. When success is true, your downstream code should find the US10Y value in rates[symbol], with time context provided by timestamp/date and normalization context via base/unit.
Backfilling historical US10Y data with the time-series endpoint
Once your symbol is confirmed, the time-series endpoint is ideal for backfilling US10Y history or constructing a rolling window for charts, regressions, and risk models. The response shape includes:
- timeseries: true to indicate a date-ranged payload.
- start_date and end_date: inclusive bounds for requested data. Note: end_date cannot be today; use the most recent completed trading day.
- base: USD by default.
- rates: a date-indexed map. For each date, key into the map by your US10Y symbol to read the value for that day.
- unit: descriptor string, typically "per index."
Typical usage pattern:
- Choose your backfill window, for example start_date=YYYY-MM-DD and end_date=YYYY-MM-DD for a trailing 1–5 years.
- Handle non-trading days: weekends and U.S. market holidays will not have entries; expect holes in the calendar and do not assume seven-day continuity.
- Cache results by date window and timestamp. If you request overlapping windows, de-duplicate by date in your store.
While we’re not reproducing the entire parameter catalog here, you’ll find request details and examples in the Documentation. Always confirm the end_date you pass is a completed market day.
Point-in-time lookups with the historical endpoint
For one-off verifications (e.g., “What was the US10Y value on 2024-12-31?”), use the historical endpoint by appending a date to your request. A successful historical response mirrors the latest structure but for a single date:
- success: boolean.
- timestamp and date: reflect the day requested (ISO date).
- base: “USD”.
- rates: includes your US10Y symbol if available in your subscription.
- unit: “per index.”
Always compare date to your local time zone cutover when scheduling nightly jobs; schedule pulls after the provider’s end-of-day cycle to avoid partial days.
How quotes are expressed, trading calendars, and update frequency
Base currency and unit:
- base is USD by default. If you transform or rescale in your system (e.g., to percent or basis points), do it in a consistent layer after parsing.
- unit clarifies interpretation—keep it in your metadata so analysts understand downstream values.
Trading days:
- Expect data on U.S. trading days and no entries on weekends or U.S. holidays.
- If you need a continuous daily series, forward-fill or apply business-day calendars in your analytics layer; do not assume calendar-day continuity from the source.
Update frequency and caching:
- The latest endpoint updates as frequently as your plan allows (every 60 minutes, 10 minutes, or faster depending on plan tier).
- Cache responses keyed by date and symbol. For latest pulls, honor timestamp to avoid redundant updates and to maintain reproducible backtests.
- For end-of-day backfills, schedule after the provider’s daily close; avoid using “today” as the end_date because end_date cannot be today.
Building your US10Y chart: practical steps
1) Verify the symbol
Open the Symbols catalog and confirm the exact 10-year U.S. Treasury code in your plan. If the symbol differs from “US10Y” (e.g., “UST10Y”), use that code in all requests.
2) Seed with a one-day historical check
Use the historical endpoint with a known past date (a standard trading day) to validate you can read a US10Y print. Then promote that logic into your ingestion job.
3) Backfill a window with timeseries
Request a bounded window that excludes today (e.g., start_date=YYYY-MM-01, end_date=YYYY-MM-31 for a completed month). Store rows as (date, symbol, value, base, unit, timestamp). Skip missing dates instead of writing nulls.
4) Schedule ongoing updates
Run a nightly job to fetch the previous business day (historical) and a daytime job to poll the latest endpoint according to your plan’s update frequency. Reconcile overlapping data by taking the most recent timestamp per date.
Error handling and retries you actually need
- invalid_symbol: Confirm the code on the Symbols page and ensure it is included in your subscription. This was the exact error we observed in the live probe above.
- Temporary connectivity: Use exponential backoff and cap retries; log the last good timestamp and resume from there.
- Partial data for the current day: Never use “today” as your time-series end_date; use the last completed trading day to avoid partials.
Field mapping you’ll use in production
- timestamp: Store as UTC epoch; it helps with idempotency and late updates.
- date: Use as the primary partition (e.g., YYYY-MM-DD) for storage and APIs serving charts.
- base: Track for every observation. Default is USD.
- rates[symbol]: The value you’ll chart (US10Y). Keep the symbol as stored in the API for round-trips.
- unit: Persist into metadata so downstream consumers know whether to treat the number as an index level or a yield-transformed value.
Beyond daily closes: OHLC and intraday when you need granularity
If you require open/high/low/close context for a specific day, use the OHLC endpoint for that date. This is useful for intraday risk bands, ranges, or volatility modeling. For interval-based candles, the intraday endpoint provides slices for a specific date. Consult the Documentation before using these in production to verify availability for your symbol and plan.
Compliance notes and references for fixed income teams
For independent verification or to reconcile with official publications, see the U.S. Treasury’s interest rate resources: U.S. Treasury Interest Rate Data. Align your ingestion schedule and holiday calendar with U.S. trading days. Keep audit metadata (request URL, timestamp, unit, and base) alongside each record to ensure repeatability.
Putting it together: minimal ingestion workflow
- Check symbol on the Symbols page and store the canonical code in config.
- Probe latest once to validate access and symbol; handle invalid_symbol by correcting config.
- Run a backfill with the time-series endpoint for your desired window, excluding today.
- Nightly: call historical for the most recent business day and append.
- Daytime: poll latest within your plan’s update cadence for monitoring and alerts.
- Cache by (date, symbol) and keep timestamp to resolve duplicates.
Operational tips that save time
- Pagination and windowing: For long backfills, split by month or quarter and merge locally.
- Idempotency: Build ingestion with upserts keyed by (date, symbol) and prefer the newest timestamp.
- Time zones: Treat all dates as UTC dates returned by the API; schedule jobs accordingly to avoid race conditions with end-of-day processing.
- Monitoring: Track last ingested date and raise alerts if you miss expected business days (consider U.S. holiday calendars).
- Docs at hand: Keep the Documentation open to cross-check optional parameters for timeseries and historical endpoints.
Security, environments, and CI/CD
- Keys: Store your Indices-API key in a secrets manager; never commit to source control.
- Environments: Point dev/staging to a smaller backfill window and production to the full window; same code paths.
- Reproducibility: Pin your transformations (e.g., percent vs. decimal vs. basis points) with config flags and document them for analysts.
FAQ
How often are US10Y values updated?
The latest endpoint updates according to your plan’s cadence (e.g., every 60 minutes or 10 minutes). Historical and time-series pulls return completed days. Verify details in the Documentation.
Why did I get invalid_symbol for US10Y?
Your plan might use a different ticker or not include that symbol. Confirm the exact code on the Symbols page and retry the request with the matching symbol.
Can I set end_date to today?
No. Use the most recent completed business day. Scheduling end-of-day or early-next-day jobs avoids partial data.
What currency are values returned in?
Responses are relative to USD by default (base: "USD") with unit metadata ("per index"). If you store yields as percentage or bps, rescale after ingestion and document the conversion.
Do weekends and U.S. holidays appear in the time series?
No. Expect only trading days. If you require a continuous daily series, forward-fill or apply a business-day calendar in your analytics layer.
Ready to wire this into your pipeline? Create your API key and start pulling US10Y today with a 7‑day trial: Register. Explore platform capabilities and partner models here: MCP and visit indices-api.com for service updates.