> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - 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: Manage Secrets in the Secrets Manager

## Article: Manage Secrets in the Secrets Manager

## Article Link: https://dev.wix.com/docs/studio-two/code-your-site/developer-environment/secrets/manage-secrets-in-the-secrets-manager.md

## Article Content:

# Manage Secrets in the Secrets Manager

The [Secrets Manager](https://dev.wix.com/docs/studio-two/code-your-site/developer-environment/secrets/about-the-secrets-manager.md) lets you access and manage secrets securely for use in your site's code.

## Step 1 | Access the Secrets Manager

You can access the Secrets Manager from your site's Wix dashboard or from the Studio Two editor.

**From the Wix dashboard:**
1. In the dashboard left sidebar, navigate to **Developer Tools**.
2. Click **Secrets**.

**From the Studio Two editor:**
1. On the left edge of the editor, click the toolbox icon to open **Developer Tools**.
2. Select **Secrets**. The **Secrets** page opens in the site dashboard in a new browser tab.

> **Note:** Changes in the Secrets Manager are applied immediately and don't require publishing the site.

## Step 2 | Manage your secrets

Use the Secrets Manager to add, edit, and delete secrets.

<details>
<summary id='add-a-secret' style="font-size:1.17em; font-weight:bold;">Add a secret</summary>

To add a secret:

1. At the top right of the Secrets Manager, click **Add Secret**.
2. In the **Add secret** panel, fill in the [secret fields](https://dev.wix.com/docs/studio-two/code-your-site/developer-environment/secrets/about-the-secrets-manager.md#secret-fields).
3. Click **Save Secret**.

The secret is saved. The list shows its name and hides its value.

</details>

<details>
<summary style="font-size:1.17em; font-weight:bold;">Edit a secret</summary>

To edit a secret:

<blockquote class="warning">
  <strong>Warning:</strong> Changing a secret's name or value breaks all code that uses the secret.
</blockquote>

1. For the secret you want to edit, select **Edit** in the secret's **More Actions** menu. The **Edit secret** panel appears.
2. To change the name, click the **Name** field and edit the text. To change the value, click **Retrieve value**, then click inside the **Value** field that appears.
3. Click **Save Secret**.

</details>

<details>
<summary style="font-size:1.17em; font-weight:bold;">Delete a secret</summary>

To delete a secret:

<blockquote class="warning">
  <strong>Warning:</strong>
  <ul>
    <li>Deleting a secret breaks all code that uses it.</li>
    <li>You can't restore a deleted secret.</li>
  </ul>
</blockquote>

1. For the secret you want to delete, select **Delete** in the secret's **More Actions** menu. The **Delete this secret?** dialog appears.
2. Click **Delete** to confirm.

</details>

## Step 3 | Read a secret in your backend code

This step reads a secret in an [HTTP endpoint](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/http-endpoints/add-an-http-endpoint-extension-in-studio-two.md). The secret has to exist already. Add it in Step 2.

<blockquote class="important">

**Important:** Don't read secrets with the `@wix/secrets` package. It can't read secrets you add in the Secrets Manager, and its `getSecretValue()` method returns `SECRET_NOT_FOUND`.

</blockquote>

To read a secret in an HTTP endpoint:

1. Open the endpoint's file, or add an HTTP endpoint extension. For how, see [Add an HTTP Endpoint Extension in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/http-endpoints/add-an-http-endpoint-extension-in-studio-two.md).
2. Read the secret with `process.env`, using the secret's name. For example, to read a secret named `SUPPLIER_API_KEY`:

   ```ts
   import type { APIRoute } from '@wix/custom-extensions/types';

   export const GET: APIRoute = async () => {
     const apiKey = process.env.SUPPLIER_API_KEY;
     // Use apiKey to call the 3rd-party API.
     return new Response(JSON.stringify({ ok: true }), {
       headers: { 'Content-Type': 'application/json' },
     });
   };
   ```

3. Before you use the secret, check who is calling the endpoint. Anyone who knows an endpoint's URL can request it. To learn how, see [Build an HTTP Endpoint in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/http-endpoints/build-an-http-endpoint-in-studio-two.md). Don't return a secret's value in a response or write it to a log.

The endpoint now reads the secret's value from `process.env`.

## See also

- [About the Secrets Manager](https://dev.wix.com/docs/studio-two/code-your-site/developer-environment/secrets/about-the-secrets-manager.md)
- [Add an HTTP Endpoint Extension in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/http-endpoints/add-an-http-endpoint-extension-in-studio-two.md)