Home / APIs / Parsing
Fundamentals

Financial Ratios API: 27 ratios with the formula and filing behind each

Margins, returns, liquidity, leverage, turnover, cash flow and growth, computed from XBRL filings, each with its formula, inputs and source accession.

curl -H "Authorization: Bearer $SECFEED_KEY" \
  "https://secfeedapi.com/v1/financial-ratios?ticker=AAPL&limit=1"
import os, requests

r = requests.get(
    "https://secfeedapi.com/v1/financial-ratios",
    params={'ticker': 'AAPL', 'limit': '1'},
    headers={"Authorization": f"Bearer {os.environ['SECFEED_KEY']}"},
)
print(r.json())
{
  "cik": 320193,
  "period": "annual",
  "periods": [
    {
      "end": "2026-09-26",
      "ratios": {
        "grossMargin": {
          "value": 0.487856,
          "formula": "grossProfit / revenue",
          "inputs": {
            "grossProfit": {
              "value": 233602000000,
              "accn": "0000320193-26-000026",
              "tag": "GrossProfit"
            },
            "revenue": {
              "value": 478834000000,
              "accn": "0000320193-26-000026",
              "tag": "RevenueFromContractWithCustomerExcludingAssessedTax"
            }
          }
        },
        "operatingMargin": {
          "value": 0.3301,
          "formula": "operatingIncome / revenue",
          "inputs": {
            "operatingIncome": {
              "value": 158063000000,
              "accn": "0000320193-26-000026",
              "tag": "OperatingIncomeLoss"
            },
            "revenue": {
              "value": 478834000000,
              "accn": "0000320193-26-000026",
              "tag": "RevenueFromContractWithCustomerExcludingAssessedTax"
            }
          }
        },
        "netMargin": {
          "value": 0.276035,
          "formula": "netIncome / revenue",
          "inputs": {
            "netIncome": {
              "value": 132175000000,
              "accn": "0000320193-26-000026",
              "tag": "NetIncomeLoss"
            },
            "revenue": {
              "value": 478834000000,
              "accn": "0000320193-26-000026",
              "tag": "RevenueFromContractWithCustomerExcludingAssessedTax"
            }
          }
        },
        "returnOnAssets": {
          "value": 0.346103,
          "formula": "netIncome / average total assets",
          "inputs": {
            "netIncome": {
              "value": 132175000000,
              "accn": "0000320193-26-000026",
              "tag": "NetIncomeLoss"
            },
            "assets": {
              "value": 404548000000,
              "accn": "0000320193-26-000026",
              "tag": "Assets"
            }
          }
  ...

Overview

Most ratio APIs hand you a number and nothing else. Here every ratio shows the formula, the inputs, the XBRL tag each input came from and the accession of the filing, so you can check it against the 10-K.

Annual, quarterly and trailing twelve month periods are built from the period dates, so a June fiscal year is reported as June. When a company does not report an input, the ratio is null with a reason, for example no gross margin for a bank. There are no price-based ratios such as P/E, because SecFeed has no prices.

What you get

Built for developers who would rather not parse EDGAR.

Formula and inputs

Each ratio lists the formula and every input with its tag and accession.

Annual, quarterly, TTM

Fourth quarters are derived from the annual report when only cumulative values exist.

Nulls with reasons

Banks, insurers and thin filers get null and the reason, never a made-up number.

Line items too

key-metrics returns the standardised line items behind the ratios.

Endpoints

Authenticate with Authorization: Bearer YOUR_KEY. Responses are JSON.

GET/v1/financial-ratiosReference →

About 30 financial ratios per period computed from the company's XBRL filings: margins, ROA, ROE, liquidity, leverage, turnover, free cash flow and growth. Each ratio carries its formula, inputs, XBRL tags and source accession; a ratio with a missing input is null with a reason. No price-based ratios.

Parameters: ticker | cik, period (annual, quarterly, ttm), limit (max 20)

GET/v1/key-metricsReference →

Standardised line items per period from XBRL (revenue, net income, assets, debt, operating cash flow, capex, shares and more) with tag and source accession.

Parameters: ticker | cik, period (annual, quarterly, ttm), limit (max 20)

Response fields

The main fields in every result. The raw filing data is always one level down.

FieldMeaning
periods[].ratios.<name>.valueThe ratio, or null.
periods[].ratios.<name>.formulaHow it was computed.
periods[].ratios.<name>.inputsInputs with value, tag and accession.
periods[].items.<item>key-metrics: each line item with tag, accession and filed date.

Use cases

Guides

FAQ

Why is there no P/E ratio?

SecFeed has no market prices, so it only serves ratios that come from the filings.

Where does the data come from?

XBRL facts in 10-K, 10-Q, 20-F and 40-F filings on SEC EDGAR. Source: U.S. Securities and Exchange Commission.

Why is a ratio null?

The company did not report one of its inputs. The reason field says which.

Try the Financial Ratios API free

Free key, no card, no sales call.

Get free API key →