Back to Medusa

{metadata.title}

www/apps/resources/app/medusa-cli/commands/user/page.mdx

2.14.22.4 KB
Original Source

import { Table } from "docs-ui"

export const metadata = { title: user Command - Medusa CLI Reference, }

{metadata.title}

Create a new admin user.

bash
npx medusa user --email <email> [--password <password>]

Options

<Table> <Table.Header> <Table.Row> <Table.HeaderCell>Option</Table.HeaderCell> <Table.HeaderCell>Description</Table.HeaderCell> <Table.HeaderCell>Required</Table.HeaderCell> <Table.HeaderCell>Default</Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> <Table.Row> <Table.Cell>
  `-e <email>`, `--email <email>`
  
  </Table.Cell>
  <Table.Cell>

  The user's email.
  
  </Table.Cell>
  <Table.Cell>

  Yes

  </Table.Cell>
  <Table.Cell>

  \-

  </Table.Cell>
</Table.Row>
<Table.Row>
  <Table.Cell>
  
  `-p <password>`, `--password <password>`
  
  </Table.Cell>
  <Table.Cell>

  The user's password.
  
  </Table.Cell>
  <Table.Cell>

  No

  </Table.Cell>
  <Table.Cell>

  \-

  </Table.Cell>
</Table.Row>
<Table.Row>
  <Table.Cell>
  
  `-i <id>`, `--id <id>`
  
  </Table.Cell>
  <Table.Cell>

  The user's ID.
  
  </Table.Cell>
  <Table.Cell>

  No

  </Table.Cell>
  <Table.Cell>

  An automatically generated ID is used.

  </Table.Cell>
</Table.Row>
<Table.Row>
  <Table.Cell>
  
  `--invite`
  
  </Table.Cell>
  <Table.Cell>

  Whether to create a user invite instead of directly creating a user. Learn more in the [Create User Invite](#create-user-invite-with-medusa-cli) section.

  </Table.Cell>
  <Table.Cell>

  No

  </Table.Cell>
  <Table.Cell>

  `false`

  </Table.Cell>
</Table.Row>

</Table.Body>

</Table>

Create User Invite with Medusa CLI

The user command accepts the --invite option to create a user invite. The user must accept the invite before they can log into the Medusa Admin.

For example:

bash
npx medusa user --email [email protected] --invite

The command will create a user invite and output the invite token. You can then either:

  • Accept the invite in the Medusa Admin at the path /app/invite?token=<invite_token>
  • Accept the invite using the Accept Invite API route.