Installation
The Kratos CLI is distributed as a single binary. You can install it using one of the following methods:Command structure
The Kratos CLI follows a hierarchical command structure:Main commands
serve- Run the Ory Kratos servermigrate- Database migration helpersget- Get resources (identities)list- List resources (identities)delete- Delete resources (identities)import- Import resources (identities)validate- Validate resources (identity files)cleanup- Cleanup helpers for database maintenancecourier- Message courier commandshashers- Password hashing helpersformat- Code formatting helpers (JSONNet)version- Display version information
Global flags
The following flags are available across multiple commands:Configuration flags
These flags are available for commands that interact with the Kratos configuration:--config- Path to the configuration file--config-dir- Directory containing configuration files
Client flags
These flags are available for commands that interact with the Kratos API:--endpoint,-e- The URL of Ory Kratos’ Admin API (can also be set viaKRATOS_ADMIN_URLenvironment variable)--format- Set the output format (json, yaml, json-pretty, or table)
Output flags
--format- Output format (json, yaml, json-pretty, jsonpath, table)--quiet,-q- Suppress output
Getting help
You can get help for any command by using the--help flag:
Environment variables
The CLI respects the following environment variables:Environment variables provide a convenient way to configure the CLI without passing flags every time.
KRATOS_ADMIN_URL
Sets the default endpoint for the Kratos Admin API. This is used by identity management commands.
DSN
Database connection string used by migration and cleanup commands.
Common workflows
Running the server
Managing identities
Database operations
Next steps
Serve command
Learn how to run the Kratos server with various configuration options
Identity commands
Manage identities using the CLI
Migrate command
Perform database migrations and schema updates
Configuration
Configure Ory Kratos