Embedding Flatfile

Flatfile Embeds moves the hard work of importing data to the server, providing more consistent performance and reliability for all users no matter the hardware they're working with.

This guide aims to provide basic instructions to get you up and running with Flatfile's new Embeds.

Make sure you are signed in to the Flatfile dashboard.

Create a Data Template

If you haven't already, you need to create a data template. Before you can upload data, you need to tell Flatfile what that data is supposed to look like, and data templates are how. You can create new data templates in two ways: manually or automatically from a .csv.

Create an Embed

Creating a Flatfile Embed is simple.

  1. Click on Flows in the navigation bar on the left, then click the Embed tab, and click the Create Embed button.

  2. Name the Embed.

  3. Select a data template.

  4. Click Create.

Clicking Create will take you to the Edit Embed page. Here, you can rename the Embed, see the Embed ID and Private Key (which only appears once! You should save it now.), and see some example code snippets for the languages we support.

Generate a Secure Token

Flatfile uses JSON Web Tokens (JWTs) to authenticate uploads and allow users to resume where they've left off in case of an interruption. The Node.js example we provide shows one way to generate JWTs on your server (you will need the ejsexpress, and jsonwebtoken dependencies), but if you would like more information about how it works and how it can be customized, check out our SDK documentation.

Embed the Embed

The front end is where the hard work of creating a JWT pays off. Previous iterations of Flatfile required front-end adapters for the various frameworks we supported, but now all you need is the Flatfile SDK. There's no complicated configuration, adapters, or head-scratching front-end code to write. All the hard work is done on the server, so all you need to do is:

  1. Load the SDK

  2. Create an import button

  3. Pass your importer the secure token you generated

And that's it! The code snippet in the Edit Embed page shows a basic outline of how it works, but since all you need from us is the SDK, you can code your front end in just about any framework you like.