# CLI: Accounts, projects and access
Source: https://sovaria.in/docs/cli-auth-and-projects

Sign in, pick the organization and project commands act on, manage team members, roles, app users, auth settings, SCIM provisioning, blocking auth hooks and API keys with sov.

Pick a project:
```bash
sov login
sov orgs
sov projects <org-id>
sov scope pick
sov whoami
```

## sov context

Context and identity commands

### sov context whoami
`sov context whoami [OPTIONS]`
Print the authenticated user, active scope, and accessible orgs/projects.

### sov context list
`sov context list [OPTIONS]`
List organisations and projects you can use with the CLI.

### sov context orgs
`sov context orgs [OPTIONS]`
List organisations visible to the authenticated user.

### sov context projects
`sov context projects [OPTIONS] [ORG_ID]`
List projects under an organisation.

### sov context pick
`sov context pick [OPTIONS]`
Interactively pick default org/project scope by index.

### sov context context
`sov context context [OPTIONS] RESOURCE_ID`
Show access roles the current user has on a specific resource.

## sov scope

Manage default org/project/env scope

### sov scope show
`sov scope show [OPTIONS]`
Show currently configured default scope.

### sov scope set
`sov scope set [OPTIONS] ORG_ID PROJECT_ID`
Persist default scope for future CLI calls.

### sov scope clear
`sov scope clear [OPTIONS]`
Clear default scope for the active profile.

### sov scope list
`sov scope list [OPTIONS]`
List organisations and projects available to your account.

### sov scope pick
`sov scope pick [OPTIONS]`
Pick default org/project interactively by index.

## sov org

Organisation management

### sov org create
`sov org create [OPTIONS] NAME`
Create a new organisation (or PROJECT/ENV) node in the identity graph.
Example: sov org create "Skolist" sov org create "Payments" --type PROJECT --metadata '{"env": "prod"}'

### sov org member-add
`sov org member-add [OPTIONS] ORG_ID USER_ID`
Add a user as a member of an organisation (creates a MEMBER_OF edge).
Example: sov org member-add <org_id> <user_id> sov org member-add <org_id> <user_id> --role ADMIN

### sov org key status
`sov org key status [OPTIONS]`
The key, whether it works and what it covers.

### sov org key set
`sov org key set [OPTIONS] KEY_ARN`
Use your AWS KMS key for storage files and backups (add the key policy statement first: --policy on status).

### sov org key rotate
`sov org key rotate [OPTIONS]`
A new data key version under the same KMS key (older versions keep decrypting old backups).

### sov org key check
`sov org key check [OPTIONS]`
Ask your KMS now whether Sovaria can still use the key; exit 1 if it can't.

### sov org key reencrypt
`sov org key reencrypt [OPTIONS]`
Rewrite the organization's existing storage files under its key (runs in the background).

## sov iam

Organisations, members, and project settings

### sov iam orgs
`sov iam orgs [OPTIONS]`
List organisations visible to the authenticated user.

### sov iam org
`sov iam org [OPTIONS] ORG_ID`
Fetch one organisation by ID.

### sov iam projects
`sov iam projects [OPTIONS] [ORG_ID]`
List child projects under an organisation.

### sov iam members
`sov iam members [OPTIONS] [ORG_ID]`
List organisation members.

### sov iam member-add
`sov iam member-add [OPTIONS] ORG_ID USER_ID`
Add a member to an organisation.

### sov iam settings-get
`sov iam settings-get [OPTIONS]`
Fetch project settings for the linked scope.

### sov iam settings-set
`sov iam settings-set [OPTIONS] SETTINGS_JSON`
Update project settings (keys you pass are merged; the rest stay as they are).
Example: sov iam settings-set '{"apiRateLimitPerUserPerMinute": 120}' Per-resource rate limits (paid plans): sov iam settings-set '{"resourceRateLimits": [{"resource": "table:orders", "perMinute": 100, "scope": "user"}]}' — resource is table:<name>, collection:<name> or fn:<name>; scope is project, user or ip.

### sov iam org-update
`sov iam org-update [OPTIONS] ORG_ID`
Update organisation name and/or admin settings.

### sov iam org-delete
`sov iam org-delete [OPTIONS] ORG_ID`
Delete an organisation (async teardown).

### sov iam org-set-plan
`sov iam org-set-plan [OPTIONS] ORG_ID`
Set an organisation billing plan.

### sov iam member-remove
`sov iam member-remove [OPTIONS] ORG_ID USER_ID`
Remove a member from an organisation.

### sov iam member-update
`sov iam member-update [OPTIONS] ORG_ID USER_ID`
Update a member's organisation role.

### sov iam invite-create
`sov iam invite-create [OPTIONS] ORG_ID`
Create or refresh an organisation invite.

