← Back to Home

FMP Node API Documentation

Getting Started

Welcome to the FMP Node Wrapper! This guide will help you get up and running quickly.

Installation

Install the package using pnpm (recommended):

Or using npm:

Or using yarn:

API Key Setup

To use the FMP Node Wrapper, you'll need an API key from Financial Modeling Prep:

  1. Visit Financial Modeling Prep (opens in new tab)
  2. Sign up for an account
  3. Navigate to your dashboard to get your API key

Basic Setup

Here's how to initialize the client:

Configuration Options

The FMP client accepts the following configuration options:

OptionTypeDefaultDescription
apiKeystringFMP_API_KEY env varYour FMP API key (optional if env var is set)
timeoutnumber10000Request timeout in milliseconds

Your First API Call

Let's make your first API call to get a stock quote:

Response Format

All API methods return a consistent response format:

  • success: Boolean indicating if the request was successful
  • data: The response data (null if unsuccessful)
  • error: Error message string (null if successful)
  • status: HTTP status code

Error Handling

Always check the success property before accessing the data:

Environment Variables

For security, store your API key in environment variables. The FMP client automatically detects the FMP_API_KEY environment variable:

Create a .env file in your project root:

Or set it in your system environment:

⚠️ Security Note: Never commit your .env file to version control. It should already be in your .gitignore.

💡 Pro Tip

All code blocks in this documentation include a copy button that appears when you hover over them. Click the copy icon to quickly copy the code to your clipboard!

Next Steps

Now that you have the basics set up, explore:

Common Issues

API Key Issues

  • Make sure your API key is valid and active
  • Check your FMP account for any usage limits
  • Verify the API key is correctly passed to the client

Network Issues

  • Check your internet connection
  • Verify the base URL is accessible
  • Consider increasing the timeout for slower connections

TypeScript Issues

  • Ensure you're using TypeScript 4.5+ for best type support
  • All types are included in the main package

Ready to explore the API? Check out the API Reference for detailed endpoint documentation.