> ## 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.

> ## Agent Instructions
> The Financial Datasets API is served at https://api.financialdatasets.ai. Authenticate with the `X-API-KEY` header; create keys at https://financialdatasets.ai. Agents can open and fund their own account without a dashboard: see https://docs.financialdatasets.ai/agents.md.
> Tool-using agents can call Financial Datasets without writing code through the hosted MCP server at https://mcp.financialdatasets.ai/.
> The OpenAPI spec at https://financialdatasets.ai/openapi.json is the source of truth for request and response schemas.
> The index of every docs page is at https://docs.financialdatasets.ai/llms.txt. Append .md to any docs URL to get that page as Markdown.

# Stock Beta API

> The market beta of a US stock against SPY, from 5 years of monthly returns, for 15,000+ tickers, updated daily.

### Overview

The Beta API returns the market beta of a stock: how much the stock moved for each move of the market.

Each beta uses the same method:

* Benchmark: `SPY` (S\&P 500)
* Lookback: `5y` (the last 5 years)
* Interval: `month` (returns from one month end to the next)
* Price type: `adjusted_close`
* Method: `ols` (the slope of the stock's returns against the benchmark's returns)

A stock with less than 5 years of prices uses all the months it has. With fewer than 3 months in common with the benchmark, `value` is `null` and `reason` says why.

