API Reference

The FMP Node Wrapper provides a comprehensive set of methods to interact with the Financial Modeling Prep API. All methods return a consistent response format and include full TypeScript support.

Client Setup

First, initialize the client with your API key:

1import { FMP } from 'fmp-node-api';
2
3// Option 1: Use environment variable (recommended)
4const fmp = new FMP(); // Automatically uses FMP_API_KEY from environment
5
6// Option 2: Provide API key directly
7const fmp = new FMP({
8apiKey: 'your-api-key-here',
9});
10
11// Option 3: Mixed configuration
12const fmp = new FMP({
13timeout: 15000, // custom timeout, apiKey from FMP_API_KEY env var
14});

Available Endpoints

The library is organized into different endpoint categories:

MethodEndpointDescription
GET/quote/*Unified quote endpoints for all asset types (stocks, crypto, forex, commodities, ETFs)
GET/stock/*Stock-related endpoints for market information, splits, and dividends
GET/company/*Company information endpoints for profiles, executive compensation, and employee data
GET/financial/*Financial statement endpoints for income statements, balance sheets, and cash flows
GET/economic/*Economic endpoints for indicators, treasury rates, and economic data
GET/etf/*ETF endpoints for profiles, holdings, and ETF-specific data
GET/market/*Market endpoints for performance, hours, and sector data
GET/mutual-fund/*Mutual Fund endpoints for mutual fund holders of stocks
GET/senate-house-trading/*Congressional trading data for senate and house members
GET/institutional/*Form 13F filings and institutional ownership data
GET/insider/*Insider trading data and transactions
GET/sec/*SEC filings, RSS feeds, and industry classification data

Response Format

All API methods return a consistent response format:

1interface ApiResponse<T> {
2  success: boolean;
3  data: T | null;
4  error: string | null;
5  status: number;
6}

Error Handling

Always check the success property before accessing data:

1const response = await fmp.quote.getQuote({ symbol: 'AAPL' });
2
3if (response.success && response.data) {
4// Handle successful response
5console.log(response.data);
6} else {
7// Handle error
8console.error('Error:', response.error);
9console.error('Status:', response.status);
10}

Endpoint Categories

Quote Endpoints

Access unified quotes and historical data for all asset types:

  • Unified Quotes - Real-time quotes for stocks, crypto, forex, commodities, and ETFs
  • Multiple Quotes - Get quotes for multiple symbols in one request
  • Historical Data - Historical price data with flexible date ranges
  • Intraday Data - Intraday data with various time intervals

View Quote Endpoints →

Stock Endpoints

Access stock-specific market information:

  • Market Capitalization - Market cap data and metrics
  • Stock Splits - Historical stock splits information
  • Dividend History - Dividend payment history
  • Stock-specific Data - Stock-specific market information

View Stock Endpoints →

Company Endpoints

Access comprehensive company information:

  • Company Profiles - Detailed company information and metrics
  • Executive Compensation - Executive salary and compensation data
  • Employee Data - Historical employee count information
  • Shares Float - Current and historical shares float data
  • Earnings Transcripts - Earnings call transcripts

View Company Endpoints →

Financial Endpoints

Access financial statements and ratios:

  • Income Statements - Revenue, expenses, and profit metrics
  • Balance Sheets - Assets, liabilities, and equity
  • Cash Flow Statements - Operating, investing, and financing cash flows
  • Financial Ratios - Key financial ratios and metrics

View Financial Endpoints →

Economic Endpoints

Access economic indicators and treasury data:

  • Economic Indicators - GDP, CPI, unemployment, and other key economic metrics
  • Treasury Rates - Current treasury rates for different maturities
  • Federal Funds Rate - Federal Reserve interest rates
  • Economic Analysis - Yield curve analysis and economic trends

View Economic Endpoints →

ETF Endpoints

Access ETF-specific data:

  • ETF Profiles - ETF information and details
  • ETF Holdings - Holdings and composition data
  • ETF-specific Data - ETF-specific market information

View ETF Endpoints →

Market Endpoints

Access market-wide data:

  • Market Performance - Overall market performance
  • Market Hours - Trading hours and status
  • Sector Performance - Sector-specific performance
  • Gainers/Losers - Top gainers and losers

View Market Endpoints →

Mutual Fund Endpoints

Access mutual fund holdings data:

  • Mutual Fund Holders - Mutual funds that hold a specific stock
  • Holdings Analysis - Analyze which mutual funds are invested in particular stocks
  • Position Data - Share counts, weight percentages, and position changes

View Mutual Fund Endpoints →

Senate & House Trading Endpoints

Access congressional trading data:

  • Trading Data - Stock transactions by members of Congress
  • Politician Profiles - Individual politician trading history
  • Company Summaries - Company-specific political trading activity
  • Trading Analytics - Most active traders and most traded stocks

View Senate & House Trading Endpoints →

Institutional Endpoints

Access Form 13F filings and institutional ownership data:

  • Form 13F Data - Quarterly institutional stock ownership reports
  • Filing Dates - Available Form 13F filing dates for institutions
  • Institutional Holders - Institutional investors holding specific stocks
  • Ownership Analysis - Track institutional sentiment and positions

View Institutional Endpoints →

Insider Endpoints

Access insider trading data and transactions:

  • Insider Transactions - Stock transactions by company insiders
  • Insider Holdings - Current insider ownership positions
  • Transaction History - Historical insider trading activity
  • Insider Analysis - Track insider sentiment and trading patterns

View Insider Endpoints →

SEC Endpoints

Access Securities and Exchange Commission filings and industry classification data:

  • RSS Feeds - Real-time feeds of SEC filings from publicly traded companies
  • SEC Filings - Direct links to specific SEC filings for companies
  • Industry Classification - SIC-based industry classification data
  • 8-K Filings - Significant event filings and notifications

View SEC Endpoints →

TypeScript Support

The library includes comprehensive TypeScript definitions for all endpoints:

1// Full type safety for parameters
2const quote = await fmp.quote.getQuote({ 
3  symbol: 'AAPL' // TypeScript will ensure this is a string
4});
5
6// Full type safety for responses
7if (quote.success && quote.data) {
8const price = quote.data.price; // TypeScript knows this is a number
9const symbol = quote.data.symbol; // TypeScript knows this is a string
10}

Configuration Options

The client accepts several configuration options:

OptionTypeDefaultDescription
apiKeystringRequiredYour FMP API key
timeoutnumber10000Request timeout in milliseconds

Rate Limiting

The library respects FMP's rate limits and will automatically handle rate limiting responses. For production applications, consider implementing your own rate limiting strategy.

Examples

Check out our Examples section for practical code samples and common use cases.


Ready to get started? Check out the Getting Started Guide or explore specific endpoint categories above.