Skip to main content
Flatfile maintains an NPM Package (@flatfile/api) for use in record-hooks, jobs, and more.

Overview

The Flatfile API can be imported into your scripts and used to make any REST calls related to Flatfile Resources. The package can be found at npmjs.com, and the specific calls available can be found at API Reference.

Usage

First, install the package in your project, and import it at the top of your script
Also, make sure your secret key is included in your environment variables as FLATFILE_API_KEY. If you aren’t using environment variables via .env, you can instantiate a new FlatfileClient by passing in your secret key as the token.
Make sure to keep your secret key safe, as it can be used to access potentially sensitive information.
Now if you want to make a call, use the api object to create your call. The api calls are async, so ensure that your code is compatible. For example, if you wanted to get a specific sheet, you can do as follows:
A more complete example would look something like this workbook submission: