User Commands

The stategraph user command group provides user identity and tenant membership operations.

Commands

Command Description
stategraph user whoami Display current user information
stategraph user tenants list List tenants you belong to

stategraph user whoami

Display information about the currently authenticated user.

stategraph user whoami

Example

stategraph user whoami

Output (tab-separated):

id          550e8400-e29b-41d4-a716-446655440000
name        Jane Smith
email       jane@example.com
type        user
avatar_url  https://avatars.example.com/jane
auth_origin local
is_admin    false

This command is useful for: - Verifying your authentication is working - Checking which account you're logged in as - Getting your user ID for API calls

stategraph user tenants list

List all tenants that the current user is a member of.

stategraph user tenants list

Example

stategraph user tenants list

Output (tab-separated):

550e8400-e29b-41d4-a716-446655440000    production
660e8400-e29b-41d4-a716-446655440001    staging
770e8400-e29b-41d4-a716-446655440002    development

Columns: id, name

Scripting Examples

Get tenant ID by name

TENANT_ID=$(stategraph user tenants list | grep "production" | awk '{print $1}')
echo "Production tenant: $TENANT_ID"

Verify authentication in CI

#!/bin/bash
if ! stategraph user whoami > /dev/null 2>&1; then
  echo "Authentication failed. Check STATEGRAPH_API_KEY."
  exit 1
fi
echo "Authenticated successfully"

List all states across all tenants

stategraph user tenants list | while read id name; do
  echo "=== $name ==="
  stategraph states list --tenant "$id" | jq -r '.results[].name'
done

Next Steps