Key points
- One call to the income statement endpoint,
/stable/income-statement, returns full-year revenue and operating income in yen for a Japanese listed company. - Before you chart a trend, check from the response itself that every year is a full 12-month year, consolidated, and on the same accounting standard.
- The figures on this page are for Toyota Motor (7203), retrieved on October 27, 2026 at 16:50 JST.
Copying five years of numbers out of kessan tanshin (earnings summaries) or yuho (annual securities reports) PDFs is slow, and it is easy to mix up units. An API gets you several years in one request. Whether those numbers can be lined up as-is is a separate question. This page puts fetching, checking, saving and charting into one Python script.
What you will build
The inputs are a securities code, the last fiscal year you want and the number of years. The script produces four outputs.
| Output | Contents | Unit |
|---|---|---|
| Console table | Revenue and operating income by fiscal year | JPY million (same as Japanese filings) |
income-7203.csv |
Amounts, accounting standard, consolidation flag, days, document ID, update and retrieval timestamps | JPY |
income-7203.json |
The raw API response plus your retrieval timestamp | JPY |
income-7203.png |
Revenue and operating income bar charts, stacked | JPY trillion |
Change the display unit as needed, but keep storage and calculations in yen. You cannot get the exact amount back from a rounded "¥48.04 trillion".
Endpoint and parameters
You only need income statement. Each call costs 1 token.
| Parameter | Value here | Meaning |
|---|---|---|
symbol |
7203 |
Securities code (4 characters; alphanumeric codes such as 130A also work) |
period |
annual |
Return full-year (FY) rows only. Omit it and quarterly rows are mixed in |
limit |
10 |
Maximum rows returned. Default 10, maximum 40 |
The response is an array with one object per fiscal period, newest first. These are the fields used here.
| Field | Meaning |
|---|---|
fiscalPeriod |
Period-end month (YYYY-MM). 2025-03 is the fiscal year ended March 2025 |
period |
Period type. With period=annual it is FY |
revenue / operatingIncome |
Revenue and operating income (JPY) |
accountingStandard |
Accounting standard |
consolidation |
consolidated for consolidated statements, nonconsolidated for parent-only, null when it cannot be determined |
fiscalPeriodDays |
Actual length of the period in days. About 365 for a 12-month year |
provenance |
Source filing (source, docId, announcedAt, sourceUrl) |
updatedAt |
When the data pipeline last updated this row (UTC) |
consolidation and fiscalPeriodDays let your code decide whether two years are comparable. A field having the same name across years does not mean the conditions behind it are the same, so read both.
Look at the shape with one curl call
Before writing code, check what comes back. jq keeps only the fields you need.
curl -s "https://api.zenithcode.net/stable/income-statement?symbol=7203&period=annual&limit=10" \
-H "x-api-key: YOUR_API_KEY" \
| jq '.[] | {fiscalPeriod, period, accountingStandard, consolidation, fiscalPeriodDays, revenue, operatingIncome, docId: .provenance.docId}'
When we fetched this on October 27, 2026, the first row was the fiscal year ended March 2026. The years we wanted, FY2021 through FY2025 (March year-ends), started from the second row. The first row is not necessarily the year you want. Select rows by the value of fiscalPeriod, not by array position.
Here is the part of the FY ended March 2025 row used on this page.
{
"symbol": "7203",
"fiscalPeriod": "2025-03",
"period": "FY",
"accountingStandard": "ifrs",
"revenue": 48036704000000,
"operatingIncome": 4795586000000,
"provenance": {
"source": "edinet",
"docId": "S100VWVY"
}
}
48036704000000 is in yen. Divide by one trillion for ¥48.04 trillion, or by one million for ¥48,036,704 million.
To try it in the browser, run the same parameters in the API viewer. It uses the same quota as the API.
Select five years in Python, check them, then save
The script below fetches, selects, checks, saves and plots, in that order. It uses requests, pandas and matplotlib (pip install requests pandas matplotlib) and runs on Python 3.9 or later.
"""Fetch full-year revenue and operating income, check comparability, save CSV and a chart.
Usage: python income_trend.py 7203 --end 2025-03 --count 5
"""
from __future__ import annotations
import argparse
import json
import os
import sys
from datetime import datetime, timezone
import matplotlib
matplotlib.use("Agg")
import pandas as pd
import requests
BASE_URL = "https://api.zenithcode.net/stable"
def fetch_annual(symbol: str, api_key: str, limit: int = 10) -> list[dict]:
"""Return full-year (FY) rows, newest first. One call costs 1 token."""
response = requests.get(
f"{BASE_URL}/income-statement",
params={"symbol": symbol, "period": "annual", "limit": limit},
headers={"x-api-key": api_key},
timeout=30,
allow_redirects=False,
)
response.raise_for_status()
rows = response.json()
if not isinstance(rows, list):
raise ValueError("Response is not an array")
return rows
def pick_periods(rows: list[dict], end: str | None, count: int) -> list[str]:
"""List `count` fiscal periods ending at `end` (e.g. 2025-03), oldest first."""
ends = sorted({r["fiscalPeriod"] for r in rows if r.get("period") == "FY"})
if not ends:
raise ValueError("No full-year rows")
end = end or ends[-1]
year, month = int(end[:4]), end[5:]
return [f"{y}-{month}" for y in range(year - count + 1, year + 1)]
def check(rows: list[dict], symbol: str, periods: list[str]):
"""Split issues into errors (stop) and warnings (read before you chart)."""
errors, warnings, picked = [], [], {}
for row in rows:
fp = row.get("fiscalPeriod")
if row.get("symbol") != symbol or row.get("period") != "FY" or fp not in periods:
continue
if fp in picked:
errors.append(f"{fp}: two rows for the same fiscal period")
picked[fp] = row
for fp in periods:
row = picked.get(fp)
if row is None:
errors.append(f"{fp}: no row (pre-listing year or outside coverage?)")
continue
for field in ("revenue", "operatingIncome"):
value = row.get(field)
if isinstance(value, bool) or not isinstance(value, (int, float)):
reason = row.get("nullReason") or "null"
errors.append(f"{fp}: {field} missing ({reason})")
if row.get("consolidation") != "consolidated":
warnings.append(f"{fp}: consolidation = {row.get('consolidation')}")
days = row.get("fiscalPeriodDays")
if not isinstance(days, (int, float)) or not 360 <= days <= 366:
warnings.append(f"{fp}: period is {days} days (fiscal year-end change?)")
standards = {str(r.get("accountingStandard")).lower() for r in picked.values()}
if len(standards) > 1:
warnings.append(f"accounting standard changes within the range: {sorted(standards)}")
return [picked[fp] for fp in periods if fp in picked], errors, warnings
def to_frame(rows: list[dict]) -> pd.DataFrame:
return pd.DataFrame(
{
"fiscalPeriod": [r["fiscalPeriod"] for r in rows],
"accountingStandard": [r.get("accountingStandard") for r in rows],
"consolidation": [r.get("consolidation") for r in rows],
"fiscalPeriodDays": [r.get("fiscalPeriodDays") for r in rows],
"revenue_jpy": [r["revenue"] for r in rows],
"operatingIncome_jpy": [r["operatingIncome"] for r in rows],
"docId": [(r.get("provenance") or {}).get("docId") for r in rows],
"updatedAt": [r.get("updatedAt") for r in rows],
}
).set_index("fiscalPeriod")
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("symbol")
parser.add_argument("--end", help="Last fiscal period (YYYY-MM). Defaults to the newest FY in the response")
parser.add_argument("--count", type=int, default=5)
args = parser.parse_args()
api_key = os.environ.get("ZENITH_API_KEY", "").strip()
if not api_key:
sys.exit("Set the ZENITH_API_KEY environment variable")
retrieved_at = datetime.now(timezone.utc).isoformat(timespec="seconds")
rows = fetch_annual(args.symbol, api_key)
with open(f"income-{args.symbol}.json", "w", encoding="utf-8") as f:
json.dump({"retrievedAt": retrieved_at, "rows": rows}, f, ensure_ascii=False, indent=2)
periods = pick_periods(rows, args.end, args.count)
picked, errors, warnings = check(rows, args.symbol, periods)
for message in warnings:
print("Warning:", message)
if errors:
sys.exit("\n".join(["Stopped:"] + errors))
df = to_frame(picked)
df["retrievedAt"] = retrieved_at
df.to_csv(f"income-{args.symbol}.csv", encoding="utf-8-sig")
# Print in JPY million, like Japanese filings (stored values stay in yen)
million = (df[["revenue_jpy", "operatingIncome_jpy"]] / 1_000_000).round().astype("int64")
million.columns = ["Revenue (JPY mn)", "Operating income (JPY mn)"]
print(million.to_string(formatters={c: "{:,}".format for c in million.columns}))
trillion = df[["revenue_jpy", "operatingIncome_jpy"]] / 1e12
trillion.columns = ["Revenue (JPY tn)", "Operating income (JPY tn)"]
axes = trillion.plot(kind="bar", subplots=True, layout=(2, 1), sharex=True,
legend=False, figsize=(6, 6), rot=0)
axes[-1][0].set_xlabel("Fiscal year end")
axes[0][0].figure.suptitle(f"{args.symbol} (FY, retrieved {retrieved_at[:10]} UTC)")
axes[0][0].figure.savefig(f"income-{args.symbol}.png", dpi=150, bbox_inches="tight")
if __name__ == "__main__":
main()
The API key comes from the ZENITH_API_KEY environment variable. Do not hard-code it or pass it as a command-line argument. On macOS or Linux:
export ZENITH_API_KEY="YOUR_API_KEY"
python income_trend.py 7203 --end 2025-03 --count 5
What each function does
fetch_annual()calls the API once. The response is saved to JSON, so you can restyle the chart without calling again.pick_periods()builds the list of fiscal periods from the last year and the count. Without--end, the newest FY in the response is the last one. For a March year-end company you get2021-03through2025-03, all with the same month.check()sorts issues into two groups. A missing year, a duplicated year or anullamount stops the script (errors). A consolidation flag other thanconsolidated, a period outside 360–366 days, or a change of accounting standard is printed as a warning.to_frame()fixes the columns to save. It keeps the document ID, update timestamp and retrieval timestamp, so you can trace each value back to a filing and a point in time.
Errors and warnings are separate because the right response depends on your goal. You may want to drop a shortened transition year from the chart but keep it in the table. Read the warnings and decide.
Output
With the values retrieved at 16:50 JST on October 27, 2026, the table prints like this. Warning lines appear above the table only when a year triggers one.
Revenue (JPY mn) Operating income (JPY mn)
fiscalPeriod
2021-03 27,214,594 2,197,748
2022-03 31,379,507 2,995,697
2023-03 37,154,298 2,725,025
2024-03 45,095,325 5,352,934
2025-03 48,036,704 4,795,586
We checked these five years of revenue and operating income against the consolidated results in Toyota's published financial summaries. All five years were ifrs. The chart shows revenue on top and operating income below, in JPY trillion. The two panels have different y-axis scales, so do not compare bar heights across panels.
What the five years show
Here are the facts you can read from the table.
| Fiscal year ended | Revenue (¥ tn) | Operating income (¥ tn) |
|---|---|---|
| March 2021 | 27.21 | 2.20 |
| March 2022 | 31.38 | 3.00 |
| March 2023 | 37.15 | 2.73 |
| March 2024 | 45.10 | 5.35 |
| March 2025 | 48.04 | 4.80 |
- Revenue rose in every one of the five years.
- Operating income fell year over year in the years ended March 2023 and March 2025.
- In the year ended March 2025, revenue went up while operating income went down.
The two panels make it clear that revenue and operating income do not always move together. These two lines alone do not explain why. For cost of sales, SG&A, currency effects or segment trends, check the company's materials or other fields. For profit relative to revenue, see checking operating margin against the API value.
Same data in JavaScript
On Node.js 18 or later you can print the same table with no extra packages. Save it as income.mjs and run node income.mjs.
// Node.js 18+. Set ZENITH_API_KEY in your environment first
const url = "https://api.zenithcode.net/stable/income-statement?symbol=7203&period=annual&limit=10";
const res = await fetch(url, { headers: { "x-api-key": process.env.ZENITH_API_KEY } });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
// In JavaScript, null / 1e6 is 0. Only divide real numbers
const toMillion = (v) => (typeof v === "number" ? Math.round(v / 1e6) : null);
const rows = (await res.json())
.filter((r) => r.period === "FY" && r.fiscalPeriod >= "2021-03" && r.fiscalPeriod <= "2025-03")
.sort((a, b) => a.fiscalPeriod.localeCompare(b.fiscalPeriod));
console.table(rows.map((r) => ({
fiscalPeriod: r.fiscalPeriod,
revenueMillion: toMillion(r.revenue),
operatingIncomeMillion: toMillion(r.operatingIncome),
consolidation: r.consolidation,
days: r.fiscalPeriodDays,
})));
Keep the type check in toMillion(). In JavaScript null / 1e6 evaluates to 0, which silently turns a missing value into "¥0".
Reading the numbers correctly
Even when the API returns the right data, reading it the wrong way makes it look wrong. These points come from how this endpoint is defined.
revenue may not match the "net sales" line of an earnings summary
revenue is the top line the company leads its results with. Retailers that headline "operating revenue" report net sales plus other operating revenue there. If you need the "net sales" line itself, read netSales. For banks and insurers revenue holds ordinary revenues, and for securities firms it holds operating revenues. Railways, utilities and banks return netSales as null. Keep this in mind when comparing revenue across industries (revenue definition).
fiscalPeriod is the period-end month; check the length separately
2025-03 does not mean "March 2025 only". It is the 12 months ending in March. For Toyota that is April 1, 2024 to March 31, 2025. It has nothing to do with the announcement or retrieval date. When a company changes its fiscal year-end, the transition year can be short, such as nine months. Use fiscalPeriodDays to spot it. A normal 12-month year does not always show the same number: in the documentation sample response, Toyota's year ended March 2025 is 364 days and the year ended March 2024 is 365. Test a range rather than an exact value.
The consolidation flag returns null when it cannot tell
consolidation is consolidated for consolidated statements and nonconsolidated for parent-only statements. It is null when there is nothing to decide from, or when the earnings summary and the annual report disagree. In the year a company first acquires a subsidiary at year-end, the income statement row can be parent-only (nonconsolidated). Breaks caused by share exchanges or changes in the scope of consolidation are not shown by this flag. If a company's scope changed a lot mid-series, check the notes in its annual report.
null is not zero
Values that cannot be computed or were not disclosed come back as null, never as 0. For years where the company prepares its statements in a currency other than yen, such as US dollars, every amount is null, nullReason is non_jpy_material, and reportedCurrency holds the currency. The API does not convert currencies. The script treats those years as errors.
Some years have no row at all
Newly listed companies may have no income statement for years before listing, when the first post-listing earnings summary does not include the prior full year. Companies on TOKYO PRO Market have no XBRL financial filings, so their financials are not loaded. Raising limit does not create years that are not there.
Compare accounting standards case-insensitively
In this response accountingStandard came back in lowercase, such as ifrs. The documentation also writes the values as JGAAP or IFRS. The script lowercases them before comparing. When a company moves from Japanese GAAP to IFRS, what counts as operating income can change around that year, so the script flags it.
Values reflect the time you fetched them
When a company files an amendment, a past year's values can change later. Each row's updatedAt is when the data pipeline updated it, which is not the same as your own retrieval time (retrievedAt). Both are UTC. Keeping both in the CSV lets you compare when values change. For recording filing IDs, disclosure times and restatements, see tracking the source of every financial figure.
Troubleshooting
| Symptom | What to check |
|---|---|
HTTP 401 |
Typo in the key, or an expired key |
HTTP 403 |
Key status and what your plan covers |
HTTP 429 |
Quota or rate limit. Do not retry in a tight loop |
| Stops with "no row" | For non-March year-ends, does --end use the right month? Did you include a pre-listing year? |
| Stops with "two rows for the same fiscal period" | Did you pass period=annual? If it still happens, compare the document IDs |
Warning consolidation = None |
Undetermined year. Check whether the annual report includes consolidated statements |
CSV shows 4.80367E+13 |
Spreadsheet scientific notation. Change the cell format to number |
Showing the results to others
Fetching, saving and charting data for your own analysis is allowed on every plan. Making your tables or charts visible to third parties, in external materials or your own product, depends on your plan. Financial figures can be displayed on the Business plan or higher. TDnet documents themselves (PDFs, text and links), such as kessan tanshin, cannot be shown to third parties on any plan. Do not put links from rows where provenance.source is tdnet on public pages. See display rights for details.
Related docs and articles
- Income statement (income-statement) — all parameters and response fields
- Metric definitions: period basis, revenue, null handling
- Check operating margin against the API value
- What to align before comparing two companies
- Choosing fiscal periods and year-over-year changes
- Public examples on GitHub — the
trendcommand runs the same kind of trend on fictional demo data
A Japanese series with screenshots is available on Qiita.
This page explains how to retrieve financial data. It is not a recommendation to buy or sell any security.