Search specific financial metrics
curl --request POST \
--url https://api.financialdatasets.ai/financials/search/line-items \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"line_items": [
"<string>"
],
"tickers": [
"<string>"
],
"period": "ttm",
"limit": 1
}
'import requests
url = "https://api.financialdatasets.ai/financials/search/line-items"
payload = {
"line_items": ["<string>"],
"tickers": ["<string>"],
"period": "ttm",
"limit": 1
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({line_items: ['<string>'], tickers: ['<string>'], period: 'ttm', limit: 1})
};
fetch('https://api.financialdatasets.ai/financials/search/line-items', 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/search/line-items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'line_items' => [
'<string>'
],
'tickers' => [
'<string>'
],
'period' => 'ttm',
'limit' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/financials/search/line-items"
payload := strings.NewReader("{\n \"line_items\": [\n \"<string>\"\n ],\n \"tickers\": [\n \"<string>\"\n ],\n \"period\": \"ttm\",\n \"limit\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.financialdatasets.ai/financials/search/line-items")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"line_items\": [\n \"<string>\"\n ],\n \"tickers\": [\n \"<string>\"\n ],\n \"period\": \"ttm\",\n \"limit\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/financials/search/line-items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"line_items\": [\n \"<string>\"\n ],\n \"tickers\": [\n \"<string>\"\n ],\n \"period\": \"ttm\",\n \"limit\": 1\n}"
response = http.request(request)
puts response.read_body{
"search_results": [
{
"ticker": "<string>",
"report_period": "2023-12-25",
"currency": "<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."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Search
Line Items
Search for specific financial statement line items across all US public companies.
POST
/
financials
/
search
/
line-items
Search specific financial metrics
curl --request POST \
--url https://api.financialdatasets.ai/financials/search/line-items \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"line_items": [
"<string>"
],
"tickers": [
"<string>"
],
"period": "ttm",
"limit": 1
}
'import requests
url = "https://api.financialdatasets.ai/financials/search/line-items"
payload = {
"line_items": ["<string>"],
"tickers": ["<string>"],
"period": "ttm",
"limit": 1
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({line_items: ['<string>'], tickers: ['<string>'], period: 'ttm', limit: 1})
};
fetch('https://api.financialdatasets.ai/financials/search/line-items', 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/search/line-items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'line_items' => [
'<string>'
],
'tickers' => [
'<string>'
],
'period' => 'ttm',
'limit' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/financials/search/line-items"
payload := strings.NewReader("{\n \"line_items\": [\n \"<string>\"\n ],\n \"tickers\": [\n \"<string>\"\n ],\n \"period\": \"ttm\",\n \"limit\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.financialdatasets.ai/financials/search/line-items")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"line_items\": [\n \"<string>\"\n ],\n \"tickers\": [\n \"<string>\"\n ],\n \"period\": \"ttm\",\n \"limit\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/financials/search/line-items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"line_items\": [\n \"<string>\"\n ],\n \"tickers\": [\n \"<string>\"\n ],\n \"period\": \"ttm\",\n \"limit\": 1\n}"
response = http.request(request)
puts response.read_body{
"search_results": [
{
"ticker": "<string>",
"report_period": "2023-12-25",
"currency": "<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."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Overview
This Line Items Search API lets you pull specific line items for a list of tickers by specifying a set ofline_items in your request.
Line items are financial data points that are found in the income statement, balance sheet, and cash flow statement.
Examples of line items are revenue, net income, total debt, free cash flow, and so on.
The purpose of this API is to let you easily get specific data points for a list of tickers in a single API request.
You can also specify a start_date and end_date to filter the line items by a specific date range.
Finally, you can specify a period, which must be one of "ttm", "annual", or "quarterly".
For example, you can search for net_income and total_debt for NVDA and AAPL and receive the following response:
{
"search_results": [
{
"ticker": "NVDA",
"report_period": "2024-07-28",
"period": "ttm",
"net_income": 53008000000,
"total_debt": 9765000000
},
{
"ticker": "AAPL",
"report_period": "2024-06-29",
"period": "ttm",
"net_income": 101956000000,
"total_debt": 101304000000
}
]
}
Coverage
| Tickers | Years of Coverage | Updated |
|---|---|---|
| 19,000+ | 30+ years | Within 1 second |
Available Line Items
# List of valid line_items for the income statement
line_items = [
"consolidated_income",
"cost_of_revenue",
"dividends_per_common_share",
"earnings_per_share",
"earnings_per_share_diluted",
"ebit",
"ebit_usd",
"earnings_per_share_usd",
"gross_profit",
"income_tax_expense",
"interest_expense",
"net_income",
"net_income_common_stock",
"net_income_common_stock_usd",
"net_income_discontinued_operations",
"net_income_non_controlling_interests",
"operating_expense",
"operating_income",
"preferred_dividends_impact",
"research_and_development",
"revenue",
"revenue_usd",
"selling_general_and_administrative_expenses",
"weighted_average_shares",
"weighted_average_shares_diluted",
]
# List of valid line_items for the balance sheet
line_items = [
"accumulated_other_comprehensive_income",
"cash_and_equivalents",
"cash_and_equivalents_usd",
"current_assets",
"current_debt",
"current_investments",
"current_liabilities",
"deferred_revenue",
"deposit_liabilities",
"goodwill_and_intangible_assets",
"inventory",
"investments",
"non_current_assets",
"non_current_debt",
"non_current_investments",
"non_current_liabilities",
"outstanding_shares",
"property_plant_and_equipment",
"retained_earnings",
"shareholders_equity",
"shareholders_equity_usd",
"tax_assets",
"tax_liabilities",
"total_assets",
"total_debt",
"total_debt_usd",
"total_liabilities",
"trade_and_non_trade_payables",
"trade_and_non_trade_receivables",
]
# List of valid line line_items for the cash flow statement
line_items = [
"business_acquisitions_and_disposals",
"capital_expenditure",
"change_in_cash_and_equivalents",
"depreciation_and_amortization",
"dividends_and_other_cash_distributions",
"effect_of_exchange_rate_changes",
"investment_acquisitions_and_disposals",
"issuance_or_purchase_of_equity_shares",
"issuance_or_repayment_of_debt_securities",
"net_cash_flow_from_financing",
"net_cash_flow_from_investing",
"net_cash_flow_from_operations",
"share_based_compensation",
]
Code Example
Financials Search
import requests
import json
# Add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here",
"Content-Type": "application/json"
}
# Prepare the request body
body = {
"period": "ttm",
"tickers": ["NVDA", "AAPL"],
"limit": 1,
"line_items": [
"net_income",
"total_debt"
]
}
# Create the URL
url = 'https://api.financialdatasets.ai/financials/search/line-items'
# Make API request
response = requests.post(url, headers=headers, data=json.dumps(body))
# Parse search results, which are ordered by report period, newest to oldest
search_results = response.json().get('search_results')
# Print the results
for result in search_results:
print(f"Ticker: {result['ticker']}")
print(f"Report Period: {result['report_period']}")
print(f"Revenue: ${result['net_income']:,.0f}")
print(f"Total Debt: ${result['total_debt']:,.0f}")
print("---")
Authorizations
API key for authentication.
Body
application/json
An array of line items to apply to the search.
Minimum array length:
1The financial metric to search for.
An array of tickers to apply to the search.
Minimum array length:
1The tickers to search for.
The time period for the financial data.
Available options:
annual, quarterly, ttm The maximum number of results to return.
Required range:
x >= 1Response
Successful search response
Show child attributes
Show child attributes
⌘I