### sov iam invite-accept
`sov iam invite-accept [OPTIONS] TOKEN`
Accept an organisation invite.

### sov iam edge-create
`sov iam edge-create [OPTIONS]`
Create a directed edge in the identity graph.

### sov iam roles-catalog
`sov iam roles-catalog [OPTIONS]`
Fetch the project roles catalog.

### sov iam project-ref
`sov iam project-ref [OPTIONS] PROJECT_ID`
Fetch the public project ref slug.

### sov iam roles-matrix get
`sov iam roles-matrix get [OPTIONS]`
Fetch the project role permission matrix.

### sov iam roles-matrix set
`sov iam roles-matrix set [OPTIONS] MATRIX_JSON`
Replace the project role permission matrix.

### sov iam roles-matrix add
`sov iam roles-matrix add [OPTIONS] NAME`
Add an app role (row rules test it with auth.has_role('manager')), keeping every other role.

### sov iam roles-matrix remove
`sov iam roles-matrix remove [OPTIONS] NAME`
Remove one app role, keeping the others.

## sov auth

Authentication commands

### sov auth login
`sov auth login [OPTIONS]`
Authenticate with Sovaria.
By default opens a browser (PKCE flow). Pass --email to use password login (prompt or SOVARIA_PASSWORD).

### sov auth logout
`sov auth logout [OPTIONS]`
Revoke the session for one profile, then clear that profile's local credentials.

### sov auth mfa-verify
`sov auth mfa-verify [OPTIONS]`
Complete MFA after login when the gateway returned mfa_required=true.

### sov auth sessions
`sov auth sessions [OPTIONS]`
List active login sessions for the current user.

### sov auth sessions-revoke
`sov auth sessions-revoke [OPTIONS] SESSION_ID`
Revoke one active session.

### sov auth sessions-revoke-others
`sov auth sessions-revoke-others [OPTIONS]`
Revoke all sessions except the current one.

### sov auth mfa-status
`sov auth mfa-status [OPTIONS]`
Show MFA enrollment status for the current user.

### sov auth mfa-enroll
`sov auth mfa-enroll [OPTIONS]`
Start TOTP MFA enrollment (shows secret, URI, and backup codes once).

### sov auth mfa-disable
`sov auth mfa-disable [OPTIONS]`
Disable MFA (requires current TOTP code).

### sov auth project-login
`sov auth project-login [OPTIONS]`
Authenticate against the strict project login lane.

### sov auth magic-link send
`sov auth magic-link send [OPTIONS]`
Send a magic-link sign-in email.

### sov auth magic-link verify
`sov auth magic-link verify [OPTIONS]`
Exchange a magic-link token for a session.
Read the token from stdin or SOVARIA_MAGIC_TOKEN (never a CLI flag).

### sov auth verify-email send
`sov auth verify-email send [OPTIONS]`
Send a verification email to the authenticated user.

### sov auth verify-email confirm
`sov auth verify-email confirm [OPTIONS]`
Confirm an email address using a verification token.
Read the token from stdin or SOVARIA_VERIFY_EMAIL_TOKEN (never a CLI flag).

### sov auth sessions-config get
`sov auth sessions-config get [OPTIONS]`
Fetch the authenticated user's session policy.

### sov auth sessions-config set
`sov auth sessions-config set [OPTIONS] CONFIG_JSON`
Update the authenticated user's session policy.

### sov auth providers-config get
`sov auth providers-config get [OPTIONS]`
Fetch auth provider runtime configuration (project team members).

### sov auth providers-config set
`sov auth providers-config set [OPTIONS] CONFIG_JSON`
Update auth provider toggles and external database link configuration (owners and admins).

### sov auth event-hooks list
`sov auth event-hooks list [OPTIONS]`
List auth event hooks for the active project (owners and admins only).

### sov auth event-hooks create
`sov auth event-hooks create [OPTIONS]`
Create an auth event hook subscription (owners and admins of the project only).

### sov auth event-hooks delete
`sov auth event-hooks delete [OPTIONS] HOOK_ID`
Delete an auth event hook (owners and admins only).

### sov auth github-state get
`sov auth github-state get [OPTIONS]`
Fetch GitHub OAuth connection state.

### sov auth github-state disconnect
`sov auth github-state disconnect [OPTIONS]`
Disconnect GitHub OAuth broker state.

### sov auth passkeys list
`sov auth passkeys list [OPTIONS]`
List passkeys registered for the current user.

### sov auth passkeys revoke
`sov auth passkeys revoke [OPTIONS] PASSKEY_ID`
Revoke a registered passkey.

### sov auth passkeys register-hint
`sov auth passkeys register-hint`
Explain how to register a passkey (browser WebAuthn required).

