> ## Documentation Index
> Fetch the complete documentation index at: https://docs.financialdatasets.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Get Fundamentals

> Learn how to fetch and analyze income statements, balance sheets, and cash flow statements for any US stock using Python.

Financial statements are the foundation of fundamental analysis. This guide shows you how to fetch income statements, balance sheets, and cash flow statements for any US public company using Python.

## Prerequisites

* Python 3.7+
* A Financial Datasets API key ([sign up here](https://financialdatasets.ai))
* The `requests` library (`pip install requests`)

## Step 1: Set Up Authentication

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import requests

headers = {
    "X-API-KEY": "your_api_key_here"
}
```

## Step 2: Fetch Income Statements

Use the [Income Statements API](/api/financials/income-statements) to get revenue, expenses, and net income data.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
ticker = "NVDA"
period = "annual"  # options: annual, quarterly, ttm
limit = 5          # number of periods to return

url = (
    f"https://api.financialdatasets.ai/financials/income-statements"
    f"?ticker={ticker}"
    f"&period={period}"
    f"&limit={limit}"
)

response = requests.get(url, headers=headers)
income_statements = response.json().get("income_statements")

for stmt in income_statements:
    print(f"{stmt['report_period']}: Revenue=${stmt['revenue']:,}, Net Income=${stmt['net_income']:,}")
```

## Step 3: Fetch Balance Sheets

Use the [Balance Sheets API](/api/financials/balance-sheets) to get assets, liabilities, and equity data.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
url = (
    f"https://api.financialdatasets.ai/financials/balance-sheets"
    f"?ticker={ticker}"
    f"&period={period}"
    f"&limit={limit}"
)

response = requests.get(url, headers=headers)
balance_sheets = response.json().get("balance_sheets")

for stmt in balance_sheets:
    print(f"{stmt['report_period']}: Assets=${stmt['total_assets']:,}, Equity=${stmt['total_equity']:,}")
```

## Step 4: Fetch Cash Flow Statements

Use the [Cash Flow Statements API](/api/financials/cash-flow-statements) to get operating, investing, and financing cash flows.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
url = (
    f"https://api.financialdatasets.ai/financials/cash-flow-statements"
    f"?ticker={ticker}"
    f"&period={period}"
    f"&limit={limit}"
)

response = requests.get(url, headers=headers)
cash_flow_statements = response.json().get("cash_flow_statements")

for stmt in cash_flow_statements:
    print(f"{stmt['report_period']}: Operating CF=${stmt['operating_cash_flow']:,}")
```

## Step 5: Get All Statements in One Call

Use the [All Financial Statements API](/api/financials/all-financial-statements) to fetch all three statement types in a single request.

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
url = (
    f"https://api.financialdatasets.ai/financials"
    f"?ticker={ticker}"
    f"&period={period}"
    f"&limit={limit}"
)

response = requests.get(url, headers=headers)
data = response.json()

income_statements = data.get("income_statements")
balance_sheets = data.get("balance_sheets")
cash_flow_statements = data.get("cash_flow_statements")
```

## Filtering by Date Range

Use `report_period` parameters to get statements within a specific date range:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
url = (
    f"https://api.financialdatasets.ai/financials/income-statements"
    f"?ticker=NVDA"
    f"&period=quarterly"
    f"&limit=100"
    f"&report_period_gte=2023-01-01"
    f"&report_period_lte=2024-12-31"
)
```

Available date filters: `report_period`, `report_period_lt`, `report_period_lte`, `report_period_gt`, `report_period_gte`.

## Available Tickers

Fetch the list of tickers with financial statement coverage:

```
GET https://api.financialdatasets.ai/financials/income-statements/tickers/
```

Coverage includes 27,000+ US tickers with 30+ years of history.

## Next Steps

* [Income Statements API Reference](/api/financials/income-statements) — full parameter documentation
* [Balance Sheets API Reference](/api/financials/balance-sheets) — all available fields
* [Financial Metrics API](/api/financial-metrics/historical) — pre-calculated ratios like P/E, ROE, and EV/EBITDA
* [SEC Filings Guide](/guides/search-sec-filings-python) — access the source documents behind the numbers
