API to Get India Bond Yields

API to Get India Bond Yields

Developers and quant teams working with Indian government securities often need clean, programmatic access to current yields, historical series, and spreads to build dashboards, risk tools, and research pipelines. By the end of this guide, you will be able to fetch India’s sovereign bond yields over a secure REST API, reconstruct a yield curve, compute spreads, and pull intraday snapshots suitable for production systems.

What you get from the India sovereign bond endpoints

Bonds-API delivers India (ISO2: IN) sovereign bond yields across maturities as JSON over HTTPS. You authenticate with a single API key in the X-API-Key header and call GET endpoints for:

Illustration: API to Get India Bond Yields
  • Latest yields for multiple maturities in one request
  • Point-in-time historical yields
  • Time series between two dates
  • Spreads versus benchmark countries (e.g., US, DE)
  • Full yield curve snapshots for India
  • Intraday yield snapshots for a given date
  • Fluctuation stats over any period (change, min, max)

Yields are expressed in percent (e.g., 4.52 means 4.52%). Spreads are returned in basis points (bps). Dates use the YYYY-MM-DD format, and timestamps are returned in ISO 8601 with timezone information when included (e.g., fetched_at in UTC). Explore the API surface at bonds-api.com and keep this guide handy as a reference when you integrate.

Quick start: authentication, countries, maturities, and units

All endpoints use the base URL https://bonds-api.com/api/v1/ and require an API key in the X-API-Key header. Every call is a GET. Country codes are ISO2; for India use IN. Maturities follow common market tenors such as 1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y.

  • Authentication: X-API-Key: YOUR_API_KEY
  • Method: GET only
  • Yields: percent
  • Spreads: basis points
  • Dates: YYYY-MM-DD; timestamps are ISO 8601 with timezone

If you need an API key, use this one-click CTA: Register. You can also inspect capabilities and tooling via the MCP. For product context, see the homepage at bonds-api.com.

Latest India yields: multi-maturity snapshots

Use /latest to fetch the most recent available yields for India. You can request specific maturities or omit maturities to get all available tenors. The response returns yields as percent and the associated market date.

Endpoint

GET /api/v1/latest

  • Required: countries (ISO2 comma-separated)
  • Optional: maturities (comma-separated, e.g., 2Y,10Y)

cURL

curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"

JSON response

{
    "success": true,
    "date": "2026-11-06",
    "rates": {
        "US_10Y": 4.86
    },
    "dates": {
        "US_10Y": "2026-11-06"
    },
    "currencies": {
        "US_10Y": "USD"
    },
    "meta": {
        "request_id": "93196bf7-8442-4caf-905b-a6fd91ebfe7a",
        "timestamp": "2026-11-07T01:04:04+00:00"
    }
}

Interpretation:

  • yield: percent (4.52 means 4.52%)
  • date: market date (YYYY-MM-DD) the yield corresponds to
  • source: origin of the data (e.g., official)

Python

import requests

resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "IN", "maturities": "2Y,10Y"}
)
data = resp.json()
in_10y = data["data"]["IN"]["10Y"]["yield"]
in_10y_date = data["data"]["IN"]["10Y"]["date"]
print("IN 10Y:", in_10y, "on", in_10y_date)

JavaScript (fetch)

async function fetchLatestIN() {
const url = new URL("https://bonds-api.com/api/v1/latest");
url.searchParams.set("countries", "IN");
url.searchParams.set("maturities", "2Y,10Y");
const res = await fetch(url.toString(), {
method: "GET",
headers: { "X-API-Key": "YOUR_API_KEY" }
});
const json = await res.json();
const in10y = json.data.IN["10Y"];
console.log(`IN 10Y: ${in10y.yield}% on ${in10y.date}`);
}
fetchLatestIN();

PHP (file_get_contents)

<?php
$context = stream_context_create([
"http" => [
"method" => "GET",
"header" => "X-API-Key: YOUR_API_KEY\r\n"
]
]);
$url = "https://bonds-api.com/api/v1/latest?countries=IN&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
echo "IN 2Y: " . $data["data"]["IN"]["2Y"]["yield"] . "%\n";
?>

Historical yield on a specific date (point-in-time)

Use /historical to retrieve the yield for a specific maturity on a given date, useful for backtesting, P&L explain, and event studies.

Endpoint

GET /api/v1/historical

  • Required: country (ISO2), maturity (e.g., 10Y), date (YYYY-MM-DD)

cURL

JSON response

Interpretation:

  • yield: percent for the specified date
  • source: data origin descriptor

