Magistrala
Dev GuideCLI

Users

Manage users in Magistrala using the CLI.

Users are Atom entities of kind human (cli/users.go) — the same generic entity type used for Devices, with the same create/get/update/delete/enable/disable shape. This command is for admin-created accounts and account maintenance; self-service sign-up, login, logout, and session refresh stay GraphQL-only (or go through magistrala-ui's sign-up/login pages) — see API § Users. All commands require --token from login.

Create a user

magistrala-cli users create <JSON_user> [workspace_id] --token <token>
magistrala-cli users create '{"name":"Jane Doe"}' --token $TOKEN

workspace_id is optional, unlike devices create — a user need not belong to a workspace (a self-registered account starts without one too).

createEntity has no password field, so a user created this way cannot log in until a password is set — see Set a password below.

List users

magistrala-cli users all get [workspace_id] --token <token>

Omit workspace_id to list across every workspace. Combine with --name to search:

magistrala-cli users all get --name "jane" --token $TOKEN

Get a user

magistrala-cli users <user_id> get --token <token>
{
  "id": "758050fd-...",
  "kind": "human",
  "name": "Jane Doe",
  "status": "active",
  "attributes": {}
}

Update a user

magistrala-cli users <user_id> update <JSON_string> --token <token>
magistrala-cli users 758050fd-... update '{"name":"Jane Doe-Smith"}' --token $TOKEN

update can change name and attributes. It cannot change email (set at sign-up) or password — see Set a password.

Enable / disable a user

magistrala-cli users <user_id> enable --token <token>
magistrala-cli users <user_id> disable --token <token>

These map to Atom's active/inactive entity status, not Magistrala's separate enabled/disabled vocabulary used elsewhere.

Set a password

magistrala-cli users <user_id> password set <new_password> --token <token>

Wraps the same createPassword mutation as the API reference's Set / Change Password — despite the name, it also handles replacing an existing password, since there is no separate "update password" mutation. Setting another user's password requires manage capability on them (or on their workspace).

Delete a user

magistrala-cli users <user_id> delete --token <token>

On this page