How to get mutual fund and ETF holdings via API
If you've ever tried to get a fund's complete list of holdings programmatically, you know the data exists — it's in SEC filings — but getting it into a clean, queryable shape is the hard part. This guide shows how to pull full mutual fund and ETF holdings from the FundLens API in a few requests.
What "holdings" actually means
A fund's holdings are every security it owns at a point in time: the ticker or identifier, the number of shares or par value, the market value in dollars, and the percentage weight of the portfolio. US funds disclose this to the SEC on a regular cadence, and FundLens normalizes those filings into a single consistent schema.
Every request is authenticated with an API key passed in the x-api-key header. The base URL is https://api.fundlens.io/v1.
Step 1: Find the fund
If you already know the ticker, you can skip ahead. Otherwise, list or search funds:
curl "https://api.fundlens.io/v1/funds?limit=20" \
-H "x-api-key: YOUR_API_KEY"
Step 2: Pull the latest holdings
Request the holdings for a ticker. By default you get the most recent filing:
curl "https://api.fundlens.io/v1/funds/VTI/holdings?limit=10" \
-H "x-api-key: YOUR_API_KEY"
Each row includes the security name, identifier, share count, market value in dollars, and weight. To pull a specific historical snapshot, pass an as_of date:
curl "https://api.fundlens.io/v1/funds/VTI/holdings?as_of=2024-09-30" \
-H "x-api-key: YOUR_API_KEY"
Step 3: Do it in Python
import requests
API_KEY = "YOUR_API_KEY"
BASE = "https://api.fundlens.io/v1"
resp = requests.get(
f"{BASE}/funds/VTI/holdings",
headers={"x-api-key": API_KEY},
params={"limit": 50},
)
resp.raise_for_status()
for h in resp.json()["data"]:
print(f'{h["weight"]:>6.2%} {h["name"]}')
That's the whole flow: find the fund, request its holdings, and you have a structured portfolio you can load into a dataframe, a database, or a screener.
Where to go next
- To see every available filing date for a fund before you pull them, use the holdings history endpoint.
- To get sector and country breakdowns without computing them yourself, see ETF sector and country exposure from holdings.
- Full parameters and response fields are in the API documentation.