When using environments, you can integrate your code with any of your environments. This document covers how to integrate with an environment other than your main environment.
To get the most out of this document, ensure you already have an environment in addition to your main environment.
For detailed instructions, read Setting Up Environments.
This section covers how to update the Preview URL for a model in an environment.
Notice that when you change the Preview URL in one existing environment, it does not affect the Preview URL on the same model in another environment.
In the environment, modify the Preview URL to reflect the correct URL.
- In the non-main environment you're integrating, go to Models.
- Change the model* Preview URL to the appropriate location—for example,
http://localhost:####
, where####
is your port, such as3000
—for local development. - Click the Update Preview URL button.
*As an example, if you're developing Pages, change the Page model Preview URL.
For more detail on Preview URLs, read Editing and Previewing your Site.
To get the API key for the environment that you'd like to integrate with:
- Go to the main Account Settings > Environments.
- Select and copy the API Key for the environment you want to integrate with.
- In your code, replace the API Key of the main environment with the API key of the child environment.
- Deploy the codebase to the relevant URL using the updated API key.
If you are running the environment locally, no deployment is required. However, if the environment has a specific URL—for example, dev.my-url.com
— remember to deploy the changes.
For more detailed information on API Keys in general, read Using Builder API Keys.