Python

import requests

params = {"country": "IN", "maturity": "10Y", "date": "2025-06-15"}
r = requests.get("https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
print(r.json())

JavaScript (fetch)

async function fetchHistoricalIN10Y(date) {
const url = new URL("https://bonds-api.com/api/v1/historical");
url.searchParams.set("country", "IN");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", date);
const res = await fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } });
return res.json();
}
fetchHistoricalIN10Y("2025-06-15").then(console.log);

PHP (Guzzle)

<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://bonds-api.com/api/v1/',
'headers' => ['X-API-Key' => 'YOUR_API_KEY']
]);
$res = $client->get('historical', [
'query' => ['country' => 'IN', 'maturity' => '10Y', 'date' => '2025-06-15']
]);
echo $res->getBody();
?>

Time series between two dates

Use /timeseries to retrieve a daily series for a given maturity across a date range. This is the backbone for charting and factor models.

Endpoint

GET /api/v1/timeseries

  • Required: country (ISO2), maturity, start (YYYY-MM-DD), end (YYYY-MM-DD)

cURL

JSON response

Interpretation:

  • series: array of daily observations (business days and other available market days)
  • date: YYYY-MM-DD; yield is percent

Python

import requests

q = {"country": "IN", "maturity": "10Y", "start": "2025-11-07", "end": "2026-11-07"}
resp = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params=q)
ts = resp.json()["series"]
print("First obs:", ts[0])

JavaScript (fetch)

async function fetchIN10YSeries(start, end) {
const url = new URL("https://bonds-api.com/api/v1/timeseries");
url.searchParams.set("country", "IN");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("start", start);
url.searchParams.set("end", end);
const res = await fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } });
return res.json();
}
fetchIN10YSeries("2025-11-07", "2026-11-07").then(({ series }) => {
console.log(`Loaded ${series.length} data points`);
});

PHP (file_get_contents)

<?php
$params = http_build_query([
'country' => 'IN',
'maturity' => '10Y',
'start' => '2025-11-07',
'end' => '2026-11-07'
]);
$ctx = stream_context_create([
'http' => [
'method' => 'GET',
'header' => "X-API-Key: YOUR_API_KEY\r\n"
]
]);
echo file_get_contents("https://bonds-api.com/api/v1/timeseries?$params", false, $ctx);
?>

Spread vs benchmark

Use /spread to compute spreads in basis points between India and a benchmark country at a given maturity. This is useful for cross-market relative value and risk premium analysis.

Endpoint

GET /api/v1/spread

  • Required: country (ISO2)
  • Required: benchmark (ISO2, e.g., US for US Treasury, DE for German Bund)
  • Optional: maturity (defaults to 10Y)

cURL

JSON response

Interpretation:

  • spread_bps: India yield minus benchmark yield in basis points
  • country_yield, benchmark_yield: percent

Python

import requests

p = {"country": "IN", "benchmark": "US", "maturity": "10Y"}
r = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p)
print(r.json())

JavaScript (fetch)

async function fetchINSpreadVsUS() {
const url = new URL("https://bonds-api.com/api/v1/spread");
url.searchParams.set("country", "IN");
url.searchParams.set("benchmark", "US");
url.searchParams.set("maturity", "10Y");
const res = await fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } });
const json = await res.json();
console.log(`Spread: ${json.spread_bps} bps`);
}
fetchINSpreadVsUS();

PHP (Guzzle)

<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client(['base_uri' => 'https://bonds-api.com/api/v1/']);
$res = $client->get('spread', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'IN', 'benchmark' => 'US', 'maturity' => '10Y']
]);
echo $res->getBody();
?>

Full India yield curve

Use /curve to fetch a full term structure for India for the latest available market date (or a specific date). This is ideal for plotting the curve, bootstrapping, or scenario analysis.

Endpoint

GET /api/v1/curve

  • Required: country (ISO2)
  • Optional: date (YYYY-MM-DD)

cURL

JSON response

Interpretation:

  • curve: mapping of tenors to yields (percent)
  • inverted: flag indicating curve inversion
  • date: market date for the curve snapshot

Python

import requests

r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "IN"})
curve = r.json()["curve"]
tenors = sorted(curve.keys(), key=lambda t: ["M","Y"].index(t[-1]) if t[-1] in "MY" else 2)
print("Tenors on curve:", tenors)

JavaScript (fetch)

async function fetchINCurve() {
const url = new URL("https://bonds-api.com/api/v1/curve");
url.searchParams.set("country", "IN");
const res = await fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } });
const json = await res.json();
console.log("Curve inverted?", json.inverted);
console.log("10Y:", json.curve["10Y"], "%");
}
fetchINCurve();

