Skip to main content
For written steps and a code example, go to Zapier environment variables: OAuth and API key management.

Video transcript

Environment variables unlock enhanced security and flexibility for your integration by storing key-value pairs outside your integration’s API calls, safeguarding sensitive data like IDs or authentication data. These variables not only protect data but also allow seamless toggling between staging and production environments. This ensures your integration runs smoothly across different settings without compromising security. Let’s take a closer look at environment variables and how to implement them. To set up environment variables for your integration, log into the Platform UI and select your integration. Navigate to the Advanced section, where you can add key-value pairs. Click Add to include additional environment variables, or click the x icon to remove variables if needed. Once you’ve completed adding the key and value, click Save. Reference environment variables in API call forms or custom code using the key of the environment variable you want to use. This replaces variables with their values, ensuring accurate data retrieval every time. You can also reference environment variables in custom code if you switch your API call to Code Mode. If you want to be able to work with staging and production environments while building your integration, the best practice is to set environment variables for both URLs you want to call. Then, set another environment variable for the URL you want to work with. For example, create a new environment variable with the key ENVFLAG and the value staging. Then, in Code Mode, check the value of the latter variable and conditionally reference the corresponding domain environment variable. Here’s a sample of code doing exactly this. During development, you can toggle the value of one environment variable to conditionally call the corresponding domain. However, once a version is pushed to production, the variables are fixed, so in the case of a public integration, make sure to set the flag environment variable accordingly before promoting. By mastering environment variables, you’ll enhance your integration’s security and flexibility. Now, take action: implement these strategies in your integration and experience the difference firsthand.
Last modified on November 18, 2026