www/apps/cloud/app/cli/commands/variables/page.mdx
import { Table, Note, CodeTabs, CodeTab } from "docs-ui"
export const metadata = {
title: 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.
List all environment variables for a Cloud environment.
<CodeTabs group="cli-auth"> <CodeTab label="With Flags" value="flags">mcloud variables list \
--organization org_123 \
--project proj_123 \
--environment env_123
# Run once: mcloud use --organization org_123 --project proj_123 --environment env_123
mcloud variables list
`-o <id>`, `--organization <id>`
</Table.Cell>
<Table.Cell>
The [ID of the organization](../organizations/page.mdx#find-organization-id) that the environment belongs to.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
Falls back to the organization in the [active context](../use/page.mdx), if set.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <id-or-handle>`, `--project <id-or-handle>`
</Table.Cell>
<Table.Cell>
The [ID or handle of the project](../projects/page.mdx#find-project-ids-and-handles) that the environment belongs to.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
Falls back to the project in the [active context](../use/page.mdx), if set.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-e <handle>`, `--environment <handle>`
</Table.Cell>
<Table.Cell>
The [handle of the environment](../environments/page.mdx#find-environment-handles) to list variables from.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
Falls back to the environment in the [active context](../use/page.mdx), if set.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--reveal`
</Table.Cell>
<Table.Cell>
Print secret values in plain text instead of masking them.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--limit <number>`
</Table.Cell>
<Table.Cell>
Maximum number of variables to return. Minimum: `1`, maximum: `500`.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`200`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--offset <number>`
</Table.Cell>
<Table.Cell>
Pagination offset.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`0`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--json`
</Table.Cell>
<Table.Cell>
Print the result as JSON instead of formatted text.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>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.
mcloud variables get ADMIN_CORS \
--organization org_123 \
--project proj_123 \
--environment env_123
# Run once: mcloud use --organization org_123 --project proj_123 --environment env_123
mcloud variables get ADMIN_CORS
You can also fetch a variable by ID without setting the active environment:
mcloud variables get var_01XYZ
This returns the variable's details, similar to the following:
<CodeTabs group="cli-output"> <CodeTab label="Plaintext" value="plaintext">ID: var_123
Key: ADMIN_CORS
Value: https://admin.mystore.com
Secret: no
Scope: runtime
Environment: env_123
Last updated by: enduser_123
Created at: Dec 16, 2025, 10:33 AM GMT+2
Updated at: Feb 17, 2026, 4:15 PM GMT+2
{
"id": "var_123",
"organization_id": "org_123",
"entity_id": "env_123",
"key": "ADMIN_CORS",
"value": "https://admin.mystore.com",
"is_secret": false,
"is_build": false,
"is_runtime": true,
"last_updated_by": "enduser_123",
"created_at": "2025-12-16T08:33:00.000Z",
"updated_at": "2026-02-17T14:15:00.000Z"
}
`variable`
</Table.Cell>
<Table.Cell>
Variable ID (`var_...`) or key. When passing a key, you must also provide `--project` and `--environment` (or set them in the [active context](../use/page.mdx)).
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
</Table.Body>
</Table> `-o <id>`, `--organization <id>`
</Table.Cell>
<Table.Cell>
The [ID of the organization](../organizations/page.mdx#find-organization-id) that the variable belongs to.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
Falls back to the organization in the [active context](../use/page.mdx), if set.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <id-or-handle>`, `--project <id-or-handle>`
</Table.Cell>
<Table.Cell>
The [ID or handle of the project](../projects/page.mdx#find-project-ids-and-handles) that the variable belongs to. Required when looking up by key.
</Table.Cell>
<Table.Cell>
Conditional
</Table.Cell>
<Table.Cell>
Falls back to the project in the [active context](../use/page.mdx), if set.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-e <handle>`, `--environment <handle>`
</Table.Cell>
<Table.Cell>
The [handle of the environment](../environments/page.mdx#find-environment-handles) that the variable belongs to. Required when looking up by key.
</Table.Cell>
<Table.Cell>
Conditional
</Table.Cell>
<Table.Cell>
Falls back to the environment in the [active context](../use/page.mdx), if set.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--reveal`
</Table.Cell>
<Table.Cell>
Print the secret value in plain text instead of masking it.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--json`
</Table.Cell>
<Table.Cell>
Print the result as JSON instead of formatted text.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>By default, the CLI masks values for variables marked as secrets. Pass --reveal to print the plaintext value:
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.
mcloud variables get DATABASE_URL --reveal
.env FileUse --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:
mcloud variables list --reveal --json \
| jq -r '.[] | "\(.key)=\(.value)"' \
> .env