> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pxxl.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Vault

> Keep shared secrets in one place and use them in any project's environment variables as {{vault.KEY}}.

The Vault holds secrets that several projects share: an API key for your payment provider, a database URL, an SMTP password. You store each one once, then reference it from any project's environment variables as `{{vault.KEY}}`. When you rotate the secret, every project that uses it picks up the new value on its next deploy.

Use it when the same secret lives in more than one project, or when you want to change a key without hunting down every place it was pasted.

| | |
| - | - |
| **Plans** | Plus, Pro and Enterprise |
| **Scope** | One workspace: your personal account, or a team |
| **Per environment** | A secret can apply to one environment or to all of them |
| **Storage** | Encrypted in a dedicated secrets store. Pxxl's database only keeps a reference. |
| **Used** | When a project deploys, `{{vault.KEY}}` is replaced by the secret's value |

## Add a secret

**1. Open the Vault**

In the sidebar, open **Vault** and choose **Create Secret**.

**2. Fill in the secret**

* **Key**: uppercase letters, digits and `_`, starting with a letter or `_`, up to 128 characters. For example `STRIPE_SECRET_KEY`.
* **Value**: up to 32 KB. It's stored encrypted, and only people who can edit the Vault can reveal it.
* **Environment**: one environment, such as **Production**, or **All environments**.
* **Description** (optional): what it's for, up to 500 characters.

**3. Copy the reference**

The form shows the reference, `{{vault.STRIPE_SECRET_KEY}}`. Choose **Add secret**.

![The Add secret panel with Key, Value, Environment and Description fields, and the reference \{\{vault.KEY}} with a Copy button.](https://mintcdn.com/pxxl/jmHqW1Ax8HZi8e3v/images/vault/add-secret.jpeg?fit=max\&auto=format\&n=jmHqW1Ax8HZi8e3v\&q=85\&s=1656097a04287ccda35bef8ecdd86055)

## Use a secret in a project

In a project's **Environment variables**, set the value to the reference:

```bash theme={null}
STRIPE_SECRET_KEY={{vault.STRIPE_SECRET_KEY}}
```

A reference can also sit inside a longer value:

```bash theme={null}
DATABASE_URL=postgresql://app:{{vault.DB_PASSWORD}}@k3x9q2.pxxldb.pxxl.pro:41873/app
REDIS_URL=redis://default:{{ vault.REDIS_PASSWORD }}@cache.example.com:6379/0
```

Spaces inside the braces are allowed. The editor shows each reference as a chip so you can see where it points.

Your app reads the variable as usual (`process.env.STRIPE_SECRET_KEY`); it never sees the reference.

### Which value a project gets

When a project deploys, Pxxl looks for the key in the project's workspace:

1. A secret set for the project's environment, such as **Production** (the environment you pick in the dashboard's top bar).
2. Otherwise, a secret set for **All environments**.

If neither exists, the deploy stops with `VAULT_REFERENCE_MISSING` and names the key. Add the secret, then deploy again.

## Rotate a secret

Open the secret, change its value and save. Projects keep the old value until they deploy again, so redeploy every project that uses it. The Vault list shows **Used by N projects** for each secret, which tells you how many to redeploy.

## Delete a secret

Open the secret's menu and delete it. If projects still reference it, Pxxl refuses and lists them, so a later deploy doesn't fail. Remove the references first, or confirm you want to delete it anyway.

## Who can see and change secrets

In a team, the Vault follows the team's **environment variables** permission:

| Permission | Can |
| - | - |
| View | See the list of keys, descriptions and where they're used. Not the values. |
| Update | Create secrets, change values and reveal them. |
| Delete | Delete secrets. |

Creating, changing and deleting secrets are recorded in the team's activity.

## From the API

| Method and path | What it does |
| - | - |
| `GET /vault` | List secrets (without values). Optional `teamId`, `environmentId`. |
| `POST /vault` | Create a secret: `key`, `value`, `environmentId` (empty for all), `description`. |
| `PUT /vault/{id}` | Change the value or description. |
| `GET /vault/{id}/reveal` | Return the value. |
| `GET /vault/references` | Which projects reference which keys. |
| `DELETE /vault/{id}` | Delete. Add `?force=true` to delete a secret that's still referenced. |

## Troubleshooting

| Error | Fix |
| - | - |
| `VAULT_REFERENCE_MISSING` during a deploy | The key isn't in the Vault for this workspace and environment. Check the spelling (keys are case-sensitive) and the secret's environment. |
| `VAULT_PLAN_REQUIRED` | The workspace isn't on a paid plan. Upgrade, or replace the references with plain values. |
| The app still has the old value | Redeploy the project after rotating. |
| Can't reveal a value | You need update permission on environment variables in the team. |

## Where to go next

> [card] [Environment variables](https://docs.pxxl.app/deploy/environment-variables.md)
>
> How projects get their configuration.

> [card] [Teams and settings](https://docs.pxxl.app/account/settings.md)
>
> Roles and permissions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.