PHP (file_get_contents)

<?php
$ctx = stream_context_create(['http' => [
'method' => 'GET',
'header' => "X-API-Key: YOUR_API_KEY\r\n"
]]);
$resp = file_get_contents("https://bonds-api.com/api/v1/curve?country=IN", false, $ctx);
echo $resp;
?>

Intraday India yields

Use /intraday to fetch time-stamped yield snapshots for a given maturity and date. Each snapshot includes fetched_at in UTC. This helps build more responsive intraday monitors and backtesting tools for intraday strategies.

Endpoint

GET /api/v1/intraday

  • Required: country (ISO2), maturity, date (YYYY-MM-DD)

cURL

JSON response

Interpretation:

  • snapshots: yield observations with fetched_at timestamps in UTC
  • count: number of intraday snapshots returned
  • date: the market date of observation

Python

import requests
from datetime import datetime

p = {"country": "IN", "maturity": "10Y", "date": "2026-11-07"}
r = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params=p)
data = r.json()
for s in data["snapshots"]:
ts = datetime.fromisoformat(s["fetched_at"].replace("Z", "+00:00"))
print(ts.isoformat(), s["yield"])

JavaScript (fetch)

async function fetchINIntraday() {
const url = new URL("https://bonds-api.com/api/v1/intraday");
url.searchParams.set("country", "IN");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", "2026-11-07");
const res = await fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } });
const json = await res.json();
json.snapshots.forEach(s => console.log(s.fetched_at, s.yield));
}
fetchINIntraday();

PHP (Guzzle)

<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://bonds-api.com/api/v1/',
'headers' => ['X-API-Key' => 'YOUR_API_KEY']
]);
$res = $client->get('intraday', [
'query' => ['country' => 'IN', 'maturity' => '10Y', 'date' => '2026-11-07']
]);
echo $res->getBody();
?>

Fluctuation over a period (change, min, max)

Use /fluctuation to compute period-over-period change, as well as min and max yields within a window. This accelerates risk summaries and monitoring alerts.

Endpoint

GET /api/v1/fluctuation

  • Required: countries (ISO2 comma-separated), maturity
  • Required: start (YYYY-MM-DD), end (YYYY-MM-DD)

cURL

JSON response

Interpretation:

  • change: end_yield minus start_yield (percent points)
  • min, max: extreme yields in the period (percent)

Python

import requests

params = {"countries": "IN", "maturity": "10Y", "start": "2025-11-07", "end": "2026-11-07"}
r = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
print(r.json()["data"]["IN"])

JavaScript (fetch)

async function fluctuationIN10Y() {
const url = new URL("https://bonds-api.com/api/v1/fluctuation");
url.searchParams.set("countries", "IN");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("start", "2025-11-07");
url.searchParams.set("end", "2026-11-07");
const res = await fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" } });
const json = await res.json();
console.log(json.data.IN);
}
fluctuationIN10Y();

PHP (file_get_contents)

<?php
$q = http_build_query([
'countries' => 'IN', 'maturity' => '10Y',
'start' => '2025-11-07', 'end' => '2026-11-07'
]);
$ctx = stream_context_create(['http' => [
'method' => 'GET',
'header' => "X-API-Key: YOUR_API_KEY\r\n"
]]);
echo file_get_contents("https://bonds-api.com/api/v1/fluctuation?$q", false, $ctx);
?>

Building an India yield curve and spreads in your app

For a robust India yield curve, call /curve for IN. If you need to compare the curve’s 10Y point to the US Treasury 10Y, call /spread with country=IN and benchmark=US. You can then combine these outputs to plot relative value levels or to estimate term premia by subtracting interpolated benchmarks from the India curve.

  • Fetch /curve?country=IN for the full term structure (percent).
  • Overlay /latest or /historical points for validation or custom tenors.
  • Compute spreads via /spread using “US” or “DE” as benchmarks (bps).

Data cadence, business days, and caching

Market data typically updates on Indian business days. Expect no updates on weekends and Indian government securities market holidays. The /latest endpoint returns the most recent market date with data; on holidays it may refer to the prior business day.

  • Use EOD caching: Cache /latest results per country and tenor for the trading day.
  • Use revalidation windows: For intraday-heavy apps, refresh /intraday on a cadence aligned with your UI (e.g., every 5–15 minutes), and back off on quiet periods.
  • Handle gaps: /timeseries may skip non-trading days; align your charts to business-day calendars.
  • Check timestamps: Intraday fetched_at values are UTC; convert to your users’ local time zones in the UI.

