--- title: "Setting up environments and versions" slug: "environments-and-versions" description: "Manage content versions and test in isolated environments with Userflow's powerful version control and easy publishing features. Optimize your flows risk-free!" tags: ["Version Control", "Environment Management"] updated: 2026-10-28T19:40:34Z published: 2026-10-28T19:40:34Z canonical: "help.userflow.com/environments-and-versions" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.userflow.com/llms.txt > Use this file to discover all available pages before exploring further. # Setting up environments and versions Environments let you run separate copies of Userflow content, such as Staging and Production, each with its own Userflow.js token. Content published to one environment never reaches users of another, so you can test changes in Staging before publishing them to Production. Version history keeps a record of every change so you can compare and roll back. Each environment can store its end-user data in North America or the EU. See [FAQ: Storing user data within the EU](/docs/choosing-the-eu-or-us-for-customer-data-storage). ## Adding a new environment and user data location **To set up a new environment:** 1. Select **Settings > Environments** from the sidebar. 2. Click **New environment** and give it a name, such as “Staging.” ![New environment dialog with a name field](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/image(283).png) 3. Select where you want user data to be stored - North America or Europe (EU) and click **Create environment**. ![User data location options: North America or Europe (EU)](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/image(282).png) > [!NOTE] > Data location > > The data location selected here only applies to end-user data. By default, all data, including user data is stored in North America. If your company requires that user data be stored within the EU, select **Europe (EU)** when setting up each environment. For more information, refer to the [FAQ for storing user data](/docs/choosing-the-eu-or-us-for-customer-data-storage). A new Userflow.js token will be generated for each environment. Use this token in your Userflow.js snippet in your environment. [Read more in the Userflow.js installation guide](/docs/userflowjs-installation). ![Userflow.js token for the new environment](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/image(285).png) ## Where do I find my Userflow ID, environment ID or Userflow.js Token? **Settings → Environments** lists each Userflow environment by name, with its Userflow.js Token next to it. The token starts with `ct_`. It's the value you put in your Userflow.js snippet, and it's what to give support when they need to know which environment you mean. Userflow doesn't have a single value called a "Userflow ID". If someone asks for yours, they usually mean the Userflow.js Token. If they mean one of your users, the user ID is the ID your app sends to `userflow.identify()`. See [Userflow.js Installation](/docs/userflowjs-installation#step-3-replace-placeholders). Each Userflow environment also has an environment ID, which is a different value from the Userflow.js Token. Settings → Environments doesn't show the environment ID, and you don't need it for building or publishing content. You don't need the environment ID to use the [Userflow MCP](/docs/mcp) either. Your AI tool can look up the environments you have access to by itself. Tell it which environment to use by name, for example Production or Staging. ## Where do I find my API keys? Userflow API keys are in **Settings → API**. Each Userflow environment, such as Production and Staging, has its own API keys, and a key only works for its environment. The Userflow API also has personal API keys, used for the Accounts API (managing team members and invites). Those are in **My Account → Personal API Keys** and are tied to your own Userflow login. Keep API keys secret. Don't put them in front-end code or a code repository. For what each key can do, see [Userflow API Reference](/docs/userflow-api-reference). ## Who can see a non-production environment? **Your end users** only see content published to the environment whose Userflow.js token is installed in the app they're using. A flow published to Staging and not Production will never reach a production user. That separation is enforced by the token. **Your team** sees environments through their Userflow account, and environments aren't hidden from teammates — anyone who can open your Userflow account can switch between them. A staging environment is a safe place to build, but it isn't a private one. **What you can scope is publishing.** The **Editor** role can create and edit all content, and Owners and Admins choose which environments each Editor may publish to. A common setup is to let Editors publish to Staging while reserving Production for Admins and Owners, which gives you a review step before anything reaches live users. To let someone work in a sandbox, invite them to your Userflow team and set their role — see [Managing Teams in Userflow](/docs/team-management). The yellow top border tells everyone which environment they're in. ## How do I see, compare or restore earlier versions? Every flow has a **Versions** tab that shows its version history and publish history. Under a flow’s **Versions** tab, you’ll see: - **Version history**, listing all your previous versions. Userflow automatically creates new versions periodically, when you publish, or if multiple users edit the same flow. - **Publish history**, showing a log of when flows were published and by whom. ![Versions tab showing version history and publish history](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/version-overview.png) By clicking on the 3 dots to the right of each version, you can: - View its contents as it was in the Builder in read-only mode. - Compare two versions, which lets you inspect changes between them. - Publish it, for example, to revert to a previous version. - Restore it in case you want to undo some changes you’ve made. ![Version menu with View, Compare, Publish and Restore](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/version-control.png) ## Publish to a single environment Once you have installed the Userflow.js snippet in your environment, you can publish content to it. 1. Open a specific flow. 2. Click **Publish.** 3. A screen appears showing what changes you have made since the last version was published. 4. Deselect **Production.** 5. Click **Publish to Staging.** ![Publish dialog with Production deselected and Publish to Staging](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/preview-publish(1).png) You can always keep track of which version you have deployed to which environment through the **Versions** tab and restore to the production version if needed. ![Versions tab showing which version is live in Staging and in Production](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/version-staging-production.png) To check that a token is installed correctly, see [Userflow.js installation check](/docs/userflowjs-installation-check). ## How do I unpublish from an environment? If you have published something by mistake, you can always unpublish it via the following steps: 1. Open a flow and click the **Versions** tab. 2. Click on the 3 dots next to the environment you want to unpublish from. 3. Click **Unpublish**. The same menu can also be used to publish the latest version of a flow. ![Environment menu on the Versions tab with Unpublish](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/unpublish-version.png) ## Highlighting of non-production environments To make it easy to tell when you’re in a non-production environment in Userflow, we mark the UI with a yellow top border and the name of the environment. This is demonstrated in places where data or analytics are specifically related to that environment. By default, your initially created Production environment is marked as the primary environment. For the primary environment, you will not see any yellow highlight by default. You can change which environments should have the highlight in **Settings > Environments**. ## Related - [Storing user data in the EU or North America](/choosing-the-eu-or-us-for-customer-data-storage.md)