### sov auth oidc list
`sov auth oidc list [OPTIONS]`
List OIDC providers configured for the linked project.

### sov auth oidc create
`sov auth oidc create [OPTIONS] CONFIG`
Register an OIDC provider for the linked project.

### sov auth oidc example
`sov auth oidc example [OPTIONS]`
Print a starter OIDC provider config (Google-style example).

### sov auth oidc delete
`sov auth oidc delete [OPTIONS] PROVIDER_ID`
Remove an OIDC provider.

### sov auth oidc login-url
`sov auth oidc login-url [OPTIONS] PROVIDER_ID`
Get the OIDC authorization URL to start SSO in a browser.

## sov auth-product

Product auth admin commands

### sov auth-product users
`sov auth-product users [OPTIONS]`
One page of app users (newest first).
Search and status filter on the server.

### sov auth-product ban
`sov auth-product ban [OPTIONS] USER_ID`
Toggle a product user's active state in scope.

### sov auth-product delete
`sov auth-product delete [OPTIONS] USER_ID`
Delete a product user credential in scope.

### sov auth-product roles
`sov auth-product roles [OPTIONS] USER_ID`
Show a product user's app roles in scope.

### sov auth-product roles-set
`sov auth-product roles-set [OPTIONS] USER_ID ROLES`
Replace a product user's app roles in scope.

### sov auth-product roles-add
`sov auth-product roles-add [OPTIONS] USER_ID ROLES`
Give a product user roles.
They apply to the user's requests within 20 seconds (usually at once); the user stays signed in.

### sov auth-product roles-remove
`sov auth-product roles-remove [OPTIONS] USER_ID ROLES`
Take roles away from a product user.
The change applies to their requests within 20 seconds (usually at once), even on the token they already have.

### sov auth-product update
`sov auth-product update [OPTIONS] USER_ID`
Set an app user's app_metadata, user_metadata, custom claims or email_verified (null in JSON removes a key).

### sov auth-product create
`sov auth-product create [OPTIONS]`
Create a product user in the current project scope.

