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

For developers: scripts and CI

Use the exp:user commands in scripts, deploys and CI - the exp-user/1 JSON output, the exit codes, passwords from CI secrets on standard input, idempotent provisioning, and jq examples for checks and reports.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/user-management-from-the-console/for-developers-scripts-and-ci.md

On this page

For developers: scripts and CI

Every command takes --format=json and ends with a dependable exit code. Options and keys are a permanent contract: new ones may be added, none is renamed or removed.

What you'll have at the end

Scripts that create, check and report accounts without screen-scraping and without a password on a command line.

The output

--format=json prints one JSON object with the schema exp-user/1:

{
    "schema": "exp-user/1",
    "command": "exp:user:disable",
    "mode": "disable",
    "dry_run": true,
    "user": { "id": 1234, "login": "jane", "email": "[email protected]", "name": "Jane Doe", "enabled": true },
    "changes": [ "disable the account jane and end its sessions" ],
    "applied": false,
    "errors": [],
    "warnings": [],
    "exit": 0
}

Every key, per command: exp:user JSON output.

Exit codeMeaning
0done, or a dry run that nothing refused
1failed or refused
2usage: a wrong option or value
3the database is not reachable
4internal error

Examples

Fail a deploy when a service account is missing or disabled:

./console exp:user:show ci-bot --format=json | jq -e '.account.enabled' > /dev/null

Create a service account once, with its password from a CI secret:

if ! ./console exp:user:show ci-bot --format=json > /dev/null; then
    printf '%s\n' "$CI_BOT_PASSWORD" | ./console exp:user:create --login=ci-bot --email[email protected] \
        --group=Editors --password-stdin --apply --format=json
fi

Check that the password still works, without counting a failed sign-in:

printf '%s\n' "$CI_BOT_PASSWORD" | ./console exp:user:check-login ci-bot --password-stdin --format=json \
    | jq -r '.valid, .reason'

Report the accounts that wait, as id and login:

./console exp:user:pending --format=json --limit=500 | jq -r '.accounts[] | "\(.id) \(.login)"'

Count the accounts per state for a dashboard:

./console exp:user:hygiene --format=json | jq '.counts'

Stop a pipeline when a dry run would refuse something:

./console exp:user:bulk disable --state=inactive --days=730 --format=json > var/tmp/plan.json || exit 1
jq -r '.matched' var/tmp/plan.json

Rules for scripts

  • Run the dry run first and check errors before you run with --apply.
  • Pass a password only on standard input (--password-stdin). Never put it in a variable that is printed.
  • generated_password is in the output of the run that set it, and never again. Store it at once, or do not generate one.
  • --as=<service account> makes the audit name the automation, not the UserCreatorID user.
  • Add --siteaccess=<siteaccess> when the links in mails must point at a particular site.

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