Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

exp:user JSON output and exit codes

The reference of the machine output of the exp:user commands: the schema exp-user/1, the keys every report has, the keys of each command, and the exit codes. Read it when a script, a CI job or a monitoring check reads…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/specifications/6.0/exp-user-json-output.md

On this page

exp:user JSON output and exit codes

The reference of the machine output of the exp:user commands: the schema exp-user/1, the keys every report has, the keys of each command, and the exit codes. Read it when a script, a CI job or a monitoring check reads the output of --format=json. For the tasks the commands serve, read User management from the console.

The contract

  • Every command takes --format=json (default text) and then prints exactly one JSON object on standard output, pretty-printed, with unescaped slashes and Unicode.
  • The schema is exp-user/1. Keys and options are a permanent contract: new keys and options may be added, none is ever renamed, removed or given another meaning. A reader must ignore keys it does not know.
  • A breaking change would need a new schema (exp-user/2); none is planned.
  • No report ever holds a password hash. A password appears only as generated_password, in the one run that generated it.
  • tests/tests/kernel/classes/user/expUserCommandContractTest.php compares the command names, options and arguments against a snapshot.

Exit codes

CodeNameMeaning
0donethe command did its work; a dry run that nothing refused
1failedthe account, group or role was not found, a check failed, the account is protected, an action was refused; exp:user:check-login: the password does not sign the account in
2usagea wrong option or value, --apply together with --dry-run, a missing argument
3unreachablethe database is not reachable
4internalan internal error

The codes are those of exp:upgrade. A usage error (2) is printed as a FAIL: line on standard error, also with --format=json; the other codes come with a JSON report.

Keys of every report

KeyTypeMeaning
schemastringexp-user/1
commandstringthe command, for example exp:user:disable
modestringwhat the report is about: the command's action (below), or find (the account was not found), actor (the user who acts was not found), unreachable (the database)
errorsstring[]why the command failed or refused; empty when it did not
warningsstring[]what did not stop the command, for example "the account is disabled already: nothing to do"
exitintthe exit code

Keys of the changing commands

The commands that change something (create, edit, delete, disable, enable, reset-password, approve, and the phase 2 commands below that take --apply) add:

KeyTypeMeaning
dry_runbooltrue without --apply
appliedbooltrue when the change was made
changesstring[]what is (or would be) changed, one line each
userobject or nullthe account after the change: id (int), login, email, name (strings), enabled (bool); the account before the change for delete and a rejected registration

Per command (phase 1)

CommandmodeExtra keys
exp:user:createcreateuser_id (int, the new account), generated_password (with --generate-password and --apply)
exp:user:editeditnone
exp:user:disabledisablerefusal, sessions_ended (int, with --apply)
exp:user:enableenablenone
exp:user:deletedeleterefusal
exp:user:reset-passwordreset-passwordreset (send-link, generate or stdin), mail_sent (bool, send-link), sessions_ended (int), generated_password (generate with --apply)
exp:user:approveapprove or rejectstate_before, state: the registration state before and after

refusal names why a protected account was refused: anonymous, creator, admin, self or last_administrator. The registration states are email, administrator, workflow (waiting), pending, active, disabled and missing.

Keys of the lists (phase 1)

exp:user:list (mode list) and exp:user:pending (mode pending):

KeyTypeMeaning
filtersobjectthe filters used: state, group, search, days, sort, order (pending: state, search)
totalinthow many accounts the filters select
offset, limitintthe page
accountsobject[]the accounts of the page

An entry of accounts:

KeyTypeMeaning
idintthe account's id (its content object id)
login, email, namestring
enabledbool
unactivatedbooldisabled with an activation key
has_keyboolhas an activation key
lockedboolmore failed sign-ins than MaxNumberOfFailedLogin
failed_attempts, login_countint
last_visitint or falseUnix time of the last visit; false when never
idle_daysint or falsedays since the last visit
objectstringpublished, draft or none
orphanedboolno object, never published, or no location
node_idintthe main node
groupsobject[]node_id, name of each group
rolesstring[]the names of the roles, its own and those of its groups
shared_login, shared_emailinthow many listed accounts share the login or address (1: none)
statesstring[]disabled or unactivated, locked, no_object, draft_only, no_location, never; active when none applies
registrationstringonly in pending: email, administrator or workflow

Keys of exp:user:show

mode show, and account:

KeyTypeMeaning
id, login, email, nameas in the list
classstringthe identifier of the user class
node_idintthe main node
objectstringpublished, draft or none
enabled, unactivated, lockedbool
max_loginintthe setting of the account
failed_attempts, login_countint
last_visitint or nullUnix time
password_changedint or nullUnix time of the last password change the audit knows
password_change_requiredboola new password is required at the next sign-in
registrationstringthe registration state
statesstring[]as in the list
groupsobject[]node_id, name, main (bool); the main group first
rolesobject[]role, role_id, via (the object id the role is assigned to), via_name, limitation ('', or for example Subtree:/1/2/, Section:3)
two_factorobject or nullactive (bool), method; null when two-step sign-in is not available
sessionsint or nullactive tracked sessions; null when not tracked
protectedstring'', or the reason as in refusal
administratorboolthe account has every right

Keys of the phase 2 commands

CommandKeys
exp:user:groupsgroups[]: node_id, name, parent_node_id, members, subgroups
exp:user:rolesassignments[]: role, role_id, via, via_name, limitation
exp:user:sessionssessions[]: id, method, device, browser, ip, last_active, current
exp:user:exportcount, output
exp:user:importrows[]: line, login, result, errors[]; created, skipped, refused
exp:user:bulkaction, matched, accounts[]: id, login, result, reason
exp:user:audittotal, rows[]: time, event, result, actor_login, target_login, siteaccess
exp:user:hygienecounts: an object { state: number }
exp:user:whoamiaccount, roles, administrator
exp:user:check-loginvalid (bool), reason

The result of an import row is would_create in a dry run and created with --apply; skipped (the login exists) and refused (with errors) are the same in both. exp:user:export writes the accounts themselves to --output or standard output. Without --output the data is the whole output: no report is printed and the exit code says whether it worked. With --output the command prints a report, as JSON with --format=json, holding count and output.

Example

{
    "schema": "exp-user/1",
    "command": "exp:user:delete",
    "mode": "delete",
    "dry_run": true,
    "user": { "id": 1234, "login": "jane", "email": "[email protected]", "name": "Jane Doe", "enabled": false },
    "changes": [],
    "applied": false,
    "errors": [ "the user who acts (--as) cannot do this to its own account" ],
    "warnings": [],
    "refusal": "self",
    "exit": 1
}

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x