Welcome to the Flatfile SDK documentation. Implementing and using Flatfile has never been easier, but we hope that this documentation can still serve as a valuable resource for you whether you're getting things up and running for the first time or just need a refresher on how things work.
flatfileImporter(**token**
)
(GitHub)
Name | Type |
---|---|
token | string |
The token
parameter is a JSON Web Token (JWT) generated for a given end user. The JWT should be generated on the application server to prevent dissemination of your private key. The JWT is signed using the the Embed ID of the Flatfile Embed (created on the dashboard), the Private Key (also provided on the dashboard, but only available once during the creation of the Embed), and an identifier for the end user (an email or other ID).
Note: The below snippet is for testing purposes only. This is not safe to use in your production application, but can be useful when testing out for the first time.
The sub
field is unique to each end user. This unique identification allows Flatfile to continue an import after an interruption and reduce upload abandonment. For more information on this unique identifier, see our Getting Started guide.
Launches the Flatfile Importer inside of an iFrame by calling openInIframe
(GitHub).
Destroys the flatfileImporter.
The following events will be emitted to the client.
Returns a batchId
unique to the end user the token was generated for. This allows uploads to be continued after an interruption (such as a user closing a browser tab) and can be used to request data from the Flatfile API.
Returns the same batchId
generated during initialization (see above) that is unique to the end user the token was generated for. This allows uploads to be continued after an interruption (such as a user closing a browser tab) and can be used to request data from the Flatfile API.
Returns a JavaScript error object.
Returns a payload with a copy of the validated data from the upload.