---
title: "Api Segments"
method: GET
path: "/api/segments"
---

# Api Segments

`GET /api/segments`

## Request

- Base URL: `https://www.oxfordledge.com` (the document declares no server; this is the origin it was published from)
- URL: `https://www.oxfordledge.com/api/segments`
- Auth: none declared

Revenue breakdown by operating segment, geography, and product line.

Data source priority:
1. PostgreSQL ``segment_revenue`` table (cached)
2. On-disk ``*_xbrl.json`` file (extracted on demand, then cached to PG)

Response shape::

    {
      "ticker": "AAPL",
      "operating": [{"name": "iPhone", "years": [{"year": 2023, "revenue": 200583000000}, ...]}, ...],
      "geographic": [...],
      "product": [...],
      "source": "pg_cache" | "pg_cache_refreshing" | "xbrl_live",
      # pg_cache_refreshing: these rows came from an OLDER extractor and a
      # background re-extraction was just started (v229). The rows are real;
      # a later request carries the improved ones.
      "has_data": true
    }

Each segment has a ``years`` array sorted newest-first so chart rendering is
straightforward.

## Query parameters

- `ticker` string, required: Ticker symbol

## Response `200`

Successful Response

- StockAnalysisResponse: Loose response_model for /api/fundamentals, /api/segments, /api/exec-comp, /api/sensitivity, /api/proxy, /api/chart-data, and similar analysis routes in routes_analysis_fastapi/stock.py. Multi-shape responses with deeply nested company/financial/chart data; loose contract since the FE consumers are typed via the typed-client wrappers, not directly off these schemas.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api.md) · [All operations](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api/llms.txt) · [OpenAPI document](https://skmtc.dev/oxfordledge/apis/oxford-ledge-api/revisions/e832a1260f0b?raw)
