Get segment costs
curl --request GET \
--url https://api.financialdatasets.ai/financials/segment-costs \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/financials/segment-costs"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/financials/segment-costs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/financials/segment-costs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/financials/segment-costs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/financials/segment-costs")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/financials/segment-costs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"segment_costs": [
{
"ticker": "<string>",
"report_period": "2023-12-25",
"fiscal_period": "<string>",
"period": "annual",
"currency": "<string>",
"accession_number": "<string>",
"filing_url": "<string>",
"tables": [
{
"name": "<string>",
"line_items": [
{
"label": "<string>",
"standard_label": "<string>",
"value": 123,
"unit": "<string>"
}
],
"rows": [
{
"name": "<string>",
"line_items": [
{
"label": "<string>",
"standard_label": "<string>",
"value": 123,
"unit": "<string>"
}
]
}
]
}
]
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}Datasets
Segment Costs API
The costs of each business segment as reported: cost of goods sold, selling and administrative expense, depreciation, other segment items, and the company’s own cost lines, from 2016 onward.
GET
/
financials
/
segment-costs
Get segment costs
curl --request GET \
--url https://api.financialdatasets.ai/financials/segment-costs \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/financials/segment-costs"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/financials/segment-costs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/financials/segment-costs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/financials/segment-costs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/financials/segment-costs")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/financials/segment-costs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"segment_costs": [
{
"ticker": "<string>",
"report_period": "2023-12-25",
"fiscal_period": "<string>",
"period": "annual",
"currency": "<string>",
"accession_number": "<string>",
"filing_url": "<string>",
"tables": [
{
"name": "<string>",
"line_items": [
{
"label": "<string>",
"standard_label": "<string>",
"value": 123,
"unit": "<string>"
}
],
"rows": [
{
"name": "<string>",
"line_items": [
{
"label": "<string>",
"standard_label": "<string>",
"value": 123,
"unit": "<string>"
}
]
}
]
}
]
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}Overview
The Financial Datasets segment costs API returns each cost a company reported for each of its segments in its annual and quarterly reports: cost of goods sold, selling, general and administrative expense, research and development, depreciation and amortization, interest expense, income tax, other segment items, and the cost lines the company defined itself. It includes the parts that tie the segments to the whole company, such asCorporate and Eliminations, when the company reports them.
The dataset holds costs only. Revenue, profit, and assets per segment are in Segmented Financials.
You can call it as a REST endpoint with an API key, or from Claude, ChatGPT, Cursor, and other AI apps through the MCP server, or pay per request with x402. Pricing starts at $20.
Use it to answer questions like:
- How much did each of Amazon’s segments spend, and how much depreciation did each carry?
- What does it cost McDonald’s to run its company-operated restaurants in the U.S.?
- How did the cost of goods sold of Caterpillar’s segments change?
Coverage
| Companies | History | Updated |
|---|---|---|
| US companies | From 2016 | Within minutes of each new report |
Which API to Use
| API | What it returns |
|---|---|
/financials/segments | Revenue, operating income, and depreciation by segment; assets, goodwill, and long-lived assets by segment; capital expenditure by segment |
/financials/segment-costs | Each cost line of each segment, in the company’s own tables and wording |
What Counts as a Segment Cost
A line is in the dataset when all three hold:- It stands on the row of a segment, or of a part that ties the segments to the whole company (
Corporate,Eliminations). The same cost for the whole company, with no row, is in the income statement. - It is an amount for a span of time. A balance on a date is not a cost.
- It is a cost. A standard line counts when it is one of the standard cost lines of a segment table. A line the company defined itself counts when the company books it on the cost side.
Filtering the Data
tickerorcik: one is required.period(required):annual,quarterly,six_months_ytd, ornine_months_ytd. There is nottm.limit: the maximum number of report periods to return, newest first (default 4, maximum 20). Each page holds up to 10 periods, linked bynext_page_url.report_period,report_period_gte,report_period_lte,report_period_gt,report_period_lt: filter by report period date (YYYY-MM-DD).
Periods
period | Reports | Lines of each item | fiscal_period |
|---|---|---|---|
annual | Each annual report | All lines | FY2025 |
quarterly | Each quarterly report, and the annual report as the fourth quarter | The balances, and the numbers of the three months | 2025-Q3 |
six_months_ytd | Each second-quarter report | The balances, and the numbers of the first six months of the fiscal year | 2025-6M |
nine_months_ytd | Each third-quarter report | The balances, and the numbers of the first nine months of the fiscal year | 2025-9M |
quarterly to read the three months, and six_months_ytd or nine_months_ytd to read the fiscal year so far.
A company files no separate report for its fourth quarter, and a cost is never a balance, so quarterly has no fourth quarter. Nothing is calculated for it. Read the year under annual.
History
A new accounting rule asks companies to report their significant costs per segment from 2024 on. Most companies report the detail from their 2024 annual report onward. Older reports often state only depreciation, interest, or income tax per segment.Response
Each item undersegment_costs is one report. It carries ticker, report_period, fiscal_period, period, currency, accession_number, and filing_url (a link to the report), and tables, in the company’s own order.
A table:
| Field | Meaning |
|---|---|
name | The company’s own title of the table. |
line_items | Lines with no row. A segment cost always has a row, so this is usually empty. |
rows | The rows of the table. A row is one segment, such as AWS, or one part that ties the segments to the whole company, such as Corporate. |
| Field | Meaning |
|---|---|
name | The company’s own words for the row. When the company names a row in two or more parts, the parts are joined with |: Construction Industries | Operating Segments. |
line_items | The cost lines of that row. |
| Field | Meaning |
|---|---|
label | The company’s own words for the line. |
standard_label | The standard accounting name of the line, the same at every company. null for a line the company defined itself. |
value | The value as the company filed it. |
unit | The unit of the value: a currency code such as USD, percent, duration, date, pure for a plain number such as a ratio, or a unit the company defined itself. |
"rows": [], and a table with rows only has "line_items": [].
Every value is the number the company filed:
- Nothing is calculated. A total appears only when the company reported one.
- A sign is never changed. An “other segment items” line can be negative.
Standard Names
Usestandard_label to find the same line at every company. The most common names:
standard_label | What it is |
|---|---|
Depreciation, Depletion and Amortization | Depreciation and amortization of the segment |
Selling, General and Administrative Expense | Selling, general, and administrative expense |
Cost of Product and Service Sold | Cost of goods and services sold |
Cost of Revenue | Cost of revenue |
Segment Reporting, Other Segment Item, Amount | The segment’s other items: the gap between its revenue, its listed costs, and its profit |
Income Tax Expense (Benefit) | Income tax of the segment |
Restructuring Charges | Restructuring charges |
Operating Expenses | Operating expenses |
Costs and Expenses | All costs and expenses of the segment |
Labor and Related Expense | Labor cost |
General and Administrative Expense | General and administrative expense |
Interest Expense, Nonoperating | Interest expense |
Company operated restaurants expenses, has standard_label null.
Standard names change a little over the years. Each report carries the names that were in use when it was filed, so a 2018 report can name a line differently than a 2025 report.
Example
Segment Costs
import requests
# add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here"
}
# set your query params
params = {
"ticker": "MCD", # stock ticker
"period": "annual", # annual, quarterly, six_months_ytd, or nine_months_ytd
"limit": 1, # number of report periods to return
}
# make API request
url = "https://api.financialdatasets.ai/financials/segment-costs"
response = requests.get(url, headers=headers, params=params)
# parse the segment costs from the response
segment_costs = response.json().get("segment_costs")
# print the latest report: each table, its lines, and its rows
def print_lines(line_items, indent):
for line in line_items:
print(f"{indent}{line['label']}: {line['value']} {line['unit']}")
for table in segment_costs[0]["tables"]:
print(table["name"])
print_lines(table["line_items"], " ")
for row in table["rows"]:
print(" " + row["name"])
print_lines(row["line_items"], " ")
Response
{
"segment_costs": [
{
"ticker": "MCD",
"report_period": "2025-12-31",
"fiscal_period": "FY2025",
"period": "annual",
"currency": "USD",
"accession_number": "0000063908-26-000035",
"filing_url": "https://www.sec.gov/Archives/edgar/data/63908/000006390826000035/mcd-20251231.htm",
"tables": [
{
"name": "Segment and Geographic Information (Detail)",
"line_items": [],
"rows": [
{
"name": "U.S.",
"line_items": [
{
"label": "Franchised restaurants-occupancy expenses",
"standard_label": null,
"value": 1293000000,
"unit": "USD"
},
{
"label": "Company operated restaurants expenses",
"standard_label": null,
"value": 2755000000,
"unit": "USD"
},
{
"label": "Selling, general & administrative expenses",
"standard_label": "Selling, General and Administrative Expense",
"value": 653000000,
"unit": "USD"
},
{
"label": "Total Other Segment Items",
"standard_label": "Segment Reporting, Other Segment Item, Amount",
"value": 316000000,
"unit": "USD"
},
{
"label": "Depreciation and amortization",
"standard_label": "Depreciation, Depletion and Amortization, Nonproduction",
"value": 995000000,
"unit": "USD"
}
]
},
{
"name": "International Operated Markets",
"line_items": [
{
"label": "Franchised restaurants-occupancy expenses",
"standard_label": null,
"value": 1324000000,
"unit": "USD"
},
{
"label": "Company operated restaurants expenses",
"standard_label": null,
"value": 5101000000,
"unit": "USD"
},
{
"label": "Selling, general & administrative expenses",
"standard_label": "Selling, General and Administrative Expense",
"value": 705000000,
"unit": "USD"
},
{
"label": "Total Other Segment Items",
"standard_label": "Segment Reporting, Other Segment Item, Amount",
"value": 122000000,
"unit": "USD"
},
{
"label": "Depreciation and amortization",
"standard_label": "Depreciation, Depletion and Amortization, Nonproduction",
"value": 789000000,
"unit": "USD"
}
]
},
{
"name": "International Developmental Licensed Markets & Corporate",
"line_items": [
{
"label": "Franchised restaurants-occupancy expenses",
"standard_label": null,
"value": 1000000,
"unit": "USD"
},
{
"label": "Company operated restaurants expenses",
"standard_label": null,
"value": 413000000,
"unit": "USD"
},
{
"label": "Selling, general & administrative expenses",
"standard_label": "Selling, General and Administrative Expense",
"value": 1682000000,
"unit": "USD"
},
{
"label": "Total Other Segment Items",
"standard_label": "Segment Reporting, Other Segment Item, Amount",
"value": 128000000,
"unit": "USD"
},
{
"label": "Depreciation and amortization",
"standard_label": "Depreciation, Depletion and Amortization, Nonproduction",
"value": 415000000,
"unit": "USD"
}
]
}
]
}
]
}
]
}
FAQ
What is the difference between this dataset and Segmented Financials?
Segmented Financials gives a few fixed fields for each segment: revenue, operating income, depreciation, assets, and capital expenditure. This dataset gives every cost line the company reports for each segment, in its own words.Is the data standardized?
No. The lines are the company’s own, in the company’s own order. Each standard line also carriesstandard_label, a name that is the same at every company, so you can find the same line across companies.
Why does the response have no fourth quarter?
A cost is a number for a span of time, and a company files no separate report for its fourth quarter. Read the year underannual. Nothing is calculated for the fourth quarter.
Is every line a cost?
Each line passes the three tests above. A few lines a company defines itself are on the cost side of its books without being a cost of running the segment, such as a change in goodwill. They keep the company’s own label, so you can leave them out.What does a company with no segment costs return?
An emptysegment_costs list, when its reports state no cost on a segment row. An empty response is not charged.
How far back does the data go?
To 2016.Which periods are available?
Annual, quarterly, the first six months, and the first nine months of the fiscal year. There is no TTM.Can an AI agent use this data?
Yes. Claude, ChatGPT, Cursor, and other MCP clients reach it through the Financial Datasets MCP server, with theget_financials tool and the dataset segment_costs.
Related
Announcement
Introducing the Segment Costs API, on the Financial Datasets news page.
MCP server
Use Segment Costs from Claude, ChatGPT, Cursor, and other AI apps.
Query Parameters
The kind of report. annual returns each annual report. quarterly returns each quarterly report, and the annual report as the fourth quarter with its balances only. six_months_ytd and nine_months_ytd return the second-quarter and third-quarter reports with the numbers of the fiscal year so far.
Available options:
annual, quarterly, six_months_ytd, nine_months_ytd