Skip to main content
Version: v3

Environment variables

This guide expands on leveraging environment variables within Data Hooks®.

Within Flatfile, in addition to providing the required values in embedId, user and org, you may also include custom data in the env section. Data you include in env is available for use in your Data Hooks, and stored along with the uploaded file for later reference or retrieval.

function importData() {
embedId: "EMBED_ID",
user: {
id: 99,
name: "John Doe",
email: "",
org: {
id: 77,
name: "Acme Inc.",
env: {
/* any valid json */

From a Data Hook, you can access the data you included in the env section by referencing session.env

For example, if you include a value for a variable named "mytoken":

env: {
mytoken: "anystring";

In your Data Hook® you will be able to reference the value like this:

const mytoken = session.env.mytoken;