To get started, please create an account and grab your **API key** at [financialdatasets.ai](https://financialdatasets.ai).

You will use the API key to authenticate your API requests.

### Coverage

| Tickers | Years of Coverage | Updated |
| - | - | - |
| 15,000+ | Latest | Daily |

### Available Tickers

You can fetch a list of available tickers with a `GET` request to:
[https://api.financialdatasets.ai/prices/tickers/](https://api.financialdatasets.ai/prices/tickers/)

### Getting Started

There are only 3 steps for making a successful API call:

1. Add your API key to the header of the request as `X-API-KEY`.
2. Add query params like `ticker` to filter the data.
3. Execute the API request.

**Note**: You must provide the `ticker`.

### Example

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

# add your API key to the headers
headers = {
    "X-API-KEY": "your_api_key_here"
}

# set your query params
ticker = 'AAPL'

# create the URL
url = (
    f'https://api.financialdatasets.ai/prices/beta'
    f'?ticker={ticker}'
)

# make API request
response = requests.get(url, headers=headers)

# parse beta from the response
beta = response.json().get('beta')
```

### Example Response

```json theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "beta": {
    "value": 1.18,
    "ticker": "AAPL",
    "benchmark": "SPY",
    "requested_lookback": "5y",
    "interval": "month",
    "start_date": "2021-02-26",
    "end_date": "2026-01-30",
    "n_observations": 59,
    "r_squared": 0.62,
    "method": "ols",
    "price_type": "adjusted_close"
  }
}
```

### Response Fields

* `value`: the beta, or `null` when there are too few months of prices.
* `start_date` and `end_date`: the first and the last month end used.
* `n_observations`: the number of months used.
* `r_squared`: how closely the stock follows the benchmark, from 0 to 1.
* `reason`: only when `value` is `null`. One of `insufficient_observations`, `no_overlapping_observations` or `zero_benchmark_variance`.


## OpenAPI

````yaml GET /prices/beta
openapi: 3.0.1
info:
  title: Financial Datasets API
  description: >-
    Stock market API with real-time and historical financial data for 27,000+
    tickers over 30+ years. Financial statements, equity prices, insider trades,
    SEC filings, and more.
  version: 1.0.0
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  contact:
    name: API Support
    url: mailto:support@financialdatasets.ai
    email: support@financialdatasets.ai
  termsOfService: https://financialdatasets.ai/terms-of-use
servers:
  - url: https://api.financialdatasets.ai/
    description: Production server
security:
  - X-API-KEY: []
tags:
  - name: Financial Statements
    description: Access to income statements, balance sheets, and cash flow statements
  - name: Market Data
    description: Real-time and historical price data
  - name: Tokenized Stocks
    description: The price of a stock token on Base
  - name: Company Information
    description: Company facts like ticker, name, and description
  - name: Earnings
    description: Earnings data and related information
  - name: News
    description: Real-time and historical news articles
  - name: SEC Filings
    description: SEC filings and regulatory documents
  - name: Insider Sale Notices
    description: SEC Form 144 notices of proposed insider stock sales
  - name: Insider Trades
    description: Insider trading activity and transactions
  - name: Politician Trades
    description: Stock trades disclosed by members of Congress
  - name: Activist Ownership
    description: Activist stakes from SEC Schedule 13D filings, in real time
  - name: Beneficial Ownership
    description: >-
      Holders of more than 5% of a company's shares, from SEC Schedules 13D and
      13G
  - name: Insider Ownership
    description: Insider ownership statements from SEC Forms 3 and 5
  - name: Institutional Holdings
    description: SEC-direct 13F equity holdings of institutional investment managers
  - name: IPOs
    description: >-
      Upcoming IPOs from SEC registration statements (Form S-1), with extracted
      pre-IPO financial statements
  - name: Index Funds
    description: >-
      ETF and index-fund holdings, weights, and the funds that hold a given
      security
  - name: Financial Metrics
    description: Financial ratios, metrics, and key performance indicators
  - name: Macroeconomics
    description: Real-time and historical macroeconomic data like interest rates
  - name: KPIs
    description: Sector-specific operational KPIs extracted from earnings releases.
  - name: Agent Account
    description: Self-serve account creation and funding for AI agents.
  - name: Search
    description: Search financial documents with one question and get cited passages back
paths:
  /prices/beta:
    get:
      tags:
        - Market Data
      summary: Get market beta snapshot
      description: >-
        Get a single beta snapshot for a ticker using SPY benchmark, 5-year
        lookback, monthly interval, and adjusted close returns.
      operationId: getPriceBeta
      parameters:
        - name: ticker
          in: query
          description: The ticker symbol.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Beta snapshot response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaResponse'
        '400':
          $ref: '#/components/responses/BadRequestError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '402':
          $ref: '#/components/responses/PaymentRequiredError'
        '404':
          $ref: '#/components/responses/NotFoundError'
components:
  schemas:
    BetaResponse:
      type: object
      properties:
        beta:
          $ref: '#/components/schemas/Beta'
    Beta:
      type: object
      properties:
        value:
          type: number
          nullable: true
          description: >-
            Beta coefficient of stock monthly returns vs benchmark monthly
            returns.
        ticker:
          type: string
          description: The requested ticker symbol.
        benchmark:
          type: string
          description: Benchmark ticker used for beta calculation.
        requested_lookback:
          type: string
          description: Requested lookback window.
        interval:
          type: string
          description: Interval used for returns alignment.
        start_date:
          type: string
          format: date
          nullable: true
          description: First aligned month-end date used.
        end_date:
          type: string
          format: date
          nullable: true
          description: Last aligned month-end date used.
        n_observations:
          type: integer
          description: Number of overlapping monthly observations used.
        r_squared:
          type: number
          nullable: true
          description: Coefficient of determination for the OLS fit.
        method:
          type: string
          description: Computation method used.
        price_type:
          type: string
          description: Price type used to compute returns.
        reason:
          type: string
          nullable: true
          description: >-
            Present when value is null due to insufficient or invalid input
            data.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: A short error message.
        message:
          type: string
          description: A more detailed error message.
  responses:
    BadRequestError:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Bad Request
            message: Invalid request parameters
    UnauthorizedError:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Unauthorized
            message: Invalid API key provided
    PaymentRequiredError:
      description: The request requires a paid subscription
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Payment Required
            message: >-
              This endpoint requires a paid subscription. Please upgrade your
              plan.
    NotFoundError:
      description: The specified resource was not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Not Found
            message: Ticker XXXX not found
  securitySchemes:
    X-API-KEY:
      type: apiKey
      name: X-API-KEY
      description: API key for authentication.
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.