A company's total revenue and margin are easy to find in its kessan tanshin (earnings summary). The questions in a management meeting go one level down: which business earns the profit, and which business gets the capital spending? This page pulls the segment note of Japanese annual securities reports through an API and turns competitors' segment revenue, profit and capex into one table.
The examples use fiscal-year data for the year ended March 2026 for Toyota Motor (7203) and Suzuki Motor (7269), retrieved from ZENITH Code on October 29, 2026.
What you will get from this page
- How to take only the reportable-segment table from
/segmentsand turn it into one row per segment - Rules for separating total and adjustment rows, such as 連結 (consolidated) or 消去又は全社 (eliminations or corporate), from business rows
- An example of how much a margin moves depending on whether intersegment sales are in the denominator
- A reconciliation against income-statement revenue that catches misread rows
- When a year-over-year comparison is valid
Common ways segment comparisons go wrong
Each company defines its own segments, so names and counts differ. Copying them into a spreadsheet invites four mistakes.
- Adding parts to totals. The table also has rows for the consolidated total, subtotals and eliminations. Summing everything nearly doubles the number.
- Mixing in geographic tables. Besides the reportable-segment table, an annual report has "related information" tables by product or service and by region. "Japan" or "North America" there is a different table's number.
- Inconsistent margin denominators. Whether intragroup (intersegment) sales are in the denominator can change a margin dramatically.
- Comparing across a reorganization. Matching similarly named segments across a resegmentation year counts a change in scope as growth.
An API removes the copying, but you still need a rule for each of these. The code below writes every one of them down.
The shape of the /segments response
/segments returns the segment note of an annual securities report as one row per segment and metric. Each call costs one token.
| Field | Contents |
|---|---|
items |
Rows of the reportable-segment table only. No related-information rows |
relatedItems |
Rows of related-information tables, each with tableKind: product_service, geographic or condensed_statements (condensed statements by business) |
unitMultiplier |
The table's unit, such as 1000000 for millions of yen. Multiply value by it to get yen |
note |
Why items is empty, when it is (a single-segment company, or a table layout that could not be read) |
fiscalPeriod, docId, submittedAt |
Fiscal period, document ID and filing time |
Each row in items has segment (the segment name), metric (what the number is), rawLabel (the row heading in the filing) and value. This page uses five metrics.
metric |
Meaning |
|---|---|
net_sales_external |
Sales to external customers |
net_sales_intersegment |
Intersegment sales or transfers |
segment_profit |
Segment profit or loss |
capital_expenditure |
Increase in property, plant and equipment and intangible assets |
depreciation |
Depreciation and amortization |
rawLabel varies by company: Toyota writes 外部顧客への営業収益 and Suzuki writes 外部顧客からの売上収益. Decide what a row means from metric, not from rawLabel.
Turn one company's rows into one row per segment
First, group the incoming rows by segment name and lay out sales, profit and capex side by side.
import csv, json, os, re, urllib.parse, urllib.request
from urllib.error import HTTPError
BASE = "https://api.zenithcode.net/stable"
API_KEY = os.environ.get("ZENITH_API_KEY", "YOUR_API_KEY")
FIELDS = {
"net_sales_external": "external",
"net_sales_intersegment": "intersegment",
"segment_profit": "profit",
"capital_expenditure": "capex",
"depreciation": "depreciation",
}
def get(path, **params):
url = f"{BASE}{path}?{urllib.parse.urlencode(params)}"
req = urllib.request.Request(url, headers={"x-api-key": API_KEY})
with urllib.request.urlopen(req, timeout=30) as res:
return json.load(res)
def fetch_segments(symbol, fiscal_period=None):
params = {"symbol": symbol}
if fiscal_period:
params["fiscalPeriod"] = fiscal_period
try:
return get("/segments", **params)[0]
except HTTPError as e:
if e.code == 404: # no annual securities report
return None
raise
Next, classify each segment by its name. Total and adjustment rows never share an axis with business rows. Segment names arrive in Japanese, so the patterns are Japanese too.
# 連結 = consolidated, 合計/計/総計 = total, 報告セグメント計 = reportable segments total
TOTAL = re.compile(r"^(連結|連結計|合計|計|総計|報告セグメント計|セグメント計)$")
# 消去 = elimination, 調整 = adjustment, 全社 = corporate, セグメント間 = intersegment
ADJUST = re.compile(r"消去|調整|全社|セグメント間")
def kind(name):
n = re.sub(r"\s", "", name)
if TOTAL.match(n) or n.endswith("計上額"): # "...amount on the consolidated statements"
return "total"
# 消去又は全社 is an adjustment row; 自動車事業及び消去 is a business (事業) reported with eliminations
if ADJUST.search(n) and "事業" not in n:
return "adjustment"
return "segment"
def segment_rows(doc):
mult = doc.get("unitMultiplier")
rows, conflicts = {}, set()
for item in doc["items"]:
field = FIELDS.get(item["metric"])
if field is None:
continue
name = item["segment"].strip()
row = rows.setdefault(name, {"segment": name, "kind": kind(name)})
value = None if item["value"] is None or mult is None else item["value"] * mult
if field in row and row[field] != value:
conflicts.add((name, field)) # two different values for one segment and metric
row[field] = value
for name, field in conflicts:
rows[name][field] = None # do not pick a winner
return list(rows.values())
Three rules are built in.
- Convert to yen. Multiply
valuebyunitMultiplier. If the unit is unknown (unitMultiplieris null), leave the amount blank. - Two different values for the same segment and metric means neither is used. Picking one leaves you unable to explain the number in the deck.
- Name rules grow over time. Disclosure wording varies. When you meet a new pattern, add it to
TOTALorADJUST.
Compute margins and the business mix
Keep both versions of the margin.
def share(a, b):
return None if a is None or b is None or b <= 0 else a / b
def add_ratios(rows):
segs = [r for r in rows if r["kind"] == "segment"]
total_external = sum(r.get("external") or 0 for r in segs)
for r in rows:
ext, inter = r.get("external"), r.get("intersegment")
gross = None if ext is None else ext + (inter or 0)
r["marginOnExternal"] = share(r.get("profit"), ext)
r["marginOnTotal"] = share(r.get("profit"), gross)
r["mix"] = share(ext, total_external) if r["kind"] == "segment" else None
return rows
The mix uses business rows only. Totals and adjustments stay out of both the numerator and the denominator.
Reconcile the segment total with reported revenue
If a total or breakdown row slips past the name rules, the mix goes wrong. To catch that, add up external sales across business rows and compare the sum with income-statement revenue for the same fiscal year. External sales across all segments should come very close to company-wide revenue.
def coverage(symbol, fiscal_period, rows):
income = get("/income-statement", symbol=symbol, period="annual", limit=3)
year = next((y for y in income if y["fiscalPeriod"] == fiscal_period), None)
revenue = year and year["revenue"]
total = sum(r.get("external") or 0 for r in rows if r["kind"] == "segment")
return share(total, revenue) # None without a matching fiscal year
If the result is off by more than 1%, check the table in the filing. Rounding to the table's unit (often millions of yen) can make the sum differ slightly from revenue, so it does not have to be exactly 1.
Put several companies into one CSV
Finally, write all competitors to a long table, one row per company and segment. A long table drops straight into an Excel pivot table, by company or by segment.
COLS = ["symbol", "fiscalPeriod", "docId", "segment", "kind", "external", "intersegment",
"profit", "marginOnExternal", "marginOnTotal", "mix", "capex", "depreciation", "coverage"]
def run(symbols, path="segments.csv"):
with open(path, "w", newline="", encoding="utf-8-sig") as f:
w = csv.DictWriter(f, fieldnames=COLS)
w.writeheader()
for symbol in symbols: # one company at a time
doc = fetch_segments(symbol)
if doc is None or not doc["items"]:
reason = "no annual report" if doc is None else doc.get("note") or "no segments"
w.writerow({"symbol": symbol, "segment": reason})
continue
rows = add_ratios(segment_rows(doc))
cov = coverage(symbol, doc["fiscalPeriod"], rows)
for r in rows:
w.writerow({**{c: r.get(c) for c in COLS}, "symbol": symbol,
"fiscalPeriod": doc["fiscalPeriod"], "docId": doc["docId"],
"coverage": cov})
run(["7203", "7269", "7267", "7270", "7261", "7201"])
When items is empty, the script writes the note text as its own row. Silently dropping the company would make "no segment data" indistinguishable from "failed to fetch." Each company costs two tokens (/segments and /income-statement), so six companies cost 12.
Sample output: Toyota Motor, fiscal year ended March 2026
Rounded to ¥100 million (oku yen, the unit Japanese decks commonly use), the CSV reads:
| Segment | Kind | External sales | Segment profit | Margin (external) | Capex | Depreciation |
|---|---|---|---|---|---|---|
| Automotive (自動車) | business | 452,019.2 | 27,770.5 | 6.1% | 24,536.4 | 14,172.4 |
| Financial services (金融) | business | 48,190.0 | 8,517.2 | 17.7% | 35,119.4 | 9,204.3 |
| All other (その他) | business | 6,640.3 | 1,320.8 | 19.9% | 647.5 | 548.5 |
| Eliminations/corporate (消去又は全社) | adjustment | — | 53.7 | — | 294.5 | — |
| Consolidated (連結) | total | 506,849.5 | 37,662.2 | 7.4% | 60,597.8 | 23,925.2 |
By sales, the mix is automotive 89.2%, financial services 9.5% and all other 1.3%. A slide that shows only the sales mix makes Toyota look like a pure carmaker. By segment profit, though, financial services' ¥851.72 billion is more than a fifth of the total. When the question is where the money is made, show sales and profit together.
External sales across the business rows add up to ¥50.68 trillion, matching income-statement revenue. The reconciliation value is 1.000, or 100.0% on screen.
Margins depend on the denominator
Toyota's "all other" segment sells ¥664.03 billion to external customers and ¥987.39 billion to other segments. Most of its sales stay inside the group.
| Denominator | Margin |
|---|---|
| External sales (¥664.03 billion) | 19.9% |
| Sales including intersegment (¥1.65 trillion) | 8.0% |
The same segment's margin more than doubles depending on the denominator. If your figure disagrees with the company's investor presentation, check the denominator first, and always state which one you used.
Putting the mix next to a competitor's
For the fiscal year ended March 2026, Suzuki's mix was automobiles (四輪事業) 90.7%, motorcycles (二輪事業) 7.2%, marine (マリン事業) 1.9% and other (その他事業) 0.2%. That looks close to Toyota's automotive 89.2%, but each company draws its own segment boundaries. "Automotive" and "automobiles" need not cover the same scope. Do not combine segments across companies or match them by name. Show each company's segments as reported.
Comparing with the prior year
Fetch the prior year by passing its fiscal period to fiscalPeriod, for example fiscalPeriod=2025-03 for Toyota.
def comparable(now_rows, prev_rows):
names = lambda rows: sorted(r["segment"] for r in rows if r["kind"] == "segment")
return names(now_rows) == names(prev_rows)
Show a year-over-year change only when the business segment names match exactly in both years. If a single character differs, skip it. In a reorganization year, the annual report may restate the prior year under the new segments. To compare across a reorganization, read that note in the filing.
Reading the numbers correctly
Regional and product figures live in relatedItems
items holds the reportable-segment table only. Regional and product-or-service tables come back in relatedItems, labeled with tableKind. The same name can carry a different value in a different table. The API docs give Kuraray (3405) as an example: external sales of its vinyl acetate business are 387,169 in the reportable-segment table and 398,582 in the products-and-services table (both in millions of yen). For a regional mix, use the geographic rows in relatedItems, and never mix them with items.
When items is empty, read note
An empty items comes with a reason in note. 「単一セグメント(区分の表なし)」 means a single-segment company, including companies that omit other segments as immaterial. 「表パース未対応の様式(原文はtext_blocks参照)」 means the filing has a segment table, but the current-year rows could not be read. For those companies, read the original section with /text-blocks. Neither case means zero.
Segment capex is not cash-flow capex
Segment capital_expenditure is the increase in property, plant and equipment and intangible assets. The cash flow statement's capitalExpenditure is purchases of property, plant and equipment only. The segment total and the cash-flow figure usually do not match. Also note that Toyota's financial services capex (¥3.51 trillion) exceeds automotive capex (¥2.45 trillion). Each company defines capex in its notes, and some businesses include assets quite unlike factory equipment. Read the note before comparing capex across businesses.
Segment data comes from the annual securities report
Segments come from the annual securities report (yuho), which is filed after the earnings release. Right after a kessan tanshin, the income statement may already show the new year while segment data still shows the previous one. That is why the reconciliation requires matching fiscal periods. Check the fiscalPeriod column to see which year each row covers.
Segment names and rawLabel stay in Japanese
segment and rawLabel keep the filing's text and come back in Japanese even with lang=en. For English material, use the standard heading for each metric (labelEn) as the line item and translate segment names yourself.
Some period-end dates are filled in by the API
When periodEndInferred is true, the data platform left the period-end date empty and the API filled it in from the same filing. The value itself comes from the filing's table. You only need this flag when sorting by period-end date.
Adapting it to your company
- For a mix chart, plot
kind == "segment"rows only, and list totals and adjustments in a lighter row below. Drawing the whole and its parts on one axis makes bar lengths meaningless. - A mapping table ("their segment X corresponds to our business A") has to be built by a person and attached to the deck. API values are the raw material.
- To drill into one company with a screen, try the company deep-dive template. Its saved demo opens without an API key.
Related
- API docs: segments, income statement, annual report text blocks
- Related articles: Build a peer benchmarking table, Compare competitors' free cash flow and shareholder returns
- Templates: zenith-code-examples
- Data display rights
An illustrated series on the same material is on Qiita (in Japanese).
This page explains how to handle financial data. It is not a recommendation to buy or sell any security.