> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Share Environment Variables

## Article: Share Environment Variables with Collaborators

## Article Link: https://dev.wix.com/docs/go-headless/wix-managed-headless/project-development/environment-variables/share-environment-variables.md

## Article Content:

# Share Environment Variables with Collaborators

Share secret environment variables, such as API keys for AI usage, with collaborators on your Wix-managed headless project. Instead of sending secrets to your team over insecure channels, you store them once with Wix, and each collaborator pulls them into their own local environment with the Wix CLI.

Secrets are stored securely on Wix servers, not in your local `.env.local` file, so they're never at risk of being committed to your repository.

> **Note:** This applies to [Wix-managed headless](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md) projects, which Wix hosts and you develop with the Wix CLI. [Self-managed headless](https://dev.wix.com/docs/go-headless/self-managed-headless/about-self-managed-headless.md) projects run their own backend and share secrets through their framework or hosting provider.

## Before you begin

Make sure that:

- You have a [Wix-managed headless](https://dev.wix.com/docs/go-headless/wix-managed-headless/about-wix-managed-headless.md) project.
- The people you want to share secrets with are [collaborators on your project](https://dev.wix.com/docs/go-headless/project-guides/project-management/invite-collaborators.md).

## Step 1 | Add the secret

Add the secret in one of the following ways:

- **Wix CLI:** Use the [`wix env set`](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/env-set.md) command to set the secret from your terminal.

  ```bash
  wix env set --key=<YOUR_KEY> --value=<YOUR_VALUE>
  ```

- **Secrets Manager:** Add and manage the secret from your dashboard, without using the CLI. This is useful for managing secrets in one place, or for team members who need to add or update a secret but don't develop with the CLI, such as a site admin.

  1. Open your headless project dashboard.
  1. Go to **Developer Tools** > **Secrets Manager**.
  1. Click **Add Secret**.
  1. Enter a **name** and **value** for the secret, then save it.

> **Note:** Secrets set with `wix env set` are stored on Wix servers but don't appear in the Secrets Manager, which shows only secrets added through the dashboard. Both are pulled by `wix env pull`. To keep all your secrets visible and manageable in one place, add them through the Secrets Manager.

## Step 2 | Pull the secret

Each collaborator pulls the shared secrets into their own local environment using the [`wix env pull`](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/env-pull.md) command, which merges them into their `.env.local` file. This includes secrets added with either `wix env set` or the Secrets Manager.

```bash
wix env pull
```

After pulling, the secret is available in the collaborator's local environment for use with [`wix dev`](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/dev.md). To use the secret in code, make sure it's defined in the project's schema. For more information, see [Manage Environment Variables in the CLI](https://dev.wix.com/docs/go-headless/wix-managed-headless/project-development/environment-variables/manage-environment-variables.md).

## See also

- [Invite Collaborators](https://dev.wix.com/docs/go-headless/project-guides/project-management/invite-collaborators.md)
- [About Environment Variables in the CLI](https://dev.wix.com/docs/go-headless/wix-managed-headless/project-development/environment-variables/about-environment-variables-in-the-cli.md)
- [Manage Environment Variables in the CLI](https://dev.wix.com/docs/go-headless/wix-managed-headless/project-development/environment-variables/manage-environment-variables.md)
</content>