Skip to content

Scripting

ActionXM CLI is designed to be scriptable with consistent exit codes and parseable output.

Exit codes

CodeMeaning
0Success
1General error (API error, not found, etc.)
2Usage error (invalid arguments)

Shell scripting examples

Check if authenticated

bash
if actionxm auth status > /dev/null 2>&1; then
  echo "Authenticated"
else
  echo "Not authenticated"
fi

List sites and select by name

bash
# Select a site by name
actionxm sites select "Acme Store"

Conditional login

bash
# Login only if not already authenticated
actionxm auth status > /dev/null 2>&1 || actionxm auth login

Environment-based configuration

bash
# Use a different API for staging
ACTIONXM_API_URL=https://staging.action-xm.com actionxm config set api_url https://staging.action-xm.com
actionxm auth login

ActionXM Analytics Platform