www/apps/cloud/app/cli/commands/whoami/page.mdx
import { Table, CodeTabs, CodeTab } from "docs-ui"
export const metadata = {
title: whoami Command - Medusa Cloud CLI Reference,
}
Show the authenticated user, the active organization, project, and environment, and CLI metadata. Use this command to verify which account and context the CLI is currently using.
mcloud whoami
Returns the following information:
<CodeTabs group="cli-output"> <CodeTab label="Plaintext" value="plaintext">CLI version: 1.0.0
Auth: jwt expires 2026-05-01 09:00
User: Alice Example <[email protected]> (eu_01ABC)
API URL: https://api.prod.medusajs.cloud
Dashboard URL: https://cloud.medusajs.com
Organization: My Organization (org_123)
Project: my-store (proj_01ABC)
Environment: production (projenv_01XYZ)
{
"cli_version": "1.0.0",
"auth": {
"kind": "jwt",
"expires_at": "2026-05-01T09:00:00.000Z"
},
"user": {
"id": "eu_01ABC",
"email": "[email protected]",
"first_name": "Alice",
"last_name": "Example"
},
"api_url": "https://api.prod.medusajs.cloud",
"dashboard_url": "https://cloud.medusajs.com",
"organization": {
"value": "org_123",
"id": "org_123",
"name": "My Organization"
},
"project": {
"value": "my-store",
"id": "proj_01ABC",
"handle": "my-store"
},
"environment": {
"value": "production",
"id": "projenv_01XYZ",
"handle": "production"
}
}
The Auth line shows whether the CLI is using a JWT (browser login) or an access key, and when the JWT expires (when applicable).
`--json`
</Table.Cell>
<Table.Cell>
Print the result as JSON instead of formatted text. Useful for piping the active context into scripts.
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>Pipe whoami --json into jq to assert that the CLI is authenticated and that the active context is set before running other commands:
mcloud whoami --json | jq -e '.auth.kind != "none" and .organization.id != null'
The command exits with a non-zero status if either condition is unmet, which is useful as a guard step in CI/CD pipelines.
To change the active organization, project, or environment, use mcloud use.
To switch accounts, use mcloud logout followed by mcloud login.