Accepting data
There are several ways to get data from Flatfile into your systems. The two automated methods are client-side processing using the SDK, and server-side processing using Webhooks. You can also query the Flatfile API for data, and you can manually download from the dashboard.
Highlights:
- Accept data client-side
- Accept data server-side via webhook
- Get data from the API
- Get data from the Flatfile dashboard
Accept data client-side
Flatfile sends validated data to your front-end importer in chunks for you to handle client-side. Data sent will have passed all validation rules and not include data dismissed during submission.
You can also handle any errors that occur during import and pass them to your UI.
Read more about processing data client-side in this guide.
Client-side processing is ideal for smaller datasets where you want to perform synchronous actions from the browser. For larger datasets, or to perform asynchronous, server-side processing, we recommend you use a server-side webhook.
const importData = Flatfile.requestDataFromUser({
token, // a jwt token for production
onData: async (chunk, next) => {
await doSomeApiWork(chunk.records);
// process next chunk
next();
},
onComplete() {},
onError(error) {
// perform custom error handling in your UI
},
});
document.querySelector("#import").addEventListener("click", importData);
Accept data server-side via webhook
You can automate the process of extracting data from Flatfile and sending it to your servers using REST Webhooks. REST Webhooks allow you to listen to events in Flatfile and get notified in real time when data is imported and validated by your customers.
To use webhooks, you'll need to provide your own API endpoint to be notified whenever a user completes an import. The notification will contain the information needed to fetch the imported data from the Flatfile API.
Read more about how to use webhooks in this guide.
Get data from the API
You can query the Flatfile API directly to retrieve imported data.
See the API reference for a full list of endpoints you can use.
Get data from the Flatfile dashboard
The simplest way to get your data out of Flatfile is to download it from your Imports dashboard.
You can find all files uploaded via Portal in the Imports tab in the navigation bar on the far left of your dashboard.
After your data has been uploaded to a Workspace, you can open the Workspace it has been uploaded to, open the Files window, click on the file you want to download, and download your data.