SDKs & widgets

Official JavaScript/TypeScript and Python clients and the React widgets: install, methods, errors, cache, links to npm and GitHub.Updated October 25, 2026

Install

Three official packages: a JavaScript / TypeScript client, a Python client and React widgets that render a fund response as charts and tiles. Source for all three is on GitHub.

npm install @fundfactsapi/sdk # JavaScript / TypeScript
npm install @fundfactsapi/widgets # React widgets
pip install git+https://github.com/fundfactsapi/fundfactsapi-python # Python (installs from GitHub until the package is on PyPI)

The Python package is not on PyPI yet; pip installs it from the GitHub repository. It needs Python 3.9 or later and has no third-party dependency.

JavaScript / TypeScript

new FundFacts(options) reads the key from apiKey or FUNDFACTS_API_KEY; options also take baseUrl, timeoutMs (300 000 by default, because a cold fund can take up to 300 seconds), a custom fetch and cache (true by default). Every method returns the parsed JSON body with the same shape as the REST endpoint; types are exported for every response.

ts
import { FundFacts, FundFactsError } from "@fundfactsapi/sdk";
​
const ff = new FundFacts({ apiKey: process.env.FUNDFACTS_API_KEY });
const fund = await ff.getFund("IE00B4L5Y983");
console.log(fund.name, fund.data.headlineMetrics.ter, fund.data.profile.category);
​
const batch = await ff.getFunds(["IE00B4L5Y983", "IE00B3RBWM25"]);
const hits = await ff.search("world equity", 5);
JavaScriptPythonEndpointWhat it does
getFund(isin)get_fund(isin)GET /funds/{isin}One structured factsheet. Cached in memory until expiresAt.
getFundHistory(isin, { fields, since, changesOnly })get_fund_history(isin, fields, since, changes_only)GET /funds/{isin}/historyFund history: TER, KID costs, fund size, risk and top holdings per as-of date (Pro and up; 1 request).
getFunds(isins, { wait })get_funds(isins, wait=True)POST /fundsBatch lookup, one request per fund found.
search(query, limit)search(query, limit=10)GET /searchName, issuer, ISIN-prefix, exchange ticker or WKN search: loaded funds (coverage: covered) plus listed ETFs not loaded yet (coverage: unknown, with the lookup URL that loads them); free.
portfolio(positions, { wait })portfolio(positions, wait=True)POST /portfolioLook-through of weighted positions. Funds already in the store are used as they are, even past their 24 hours (listed in stale, refreshed in the background).
overlap(isins)overlap(isins)GET /overlapHoldings overlap between funds. Funds already in the store are used as they are, even past their 24 hours (listed in stale, refreshed in the background).
watchlist()watchlist()GET /watchlistThe funds the account follows, with each one's name and last refresh; free.
watch(isins)watch(isins)POST /watchlistAdd funds to the watchlist, within the plan's allowance (400 watchlist_full past it); free.
unwatch(isins)unwatch(isins)DELETE /watchlistRemove funds from the watchlist; free.
changes({ since, isins, event, limit })changes(since, isins, event, limit)GET /changesThe change feed: the watched funds on Starter and Pro, every fund on Scale.
factsheet(isin, { format, deliver, … })factsheet(isin, format, deliver, …)POST /factsheetsHTML or PDF one-pager, returned as a file or a share link.
factsheets({ issuer, favorites, limit })factsheets(issuer, favorites, limit)GET /factsheetsFactsheets already rendered for the account.
factsheetTemplates()factsheet_templates()GET /factsheets/templatesSaved factsheet templates (Pro and above); pass one as template.
me()me()GET /mePlan and quota.
export(filter) // async iteratorexport(...) # iteratorGET /exportEvery fund matching the filter, streamed as NDJSON.

Python

FundFacts(api_key=None, base_url=…, timeout=300.0, cache=True, retry_on_burst=True) reads the key from api_key or FUNDFACTS_API_KEY. Every method returns the parsed JSON body as a dict and raises FundFactsError on a non-2xx status. With retry_on_burst a 429 whose reason is the per-minute burst limit is retried once after Retry-After.

python
from fundfacts import FundFacts, FundFactsError
​
ff = FundFacts() # reads FUNDFACTS_API_KEY
fund = ff.get_fund("IE00B4L5Y983")
print(fund["name"], fund["data"]["headlineMetrics"]["ter"], fund["data"]["profile"]["category"])
​
try:
look = ff.portfolio([{"isin": "IE00B4L5Y983", "weight": 60}, {"isin": "IE00B3RBWM25", "weight": 40}])
except FundFactsError as e:
print(e.status, e.code, e.message, e.retry_after)

React widgets

@fundfactsapi/widgets takes the envelope returned by GET /funds/{isin} (or the demo endpoint) and renders it; React 18 or later, no CSS to import. Fetch on the server with the SDK and pass the result down: the API key never reaches the browser.

tsx
import { FundFacts } from "@fundfactsapi/sdk";
import { FundFactsheet } from "@fundfactsapi/widgets";
​
const fund = await new FundFacts({ apiKey: process.env.FUNDFACTS_API_KEY }).getFund("IE00B4L5Y983");
export default function Page() {
return <FundFactsheet fund={fund} />;
}
ComponentRenders
FundFactsheetThe whole page in one component: growth chart, key facts, the KID's costs, holdings, sectors, countries, risk, returns, metrics.
KidCostsThe KID's cost lines from data.costs as the issuer states them (entry, exit, ongoing, transaction, performance fee, cost impact after 1 year and at the recommended holding period); blank and "None" lines skipped, hasKidCosts(data) says whether anything prints.
GrowthChartIndexed growth of the monthly performance series.
DonutChartOne breakdown (sectors, countries, asset allocation) as a donut.
WeightBarsOne breakdown or the top holdings as horizontal bars.
StatTilesA row of headline figures.
KeyFactsIdentity and key facts.
RiskMetricsVolatility, Sharpe ratio, drawdown, P/E, yields, duration — whichever the fund discloses.
RiskScaleThe SRRI 1–7 scale.
ProfileChipsThe rule-based profile as chips.
CalendarReturnsCalendar-year returns.
AnnualisedReturnsAnnualised returns.
FreshnessDialHow close the payload is to its 24-hour refresh (expiresAt), plus the as-of date of the figures.
WidgetCardThe card frame every widget uses; fmtPct formats percentages.
FundFactsThemeTheme provider, with darkTheme, tokens and palette.

Errors and cache

Both clients throw or raise FundFactsError on any non-2xx status, with status, the API's code and message (see errors), retryAfter / retry_after from the Retry-After header when there is one, and the parsed body. Both keep an in-memory cache of getFund / get_fund responses until their expiresAt, so repeating a lookup within 24 hours costs no request (a payload flagged stale: true is kept for 60 seconds, the time the background refresh usually takes); pass cache: false / cache=False to disable it.

@fundfactsapi/sdknpm · GitHub
@fundfactsapi/widgetsnpm · GitHub
fundfacts (Python)GitHub — not on PyPI yet
All repositorieshttps://github.com/fundfactsapi