Error handling and resiliency

All error responses share a common shape with success=false and an error string. Handle these systematically and add retries with jitter for idempotent reads.

  • 401: Missing or invalid X-API-Key — ensure header is present and correct.
  • 403: Account quota exceeded — degrade gracefully (e.g., show cached data).
  • 404: No data for requested combination — validate ISO2, maturity, and dates.
  • 422: Invalid parameter — fix date formats (YYYY-MM-DD), ISO2 code, or tenor.
  • 429: Rate limit exceeded — implement exponential backoff and caching.
  • 500: Server error — retry with backoff; alert if persistent.

Sovereign bond fundamentals (India focus)

India sovereign bonds are debt securities issued by the Government of India. The yield reflects the market’s required return and is sensitive to policy rate expectations, inflation outlook, fiscal conditions, and global risk appetite. Term structure analysis (the yield curve) helps quantify duration risk and macro expectations; spreads versus benchmarks contextualize India’s risk premium within global rates markets.

  • Short-end maturities (e.g., 1M–1Y) track liquidity and policy expectations.
  • Belly and long-end (2Y–30Y) embed growth/inflation views and term premia.
  • Curve inversion flags unusual macro or policy cycles.

End-to-end examples by endpoint

Below are concise summaries of how to use each endpoint, what fields mean, and how to compose them for fixed-income workflows:

  • /latest: Get current India yields across requested maturities. Use for dashboards and triggers.
  • /historical: Fetch a point-in-time yield for compliance snapshots and event studies.
  • /timeseries: Drive charts and quant models with continuous daily data.
  • /spread: Compare IN yields to benchmarks (US, DE) in basis points for RV analysis.
  • /curve: Load a full curve to interpolate missing tenors and price instruments.
  • /intraday: Monitor within-day yield changes for alerts and short-horizon models.
  • /fluctuation: Summarize changes, min, and max for reporting and risk oversight.

For each, yields are percent values; dates are YYYY-MM-DD. Only /intraday includes fetched_at timestamps in UTC. Spreads are returned in bps.

Production notes for fintech teams

  • Normalization: Store yields as decimals in percent units (e.g., 4.52) to match API outputs; convert to bps only when needed.
  • Rollover strategy: Around local market close, refresh /latest and /curve and invalidate caches for the next trading day.
  • Interpolation: Use /curve for tenors you need; for off-tenor securities, linearly interpolate in yield space or fit a smoother curve depending on your pricing model.
  • Alerting: Combine /intraday with thresholds on absolute yield move (in bps) or z-scores over /timeseries windows.
  • Resilience: Add graceful fallbacks to the most recent cached successful response in case of transient errors.

Security and compliance

Transmit your API key only in the X-API-Key header over HTTPS. Do not embed the key in public client-side code. For browser-based apps, proxy requests through your backend. Rotate keys periodically and restrict access to trusted systems only. Review your logs to ensure parameters are valid ISO2 country codes and supported maturities.

Use cases you can ship this week

  • Executive rates dashboard: /latest for IN across 1M–30Y and /curve for visualization.
  • Macro research notebook: /timeseries for IN 10Y and /spread vs US 10Y to study co-movements.
  • Risk summary widget: /fluctuation for IN 10Y over week-to-date and month-to-date windows.
  • Intraday alerting: /intraday for IN 10Y with rules on 10–15 bps moves in under an hour.

FAQ

What units are used for yields and spreads?
Yields are in percent (e.g., 4.52 means 4.52%). Spreads returned by /spread are in basis points (bps).

How are dates and times formatted?
Dates are YYYY-MM-DD. Intraday timestamps (fetched_at) are ISO 8601 with timezone (UTC). Convert to your local timezone for display if needed.

Do I get data on weekends and Indian holidays?
No new market data is expected on weekends and Indian government securities holidays. /latest returns the most recent available market date.

Can I request multiple maturities at once?
Yes, with /latest you can pass maturities=2Y,5Y,10Y (comma-separated). For the curve, use /curve to get many standard tenors in one call.

How should I authenticate?
Include your key in the X-API-Key header for every GET call. Do not put the key in query parameters.

If you need programmatic India yields for dashboards, research, or pricing, get your key and start integrating today: Register. For product context and other capabilities, read more at bonds-api.com and explore tooling via the MCP.

Start building with bond data today

Get your API key and access sovereign bond yields across 60+ countries. 7-day free trial, no credit card required.