{
  "doc": {
    "id": "api/cypress-api/expose",
    "title": "Cypress.expose | Cypress Documentation",
    "description": "Read and write public configuration values in Cypress using Cypress.expose(). Learn syntax, examples, security considerations, and how it differs from cy.env().",
    "section": "api",
    "source_path": "/llm/markdown/api/cypress-api/expose.md",
    "version": "3cf5b86b3403f604bdf7f3e35025c3bc3865e02c",
    "updated_at": "2026-05-07T17:44:31.931Z",
    "headings": [
      {
        "id": "api/cypress-api/expose#cypress-expose",
        "text": "Cypress.expose",
        "level": 1
      },
      {
        "id": "api/cypress-api/expose#syntax",
        "text": "Syntax",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#arguments",
        "text": "Arguments",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#examples",
        "text": "Examples",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#get-all-exposed-configuration-variables",
        "text": "Get all exposed configuration variables",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#get-a-single-exposed-configuration-variable",
        "text": "Get a single exposed configuration variable",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#set-a-single-exposed-configuration-variable",
        "text": "Set a single exposed configuration variable",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#set-multiple-exposed-values",
        "text": "Set multiple exposed values",
        "level": 4
      },
      {
        "id": "api/cypress-api/expose#configuration-sources",
        "text": "Configuration sources",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#cypress-configuration-file",
        "text": "Cypress configuration file",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#cli-flags",
        "text": "CLI Flags",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#common-use-cases",
        "text": "Common use cases",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#use-cypress-expose-in-plugins-or-support-files",
        "text": "Use Cypress.expose() in plugins or support files",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#migrate-from-cypress-env-to-cypress-expose",
        "text": "Migrate from Cypress.env() to Cypress.expose()",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#notes",
        "text": "Notes",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#when-to-use-cy-env-vs-cypress-expose",
        "text": "When to use cy.env() vs Cypress.expose()",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#use-cypress-expose-for-public-configuration",
        "text": "Use Cypress.expose() for public configuration",
        "level": 4
      },
      {
        "id": "api/cypress-api/expose#use-cy-env-for-sensitive-or-secret-values",
        "text": "Use cy.env() for sensitive or secret values",
        "level": 4
      },
      {
        "id": "api/cypress-api/expose#scope-and-lifecycle-limitations",
        "text": "Scope and lifecycle limitations",
        "level": 3
      },
      {
        "id": "api/cypress-api/expose#history",
        "text": "History",
        "level": 2
      },
      {
        "id": "api/cypress-api/expose#see-also",
        "text": "See also",
        "level": 2
      }
    ]
  },
  "chunks": [
    {
      "id": "api/cypress-api/expose#syntax",
      "doc_id": "api/cypress-api/expose",
      "heading": "Syntax",
      "heading_level": 2,
      "content_markdown": "## Syntax\n\n```\nCypress.expose()Cypress.expose(key)Cypress.expose(key, value)Cypress.expose(object)\n```\n\n### Arguments\n\n**key _(String)_**\n\nThe name of the exposed configuration variable to get or set.\n\n**value _(any)_**\n\nThe value of the exposed configuration variable to set. Can be any serializable type (string, number, boolean, object, etc.).\n\n**object _(Object)_**\n\nSet multiple exposed configuration variables with an object literal. Values are merged with existing values.\n",
      "section": "api",
      "anchors": [
        "syntax"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 79
    },
    {
      "id": "api/cypress-api/expose#arguments",
      "doc_id": "api/cypress-api/expose",
      "heading": "Arguments",
      "heading_level": 3,
      "content_markdown": "### Arguments\n\n**key _(String)_**\n\nThe name of the exposed configuration variable to get or set.\n\n**value _(any)_**\n\nThe value of the exposed configuration variable to set. Can be any serializable type (string, number, boolean, object, etc.).\n\n**object _(Object)_**\n\nSet multiple exposed configuration variables with an object literal. Values are merged with existing values.\n",
      "section": "api",
      "anchors": [
        "arguments"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 71
    },
    {
      "id": "api/cypress-api/expose#examples",
      "doc_id": "api/cypress-api/expose",
      "heading": "Examples",
      "heading_level": 2,
      "content_markdown": "## Examples\n\n### Get all exposed configuration variables\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'value1',    featureFlag: true,    apiVersion: 2,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'value1',    featureFlag: true,    apiVersion: 2,  },})\n```\n\n```\nCypress.expose() // => {pluginConfig: 'value1', featureFlag: true, apiVersion: 2}\n```\n\n### Get a single exposed configuration variable\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'my-plugin-config',    featureFlag: true,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'my-plugin-config',    featureFlag: true,  },})\n```\n\n```\nCypress.expose('pluginConfig') // => \"my-plugin-config\"Cypress.expose('featureFlag') // => trueCypress.expose('nonExistent') // => undefined\n```\n\n### Set a single exposed configuration variable\n\nChanges made with `Cypress.expose()` apply only for the remainder of the _current spec file_.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'initial-value',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'initial-value',  },})\n```\n\n```\nCypress.expose('pluginConfig', 'updated-value')Cypress.expose('pluginConfig') // => \"updated-value\"\n```\n\n#### Set multiple exposed values\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'initial-value',    featureFlag: false,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'initial-value',    featureFlag: false,  },})\n```\n\n```\nCypress.expose({  pluginConfig: 'updated-value',  featureFlag: true,})Cypress.expose() // => {pluginConfig: 'updated-value', featureFlag: true}\n```\n",
      "section": "api",
      "anchors": [
        "examples"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 315
    },
    {
      "id": "api/cypress-api/expose#get-all-exposed-configuration-variables",
      "doc_id": "api/cypress-api/expose",
      "heading": "Get all exposed configuration variables",
      "heading_level": 3,
      "content_markdown": "### Get all exposed configuration variables\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'value1',    featureFlag: true,    apiVersion: 2,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'value1',    featureFlag: true,    apiVersion: 2,  },})\n```\n\n```\nCypress.expose() // => {pluginConfig: 'value1', featureFlag: true, apiVersion: 2}\n```\n",
      "section": "api",
      "anchors": [
        "get-all-exposed-configuration-variables"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 79
    },
    {
      "id": "api/cypress-api/expose#get-a-single-exposed-configuration-variable",
      "doc_id": "api/cypress-api/expose",
      "heading": "Get a single exposed configuration variable",
      "heading_level": 3,
      "content_markdown": "### Get a single exposed configuration variable\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'my-plugin-config',    featureFlag: true,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'my-plugin-config',    featureFlag: true,  },})\n```\n\n```\nCypress.expose('pluginConfig') // => \"my-plugin-config\"Cypress.expose('featureFlag') // => trueCypress.expose('nonExistent') // => undefined\n```\n",
      "section": "api",
      "anchors": [
        "get-a-single-exposed-configuration-variable"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 76
    },
    {
      "id": "api/cypress-api/expose#set-a-single-exposed-configuration-variable",
      "doc_id": "api/cypress-api/expose",
      "heading": "Set a single exposed configuration variable",
      "heading_level": 3,
      "content_markdown": "### Set a single exposed configuration variable\n\nChanges made with `Cypress.expose()` apply only for the remainder of the _current spec file_.\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'initial-value',  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'initial-value',  },})\n```\n\n```\nCypress.expose('pluginConfig', 'updated-value')Cypress.expose('pluginConfig') // => \"updated-value\"\n```\n\n#### Set multiple exposed values\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'initial-value',    featureFlag: false,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'initial-value',    featureFlag: false,  },})\n```\n\n```\nCypress.expose({  pluginConfig: 'updated-value',  featureFlag: true,})Cypress.expose() // => {pluginConfig: 'updated-value', featureFlag: true}\n```\n",
      "section": "api",
      "anchors": [
        "set-a-single-exposed-configuration-variable"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 157
    },
    {
      "id": "api/cypress-api/expose#set-multiple-exposed-values",
      "doc_id": "api/cypress-api/expose",
      "heading": "Set multiple exposed values",
      "heading_level": 4,
      "content_markdown": "#### Set multiple exposed values\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'initial-value',    featureFlag: false,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'initial-value',    featureFlag: false,  },})\n```\n\n```\nCypress.expose({  pluginConfig: 'updated-value',  featureFlag: true,})Cypress.expose() // => {pluginConfig: 'updated-value', featureFlag: true}\n```\n",
      "section": "api",
      "anchors": [
        "set-multiple-exposed-values"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 75
    },
    {
      "id": "api/cypress-api/expose#configuration-sources",
      "doc_id": "api/cypress-api/expose",
      "heading": "Configuration sources",
      "heading_level": 2,
      "content_markdown": "## Configuration sources\n\nRead the [Environment Variables & Secrets](/llm/markdown/app/guides/environment-variables.md) guide for more details.\n\n### Cypress configuration file\n\nExposed configuration variables can be set in your [Cypress configuration](/llm/markdown/app/references/configuration.md) file:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'foo',    featureFlag: true,    apiVersion: 1,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'foo',    featureFlag: true,    apiVersion: 1,  },})\n```\n\n```\n// In your test or support fileconst pluginConfig = Cypress.expose('pluginConfig') // => \"foo\"const featureFlag = Cypress.expose('featureFlag') // => trueconst apiVersion = Cypress.expose('API_VERSION') // => 1\n```\n\n### CLI Flags\n\nYou can set exposed configuration variables using the `--expose` or `-x` CLI flags. CLI values override configuration file values.\n\n```\ncypress run --expose pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n\nOr using the short form:\n\n```\ncypress run -x pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n",
      "section": "api",
      "anchors": [
        "configuration-sources"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 181
    },
    {
      "id": "api/cypress-api/expose#cypress-configuration-file",
      "doc_id": "api/cypress-api/expose",
      "heading": "Cypress configuration file",
      "heading_level": 3,
      "content_markdown": "### Cypress configuration file\n\nExposed configuration variables can be set in your [Cypress configuration](/llm/markdown/app/references/configuration.md) file:\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  expose: {    pluginConfig: 'foo',    featureFlag: true,    apiVersion: 1,  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  expose: {    pluginConfig: 'foo',    featureFlag: true,    apiVersion: 1,  },})\n```\n\n```\n// In your test or support fileconst pluginConfig = Cypress.expose('pluginConfig') // => \"foo\"const featureFlag = Cypress.expose('featureFlag') // => trueconst apiVersion = Cypress.expose('API_VERSION') // => 1\n```\n",
      "section": "api",
      "anchors": [
        "cypress-configuration-file"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 112
    },
    {
      "id": "api/cypress-api/expose#cli-flags",
      "doc_id": "api/cypress-api/expose",
      "heading": "CLI Flags",
      "heading_level": 3,
      "content_markdown": "### CLI Flags\n\nYou can set exposed configuration variables using the `--expose` or `-x` CLI flags. CLI values override configuration file values.\n\n```\ncypress run --expose pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n\nOr using the short form:\n\n```\ncypress run -x pluginConfig=foo,featureFlag=true,API_VERSION=1\n```\n",
      "section": "api",
      "anchors": [
        "cli-flags"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 52
    },
    {
      "id": "api/cypress-api/expose#common-use-cases",
      "doc_id": "api/cypress-api/expose",
      "heading": "Common use cases",
      "heading_level": 2,
      "content_markdown": "## Common use cases\n\n### Use Cypress.expose() in plugins or support files\n\n`Cypress.expose()` is ideal when configuration is needed outside of Cypress command chains:\n\n```\n// cypress/support/commands.js or plugin codeconst pluginConfig = Cypress.expose('pluginConfig')if (pluginConfig === 'enabled') {  initializePlugin(pluginConfig)}\n```\n",
      "section": "api",
      "anchors": [
        "common-use-cases"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 52
    },
    {
      "id": "api/cypress-api/expose#use-cypress-expose-in-plugins-or-support-files",
      "doc_id": "api/cypress-api/expose",
      "heading": "Use Cypress.expose() in plugins or support files",
      "heading_level": 3,
      "content_markdown": "### Use Cypress.expose() in plugins or support files\n\n`Cypress.expose()` is ideal when configuration is needed outside of Cypress command chains:\n\n```\n// cypress/support/commands.js or plugin codeconst pluginConfig = Cypress.expose('pluginConfig')if (pluginConfig === 'enabled') {  initializePlugin(pluginConfig)}\n```\n",
      "section": "api",
      "anchors": [
        "use-cypress-expose-in-plugins-or-support-files"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 47
    },
    {
      "id": "api/cypress-api/expose#migrate-from-cypress-env-to-cypress-expose",
      "doc_id": "api/cypress-api/expose",
      "heading": "Migrate from Cypress.env() to Cypress.expose()",
      "heading_level": 2,
      "content_markdown": "## Migrate from Cypress.env() to Cypress.expose()\n\nIf you're migrating a plugin from `Cypress.env()` to `Cypress.expose()`, the API is similar:\n\n**Before (using deprecated `Cypress.env()`):**\n\n```\nconst config = Cypress.env('PLUGIN_CONFIG')\n```\n\n**After (using `Cypress.expose()`):**\n\n```\nconst config = Cypress.expose('PLUGIN_CONFIG')\n```\n\nUpdate your configuration file:\n\n**Before:**\n\n```\n{  env: {    PLUGIN_CONFIG: 'value',  },}\n```\n\n**After:**\n\n```\n{  expose: {    PLUGIN_CONFIG: 'value',  },}\n```\n",
      "section": "api",
      "anchors": [
        "migrate-from-cypress-env-to-cypress-expose"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 80
    },
    {
      "id": "api/cypress-api/expose#notes",
      "doc_id": "api/cypress-api/expose",
      "heading": "Notes",
      "heading_level": 2,
      "content_markdown": "## Notes\n\n### When to use `cy.env()` vs `Cypress.expose()`\n\nBoth [`cy.env()`](/llm/markdown/api/commands/env.md) and [`Cypress.expose()`](/llm/markdown/api/cypress-api/expose.md) provide access to configuration values in Cypress, but they serve different security and execution needs. Choosing the right API helps avoid accidental exposure of sensitive data and keeps configuration intent clear.\n\n#### Use Cypress.expose() for public configuration\n\nRecommended when:\n\n*   **Values are public or non-sensitive** - Examples include feature flags, API versions, environment labels, or plugin configuration that is safe to appear in browser state.\n*   **Synchronous access is needed** - `Cypress.expose()` returns values immediately, without requiring Cypress command chaining.\n\n#### Use `cy.env()` for sensitive or secret values\n\nChoose `cy.env()` when security, scoping, and controlled access matter. Recommended when:\n\n*   **Values are sensitive** - API keys, passwords, tokens, or any data that should not be broadly exposed to the browser.\n*   **Security is a priority** - `cy.env()` only exposes the variables you explicitly request and does not automatically serialize them into browser state.\n*   **You're already working within Cypress command chains**: `cy.env()` is asynchronous and designed to be used inside Cypress tests and hooks.\n\n**Example: choosing the right API**\n\n```\n// ✅ Use cy.env() for sensitive valuescy.env(['apiKey']).then(({ apiKey }) => {  cy.request({    url: 'https://api.example.com/users',    headers: { Authorization: `Bearer ${apiKey}` },  })})// ✅ Use Cypress.expose() for public configurationconst apiVersion = Cypress.expose('apiVersion') // Synchronous, public valueconst featureFlag = Cypress.expose('featureFlag') // Safe to expose in browser\n```\n\nSee [`cy.env()`](/llm/markdown/api/commands/env.md) for more details.\n\n### Scope and lifecycle limitations\n\n*   Exposed values persist only while the browser is open.\n*   Runtime changes apply only within the current spec file\n*   Values do not propagate back to Node.js contexts such as `setupNodeEvents`\n",
      "section": "api",
      "anchors": [
        "notes"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 359
    },
    {
      "id": "api/cypress-api/expose#when-to-use-cy-env-vs-cypress-expose",
      "doc_id": "api/cypress-api/expose",
      "heading": "When to use cy.env() vs Cypress.expose()",
      "heading_level": 3,
      "content_markdown": "### When to use `cy.env()` vs `Cypress.expose()`\n\nBoth [`cy.env()`](/llm/markdown/api/commands/env.md) and [`Cypress.expose()`](/llm/markdown/api/cypress-api/expose.md) provide access to configuration values in Cypress, but they serve different security and execution needs. Choosing the right API helps avoid accidental exposure of sensitive data and keeps configuration intent clear.\n\n#### Use Cypress.expose() for public configuration\n\nRecommended when:\n\n*   **Values are public or non-sensitive** - Examples include feature flags, API versions, environment labels, or plugin configuration that is safe to appear in browser state.\n*   **Synchronous access is needed** - `Cypress.expose()` returns values immediately, without requiring Cypress command chaining.\n\n#### Use `cy.env()` for sensitive or secret values\n\nChoose `cy.env()` when security, scoping, and controlled access matter. Recommended when:\n\n*   **Values are sensitive** - API keys, passwords, tokens, or any data that should not be broadly exposed to the browser.\n*   **Security is a priority** - `cy.env()` only exposes the variables you explicitly request and does not automatically serialize them into browser state.\n*   **You're already working within Cypress command chains**: `cy.env()` is asynchronous and designed to be used inside Cypress tests and hooks.\n\n**Example: choosing the right API**\n\n```\n// ✅ Use cy.env() for sensitive valuescy.env(['apiKey']).then(({ apiKey }) => {  cy.request({    url: 'https://api.example.com/users',    headers: { Authorization: `Bearer ${apiKey}` },  })})// ✅ Use Cypress.expose() for public configurationconst apiVersion = Cypress.expose('apiVersion') // Synchronous, public valueconst featureFlag = Cypress.expose('featureFlag') // Safe to expose in browser\n```\n\nSee [`cy.env()`](/llm/markdown/api/commands/env.md) for more details.\n",
      "section": "api",
      "anchors": [
        "when-to-use-cy-env-vs-cypress-expose"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 307
    },
    {
      "id": "api/cypress-api/expose#use-cypress-expose-for-public-configuration",
      "doc_id": "api/cypress-api/expose",
      "heading": "Use Cypress.expose() for public configuration",
      "heading_level": 4,
      "content_markdown": "#### Use Cypress.expose() for public configuration\n\nRecommended when:\n\n*   **Values are public or non-sensitive** - Examples include feature flags, API versions, environment labels, or plugin configuration that is safe to appear in browser state.\n*   **Synchronous access is needed** - `Cypress.expose()` returns values immediately, without requiring Cypress command chaining.\n",
      "section": "api",
      "anchors": [
        "use-cypress-expose-for-public-configuration"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 65
    },
    {
      "id": "api/cypress-api/expose#use-cy-env-for-sensitive-or-secret-values",
      "doc_id": "api/cypress-api/expose",
      "heading": "Use cy.env() for sensitive or secret values",
      "heading_level": 4,
      "content_markdown": "#### Use `cy.env()` for sensitive or secret values\n\nChoose `cy.env()` when security, scoping, and controlled access matter. Recommended when:\n\n*   **Values are sensitive** - API keys, passwords, tokens, or any data that should not be broadly exposed to the browser.\n*   **Security is a priority** - `cy.env()` only exposes the variables you explicitly request and does not automatically serialize them into browser state.\n*   **You're already working within Cypress command chains**: `cy.env()` is asynchronous and designed to be used inside Cypress tests and hooks.\n\n**Example: choosing the right API**\n\n```\n// ✅ Use cy.env() for sensitive valuescy.env(['apiKey']).then(({ apiKey }) => {  cy.request({    url: 'https://api.example.com/users',    headers: { Authorization: `Bearer ${apiKey}` },  })})// ✅ Use Cypress.expose() for public configurationconst apiVersion = Cypress.expose('apiVersion') // Synchronous, public valueconst featureFlag = Cypress.expose('featureFlag') // Safe to expose in browser\n```\n\nSee [`cy.env()`](/llm/markdown/api/commands/env.md) for more details.\n",
      "section": "api",
      "anchors": [
        "use-cy-env-for-sensitive-or-secret-values"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 185
    },
    {
      "id": "api/cypress-api/expose#scope-and-lifecycle-limitations",
      "doc_id": "api/cypress-api/expose",
      "heading": "Scope and lifecycle limitations",
      "heading_level": 3,
      "content_markdown": "### Scope and lifecycle limitations\n\n*   Exposed values persist only while the browser is open.\n*   Runtime changes apply only within the current spec file\n*   Values do not propagate back to Node.js contexts such as `setupNodeEvents`\n",
      "section": "api",
      "anchors": [
        "scope-and-lifecycle-limitations"
      ],
      "path": "/llm/json/chunked/api/cypress-api/expose.json",
      "token_estimate": 49
    }
  ]
}