### sov auth-product link
`sov auth-product link [OPTIONS]`
The link a sign-in, recovery, invite or signup email would carry, printed instead of sent (supabase's auth.admin.generateLink).
Org owners and admins only; audited and limited to 60 an hour.

The link signs that user in (or confirms their address): treat the output as a secret.

### sov auth-product export
`sov auth-product export [OPTIONS] OUTPUT`
Every app user to a JSON or CSV file, like `firebase auth:export` (all pages, newest first).
Profile fields only: password hashes, tokens and MFA secrets never leave the server. To move users with their passwords between projects, use `sov import` from the source system.

## sov auth-config

Project Authentication settings

### sov auth-config get
`sov auth-config get [OPTIONS]`
The project's Authentication settings (and which plan-gated ones the plan includes).

### sov auth-config set
`sov auth-config set [OPTIONS] SECTION VALUES`
Change fields of one section, e.g.
`sov auth-config set sms blockedCallingCodes='["+882"]'`.

## sov auth-keys

Project JWT signing keys (standby, rotate, revoke)

### sov auth-keys list
`sov auth-keys list [OPTIONS]`
Signing keys: kid, status (standby, active, retired, revoked) and public JWK.

### sov auth-keys standby
`sov auth-keys standby [OPTIONS]`
Publish the next key in the JWKS now (rotate once verifiers' caches have it).

### sov auth-keys rotate
`sov auth-keys rotate [OPTIONS]`
New tokens are signed with the standby (or a new) key; the old one verifies for 24 hours.

### sov auth-keys revoke
`sov auth-keys revoke [OPTIONS] KID`
Remove a standby or retired key from the JWKS now: tokens it signed stop verifying.

## sov auth-third-party

Accept Firebase/Auth0/Clerk/Cognito/OIDC tokens

### sov auth-third-party list
`sov auth-third-party list [OPTIONS]`
`sov auth-third-party list`.

### sov auth-third-party add
`sov auth-third-party add [OPTIONS] KIND`
Trust an issuer; the app then calls signInWithThirdPartyToken(token).

### sov auth-third-party remove
`sov auth-third-party remove [OPTIONS] PROVIDER_ID`
`sov auth-third-party remove`.

## sov auth-orgs

Your app users' organizations

### sov auth-orgs list
`sov auth-orgs list [OPTIONS]`
Organizations, member counts and the plan limit (auth.tenant_orgs).

### sov auth-orgs delete
`sov auth-orgs delete [OPTIONS] APP_ORG_ID`
`sov auth-orgs delete`.

## sov sms

SMS provider and country rules for auth texts

### sov sms provider
`sov sms provider [OPTIONS] PROVIDER`
Pick the project's SMS provider (the secret is read from stdin, never an argument).

### sov sms countries
`sov sms countries [OPTIONS]`
Where auth texts may go (stops SMS pumping), e.g.
`--allow +91` or `--block +882 --block +881`.

## sov attest

App attestation: mode, services, reCAPTCHA, debug tokens

### sov attest show
`sov attest show [OPTIONS]`
`sov attest show`.

### sov attest mode
`sov attest mode [OPTIONS] MODE`
Go monitor first; enforce refuses every request (sign-in included) from unattested builds.

### sov attest services
`sov attest services [OPTIONS] VALUES`
Which traffic enforce/monitor covers.

### sov attest recaptcha
`sov attest recaptcha [OPTIONS]`
Web apps attest with reCAPTCHA v3 / Enterprise (recaptchaAttestation() in @sovaria/sdk).

### sov attest debug-token create
`sov attest debug-token create [OPTIONS] NAME`
A debug token for simulators and CI (shown once; it expires).

### sov attest debug-token delete
`sov attest debug-token delete [OPTIONS] TOKEN_ID`
Delete a debug token: the attestation tokens it minted stop working too.

## sov saml

SAML single sign-on for your app's users

### sov saml list
`sov saml list [OPTIONS]`
The project's SAML connections, with the ACS URL and entity ID to give each IdP admin.

### sov saml add
`sov saml add [OPTIONS] NAME`
Connect a customer's identity provider (metadata XML, or entity ID + sign-in URL + certificate).

### sov saml enable
`sov saml enable [OPTIONS] CONNECTION_ID`
Turn a connection on.

### sov saml disable
`sov saml disable [OPTIONS] CONNECTION_ID`
Turn a connection off (its users keep their accounts).

### sov saml remove
`sov saml remove [OPTIONS] CONNECTION_ID`
Remove a connection: its domains can no longer sign in with SSO (accounts stay).

## sov sso-domain

Organization SSO domain verification

### sov sso-domain verify
`sov sso-domain verify [OPTIONS] DOMAIN`
Check `_sovaria-verification.<domain>` now (organization owner).

## sov scim

SCIM 2.0 provisioning of app users and groups

### sov scim status
`sov scim status [OPTIONS]`
Whether SCIM is on, the base URL for the identity provider, the token's prefix and last use, counts.

### sov scim token
`sov scim token [OPTIONS]`
Turn SCIM on, or rotate its token.
The token is printed once: paste it into the identity provider.

### sov scim revoke
`sov scim revoke [OPTIONS]`
Turn SCIM off: the token stops working (provisioned users and groups stay).

## sov auth-hooks

Auth hooks (before-create/-sign-in, verification attempts, email/SMS senders)

### sov auth-hooks list
`sov auth-hooks list [OPTIONS]`
Both blocking hooks (no secrets), whether the plan includes them and the staff switch.

### sov auth-hooks set
`sov auth-hooks set [OPTIONS] EVENT`
Point a hook at a webhook or function.
A new signing secret is printed once.

### sov auth-hooks test
`sov auth-hooks test [OPTIONS] EVENT`
Send a sample event and show the decision (allowed, claims, message, failed, error, latency).

### sov auth-hooks delete
`sov auth-hooks delete [OPTIONS] EVENT`
Remove a hook: sign-ups or sign-ins stop waiting for it.

## sov keys

Project API keys

### sov keys list
`sov keys list [OPTIONS]`
List API keys for the current project.

### sov keys create
`sov keys create [OPTIONS]`
Create a custom project API key.
The secret is shown once.

The anon and service role keys are built in (`sov keys ensure-defaults`); a custom key gets the role you choose. Row-level security treats every custom key as `anon`.

### sov keys ensure-defaults
`sov keys ensure-defaults [OPTIONS]`
Bootstrap default anon + service_role keys if missing.

### sov keys revoke
`sov keys revoke [OPTIONS] KEY_ID`
Revoke an API key.

## sov project

Project scaffold commands

### sov project init-config
`sov project init-config [OPTIONS] [NAME]`
Create a template sovaria.config.json file.

### sov project create
`sov project create [OPTIONS]`
Create a project from sovaria.config.json.

### sov project status
`sov project status`
Show local sovaria.config.json linkage and resolved scope.

### sov project link
`sov project link [OPTIONS]`
Write org/project scope into sovaria.config.json and the active profile.

### sov project use
`sov project use [OPTIONS] ORG_ID PROJECT_ID`
Set default scope for CLI commands (profile only, no config file write).

### sov project export
`sov project export [OPTIONS]`
Export the full project data plane (Postgres dump + migration metadata).
Bundle includes postgres.sql.gz (all schemas), manifest.json, storage-metadata.json, and RESTORE.md. Storage file contents are not included — use `sov storage download`. Sovaria keeps each export encrypted for 7 days, then deletes it; download it before then.
