Get ETF / index-fund holdings
curl --request GET \
--url https://api.financialdatasets.ai/index-funds \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/index-funds"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/index-funds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/index-funds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/index-funds"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/index-funds")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/index-funds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"ticker": "<string>",
"fund": {
"name": "<string>",
"cik": "<string>",
"asset_class": "<string>",
"as_of": "2023-12-25",
"filing_date": "2023-12-25",
"source": "<string>",
"total_net_assets": 123,
"total_holdings": 123,
"returned": 123,
"offset": 123
},
"holdings": [
{
"ticker": "<string>",
"name": "<string>",
"weight": 123,
"market_value": 123,
"shares": 123,
"asset_class": "<string>"
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Index Funds
ETF Holdings API
The holdings of an ETF or index fund and each position’s weight, from SEC fund holdings filings: 500+ funds, 5+ years of history, updated daily.
GET
/
index-funds
Get ETF / index-fund holdings
curl --request GET \
--url https://api.financialdatasets.ai/index-funds \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/index-funds"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/index-funds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/index-funds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/index-funds"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/index-funds")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/index-funds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"ticker": "<string>",
"fund": {
"name": "<string>",
"cik": "<string>",
"asset_class": "<string>",
"as_of": "2023-12-25",
"filing_date": "2023-12-25",
"source": "<string>",
"total_net_assets": 123,
"total_holdings": 123,
"returned": 123,
"offset": 123
},
"holdings": [
{
"ticker": "<string>",
"name": "<string>",
"weight": 123,
"market_value": 123,
"shares": 123,
"asset_class": "<string>"
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Overview
The Financial Datasets ETF holdings API returns the full list of holdings of an ETF or index fund and each position’s percent of net assets, largest first, with a fund header that carries the as-of period and coverage counts. It covers 500+ funds with 5+ years of history, updated daily, from SEC fund holdings filings. To see which funds hold a given stock, use Funds (by holding). You can call it as a REST endpoint with an API key, or from Claude, ChatGPT, Cursor, and other AI apps through the MCP server, or pay per request with x402. Pricing starts at $20. Use this to answer “what’s in SPY, and at what weight?” for index replication, exposure analysis, and overlap checks. To get started, please create an account and grab your API key at financialdatasets.ai. You will use the API key to authenticate your API requests.Coverage
| Funds | Years of Coverage | Updated |
|---|---|---|
| 500+ | 5+ years | Daily |
The “latest” definition
Without anas_of filter, this endpoint returns the fund’s most recent filing. To reconstruct a historical composition, pass as_of=YYYY-MM-DD and the response is the composition in effect on or before that date.
All holdings, labeled
Every position is returned, including bonds, derivatives, and cash, each labeled with anasset_class (equity, bond, or other). name is included when available; ticker is null for securities without a US listing (e.g., many bonds and foreign holdings). To narrow the list, pass asset_class=equity or asset_class=bond.
Find available tickers
To discover which funds are available, hit the helper endpoint:Tickers
import requests
# free endpoint, no API key required
url = 'https://api.financialdatasets.ai/index-funds/tickers/'
response = requests.get(url)
tickers = response.json().get('tickers')
print(f'{len(tickers)} funds available')
Filtering the Data
ticker is required. Optional filters:
as_of— the composition in effect on/before this date (YYYY-MM-DD). Defaults to the latest filing.asset_class—equityorbond. Defaults to all holdings.
limit is 50 (max 1000). Use offset to page through a fund’s constituents.
Examples
import requests
# add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here"
}
# set your query params
ticker = 'SPY' # fund ticker
limit = 50 # number of holdings to return
# create the URL
url = (
f'https://api.financialdatasets.ai/index-funds/'
f'?ticker={ticker}'
f'&limit={limit}'
)
# make API request
response = requests.get(url, headers=headers)
# parse holdings from the response
holdings = response.json().get('holdings')
import requests
# add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here"
}
# set your query params
ticker = 'SPY'
as_of = '2023-12-31' # composition in effect on/before this date
asset_class = 'equity' # equities only
# create the URL
url = (
f'https://api.financialdatasets.ai/index-funds/'
f'?ticker={ticker}'
f'&as_of={as_of}'
f'&asset_class={asset_class}'
)
# make API request
response = requests.get(url, headers=headers)
# parse holdings from the response
holdings = response.json().get('holdings')
FAQ
Which funds are covered?
500+ ETFs and index funds. Get the list with a free request to/index-funds/tickers/. It needs no API key.
Can I see what a fund held on a past date?
Yes. Passas_of=YYYY-MM-DD to get the composition in effect on or before that date. Without as_of, you get the fund’s most recent filing.
Does it include bonds and cash?
Yes. Every position is returned, including bonds, derivatives, and cash, each labeled with anasset_class of equity, bond, or other. Pass asset_class=equity to get equities only. ticker is null for securities without a US listing.
Can an AI agent use this data?
Yes. Claude, ChatGPT, Cursor, and other MCP clients reach it through the Financial Datasets MCP server. An agent with a wallet can also pay per request with x402, with no account.Query Parameters
Response
Index fund holdings response. The shape depends on the query direction: ticker returns a fund header + constituents; holding returns a security header + funds.
- Option 1
- Option 2
Forward response (?ticker=...): a fund header plus its constituents, sorted by weight descending.