variables Command - Medusa Cloud CLI Reference

In this guide, you'll learn how to inspect the environment variables of a Cloud environment using the CLI.

variables list#

List all environment variables for a Cloud environment.

Options#

Option

Description

Required

Default

-o <id>, --organization <id>

The ID of the organization that the environment belongs to.

Yes

Falls back to the organization in the active context, if set.

-p <id-or-handle>, --project <id-or-handle>

The ID or handle of the project that the environment belongs to.

Yes

Falls back to the project in the active context, if set.

-e <handle>, --environment <handle>

The handle of the environment to list variables from.

Yes

Falls back to the environment in the active context, if set.

--reveal

Print secret values in plain text instead of masking them.

No

false

--limit <number>

Maximum number of variables to return. Minimum: 1, maximum: 500.

No

200

--offset <number>

Pagination offset.

No

0

--json

Print the result as JSON instead of formatted text.

No

false


variables get#

Retrieve a single variable by its ID (var_...) or by its key. Looking up by key requires --project and --environment (or the equivalent values in the active context) so the CLI knows which environment to search.

You can also fetch a variable by ID without setting the active environment:

Terminal
mcloud variables get var_01XYZ

This returns the variable's details, similar to the following:

Arguments#

Option

Description

Required

variable

Variable ID (var_...) or key. When passing a key, you must also provide --project and --environment (or set them in the active context).

Yes

Options#

Option

Description

Required

Default

-o <id>, --organization <id>

The ID of the organization that the variable belongs to.

Yes

Falls back to the organization in the active context, if set.

-p <id-or-handle>, --project <id-or-handle>

The ID or handle of the project that the variable belongs to. Required when looking up by key.

Conditional

Falls back to the project in the active context, if set.

-e <handle>, --environment <handle>

The handle of the environment that the variable belongs to. Required when looking up by key.

Conditional

Falls back to the environment in the active context, if set.

--reveal

Print the secret value in plain text instead of masking it.

No

false

--json

Print the result as JSON instead of formatted text.

No

false


Reveal Secret Values#

By default, the CLI masks values for variables marked as secrets. Pass --reveal to print the plaintext value:

Warning: Avoid --reveal on shared terminals or in shell history. The plaintext value is printed to standard output, which is captured by terminal scrollback, log aggregators, and process listings.
Terminal
mcloud variables get DATABASE_URL --reveal

Export Variables to a .env File#

Use --json and jq to extract variables and write them to a local .env file. This is useful for replicating a Cloud environment's variables to a local development environment:

Terminal
mcloud variables list --reveal --json \  | jq -r '.[] | "\(.key)=\(.value)"' \  > .env
Was this guide helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Medusa MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break