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.

Terminal
mcloud whoami

Returns the following information:

The Auth line shows whether the CLI is using a JWT (browser login) or an access key, and when the JWT expires (when applicable).

Options#

OptionDescriptionDefault

--json

Print the result as JSON instead of formatted text. Useful for piping the active context into scripts.

false


Verify Authentication in a Script#

Pipe whoami --json into jq to assert that the CLI is authenticated and that the active context is set before running other commands:

Terminal
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.


Switch the Active Context#

To change the active organization, project, or environment, use mcloud use.

To switch accounts, use mcloud logout followed by mcloud login.

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