Skip to main content

CLI reference

The identsphere binary handles the operational tasks that sit outside the HTTP API: migrations, data export, first-admin provisioning, and a preflight health check. Every command takes its Postgres connection from --database-url (or the DATABASE_URL env var) and its schema from --schema (or IDENTSPHERE_SCHEMA, default identsphere).

identsphere <command> [options]

Commands:
migrate Run database migrations (up / down / status)
export Export SDK-owned tables for portability or backup
admin Platform-admin provisioning (grant roles)
doctor Preflight + health check

identsphere migrate

Apply, roll back, or inspect schema migrations.

# Apply all pending migrations
identsphere migrate up --database-url postgres://… --schema identsphere

# Roll back the most recently applied migration
identsphere migrate down --database-url postgres://…

# Print which migrations have been applied
identsphere migrate status --database-url postgres://…
SubcommandEffect
upApply all pending migrations.
downRoll back the most recently applied migration.
statusPrint applied vs. pending migrations.
OptionEnvDefault
--database-urlDATABASE_URL(required)
--schemaIDENTSPHERE_SCHEMAidentsphere

::: tip Auto-migrate Setting IDENTSPHERE_AUTO_MIGRATE=true runs migrate up on server boot, so a single-container deployment never needs a separate migration step. Migrations are idempotent. :::


identsphere export

Dump SDK-owned tables in a portable format — for backups or migrating off the SDK. Sensitive columns (password_hash, mfa_secret, refresh_token_hash, token_hash) are omitted by default.

identsphere export \
--database-url postgres://… \
--format jsonl \
--output ./export
OptionEnvDefaultNotes
--database-urlDATABASE_URL(required)
--schemaIDENTSPHERE_SCHEMAidentsphere
--formatjsonljsonl, csv, or pgdump.
--output(required)Output directory; one file per table is written here.
--include-secretsfalseInclude sensitive columns. Opt in explicitly.
--tablesallComma-separated allowlist of tables to export.

::: warning --include-secrets writes password hashes and MFA secrets to disk in plaintext files. Use only for a trusted, encrypted destination, and delete the output when done. :::


identsphere admin grant

Grant a platform-admin role to an already-registered user, by email. This is the explicit, scriptable path for bootstrapping the first owner (preferred over the IDENTSPHERE_INITIAL_OWNER_EMAIL env bootstrap).

identsphere admin grant owner@example.com --role account_owner \
--database-url postgres://…
Argument / optionEnvDefaultNotes
<email>(required)The user to promote. They must have registered first.
--roleaccount_ownerOne of account_owner, admin, viewer.
--database-urlDATABASE_URL(required)
--schemaIDENTSPHERE_SCHEMAidentsphere

The roles map to the platform RBAC hierarchy used by the admin endpoints: viewer < admin < account_owner.


identsphere doctor

A preflight / health check for a self-hosted install. Verifies required secrets, database connectivity, applied migrations, whether a platform owner exists, and provider-config status. Exits non-zero when a hard requirement is missing — suitable as a container HEALTHCHECK or CI gate.

identsphere doctor --database-url postgres://…

What it checks:

CheckSeverityDetail
IDENTSPHERE_JWT_SECRET sethardRequired to sign tokens.
IDENTSPHERE_PUBLIC_BASE_URL sethardRequired for OAuth callbacks + email links.
Database connectionhardExits 1 immediately if unreachable.
Migrations appliedhardPrompts identsphere migrate up if not.
Platform owner existswarningPrompts IDENTSPHERE_INITIAL_OWNER_EMAIL or admin grant.
IDENTSPHERE_CONFIG_KEY setinfoWhether dashboard-managed secrets are enabled; lists enabled providers.
OptionEnvDefault
--database-urlDATABASE_URL(required)
--schemaIDENTSPHERE_SCHEMAidentsphere

See Operations for how doctor fits into a deploy.