Skip to main content

Basic functionality

To get a full list of commands available in Ory CLI, run this command:

ory help

This prints the list of available commands with short descriptions. Additionally, each commands accepts the --help flag. Use it to get more information about the command, available command-specific flags and command modifiers. For example:

ory auth --help
Create a new Ory Network account or sign in to an existing account.

Usage:
ory auth [flags]
ory auth [command]

Available Commands:
logout Signs you out of your account on this computer.

Flags:
-c, --config string Path to the Ory Network configuration file.
--format string Set the output format. One of table, json, yaml, json-pretty, jsonpath and jsonpointer. (default "default")
-h, --help help for auth
-q, --quiet Be quiet with output printing.
-y, --yes Confirm all dialogs with yes.

Use "ory auth [command] --help" for more information about a command.
tip

Visit the Reference section to view all commands, flags, and options available in the Ory CLI. This documentation is generated automatically from the CLI source code.

Authentication

The Ory CLI comes with multiple authentication mechanisms.

Browser login

You can authenticate using the ory auth command. The command opens a browser window where you can log in to your Ory account. After logging in, you can use the CLI to manage workspaces, projects, and project data.

info

In case you are interested, the Ory CLI uses the authorization code flow with Ory Hydra to authenticate you. Take a look at how it's implemented in the source code.

API key

In automated environments like CI/CD pipelines, you can authenticate using API keys. The Ory CLI supports both workspace and project API keys. Workspace API keys have permissions to manage project configs, while project API keys have permissions to manage project data. Depending on the use-case you might need to use one or both.

Set the API keys using the ORY_WORKSPACE_API_KEY and ORY_PROJECT_API_KEY environment variables:

export ORY_WORKSPACE_API_KEY=ory_wak_8dwW9s....
export ORY_PROJECT_API_KEY=ory_pt_Wse93s....

Set the working context

All commands support the --workspace and --project flags to specify the working context. Legacy projects without a workspace can be used by omitting the --workspace flag.
Alternatively, the project and workspace can be specified using the ORY_PROJECT and ORY_WORKSPACE environment variables.

It is also possible to set the default workspace and project using the ory use command:

ory use workspace $ORY_WORKSPACE
ory use project $ORY_PROJECT

Create a new workspace and project

Run this command to create a new workspace.

ory create workspace --name "My New Workspace"
# Example response

Workspace created successfully!
ID 885a2468-c23d-40df-a783-c941387a8701
NAME My New Workspace
SUBSCRIPTION PLAN <none>

Now export the workspace ID

export ORY_WORKSPACE=885a2468-c23d-40df-a783-c941387a8701

and run this command to create a new project.

ory create project --name "My New Project" --workspace $ORY_WORKSPACE
# Example response

Project created successfully!
ID b7d8a15d-a783-40e6-40df-7acd60cb2b64
NAME My New Project
ENVIRONMENT dev
WORKSPACE 885a2468-c23d-40df-a783-c941387a8701
SLUG peaceful-something-4iuafwx2vk
STATE running