> 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

# Method name: getSecret(name: string)

# Method package: wixSecretsBackend

# Method menu location: wixSecretsBackend --> getSecret

# Method Link: https://dev.wix.com/docs/velo/apis/wix-secrets-backend/get-secret.md

# Method Description:

> **Deprecation Warning**
> 
> This method will be deprecated on September 7, 2025.
>
> Replace with [Get Secret Value](https://dev.wix.com/docs/velo/apis/wix-secrets-backend-v2/secrets/get-secret-value.md).

Gets a secret by name.

The `getSecret()` function returns a Promise that resolves to the value of the secret
 that was stored in the Secrets Manager with the given name.

> **Note:** To prevent malicious users from accessing the value of your secret,
don't return the value of the secret to client side. Only use the secret's value in the backend.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Get a secret and use it to fetch a JSON from a 3rd-party service

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import wixSecretsBackend from 'wix-secrets-backend';
import { getJSON } from 'wix-fetch';

export const getSomeJSON = webMethod(Permissions.Anyone, () => {
  return wixSecretsBackend.getSecret("myApiKeyName")
    .then((secret) => {
      return getJSON(`https://someapi.com/api/someendpoint?apiKey=${secret}`);
    })
    .catch((error) => {
      console.error(error);
    });
});

export const getFirstSecretValue = webMethod(Permissions.Anyone, () => {
  return wixSecretsBackend.listSecretInfo()
    .then((secrets) => {
      return wixSecretsBackend.getSecret(secrets[0].name);
    })
    .catch((error) => {
      console.error(error);
    });
});
```

## Retrieve a name and get a secret's value

```javascript

import { Permissions, webMethod } from 'wix-web-module';
import wixSecretsBackend from 'wix-secrets-backend';

export const getFirstSecretValue = webMethod(Permissions.Anyone, () => {
  return wixSecretsBackend.listSecretInfo()
    .then((secrets) => {
      return wixSecretsBackend.getSecret(secrets[0].name);
    })
    .catch((error) => {
      console.error(error);
    });
});

/*
 * Returns a Promise that resolves to:
 *
 * "Fm8OfflH6bJOwWjenqAtLurLbkiMNvmhQHZV+118"
 */

```

## Get an API key and use it to fetch a JSON from a weather service

```javascript
/************************************
 * Backend code - getWeather.web.js *
 ************************************/

import { Permissions, webMethod } from 'wix-web-module';
import wixSecretsBackend from 'wix-secrets-backend';
import { getJSON } from 'wix-fetch';

export const getWeatherJson = webMethod(Permissions.Anyone, async () => {
  const secret = await wixSecretsBackend.getSecret("openWeatherApiKey");
  return getJSON(`https://api.openweathermap.org/data/2.5/weather?q=London&units=metric&APPID=${secret}`);
});

/********************
 * Client-side code *
 ********************/

import { getWeatherJson } from 'backend/getWeather.web';

export async function getWeather_click(event) {
  let json = await getWeatherJson();
  $w("#weather").text = json.weather[0].description; // "mist"
  $w("#temp").text = json.main.temp; // 9.4 (degrees Celsius)
}
```

## Get an API key and use it to send an email with the SendGrid npm interface

```javascript
/************************************
 * Backend code - sendEmail.web.js *
 ************************************/

import { Permissions, webMethod } from 'wix-web-module';
import wixSecretsBackend from 'wix-secrets-backend';
import sendGridMail from '@sendgrid/mail';

export const sendEmail = webMethod(Permissions.Anyone, async (recipient, sender, subject, body) => {
  const secret = await wixSecretsBackend.getSecret("SendGridApiKey");
  sendGridMail.setApiKey(secret);
  const message = {
    "to": recipient,
    "from": sender,
    "subject": subject,
    "text": body
  };
  sendGridMail.send(message);
});

/********************
 * Client-side code *
 ********************/

import { sendEmail } from 'backend/sendEmail.web';

export function sendEmailButton_click(event) {
  sendEmail(
    $w("#toEmail").value,
    $w("#fromEmail").value,
    $w("#subject").value,
    $w("#emailContent").value
  )
    .then(() => {
      console.log("Email sent");
    })
    .catch((error) => {
      console.error(error);
    })
}
```

---