Agent CLI commands
The following commands are available when interacting with the authentik Agent via the command line.
authentik-cli commands
The following flags can be used with any ak command:
| Flag | Description |
|---|---|
-p, --profile <name> | Use the specified profile instead of the active profile. |
-j, --json | Output JSON, for commands that support it, such as whoami. |
-s, --socket <path> | Connect to the authentik Agent on a different socket. |
-v, --verbose | Enable debug logging. |
-h, --help | Show help for a command. |
api
Directly interact with the authentik API, authenticated as the active profile's user.
ak api <command>
The subcommands are generated from the authentik API schema. Run ak api --help to list the ones available in your version. Responses are printed as JSON.
To send requests with an API token instead of the profile's token, pass --api-token <token> before the subcommand, or set the AK_CLI_TOKEN environment variable. The authentik URL still comes from the profile, so the profile must exist.
auth
Commands for authenticating with different CLI applications.
ak auth <command>
aws- Authenticate to AWS with the authentik profile.aws-eks- Authenticate to Amazon EKS with the authentik profile.claude- Authenticate to Claude Code with the authentik profile.kubectl- Authenticate to a Kubernetes cluster with the authentik profile.raw- Authenticate to arbitrary API calls.vault- Run the HashiCorp Vault or OpenBao CLI with a token from the authentik profile.
completion
Generate the autocompletion script for the specified shell.
ak completion <shell>
Where <shell> is bash, elvish, fish, powershell, or zsh.
config
Configure authentik CLI
ak config <command>
-
list-profiles- List the profiles on the device, with their user, authentik URL, token renewal times, and whether they're key-bound (DPoP bound). -
delete-profile <profile>- Delete a profile. -
setup- Add a profile by logging in to authentik. Options:-a,--authentik-url <url>(required): the URL of your authentik deployment.-i,--client-id <id>: the client ID of the OAuth2 provider. Defaults toauthentik-cli.-d,--app-slug <slug>: the slug of the application. Defaults toauthentik-cli.
Use the global
-pflag to name the profile, for exampleak -p work config setup -a https://authentik.company. Without-p,setupreplaces the active profile.
help
Output help information about any command.
ak help <command>
Where <command> is any authentik CLI command you want help with, for example: ak help whoami
mcp
Run the authentik Agent MCP server over standard input and output, for use by AI clients.
ak mcp
--allow-dangerous-api adds a tool that calls the authentik API with your own permissions. Refer to Security considerations.
switch-profile
Switch to a different active profile. Can be shortened to ak s.
ak switch-profile <profile>
Where <profile> is the name of a profile reported by ak config list-profiles. Without <profile>, the command prints the active profile.
version
Shows the version of all installed authentik components.
ak version
The output shows the version of the CLI, the user agent, and the system agent, and the version of the authentik server that each agent is connected to:
authentik Agent CLI: <version>
Agent: <version> (Server <authentik version>)
System: <version> (Server <authentik version>)
whoami
Check user account details for a given profile.
ak whoami
authentik-sysd commands
The following flags can be used with any ak-sysd command, before the command name:
| Flag | Description |
|---|---|
-c, --config <path> | Use a different configuration file. Only ak-sysd agent reads it. |
-d | Enable debug logging, for example ak-sysd -d agent. |
-V, --version | Show the version of ak-sysd. |
-h, --help | Show help for a command. |
agent
Run the authentik system agent. The system agent is normally run by the operating system's service manager.
ak-sysd agent
completion
Generate the autocompletion script for the specified shell.
ak-sysd completion <shell>
Where <shell> is bash, elvish, fish, powershell, or zsh.
domains
ak-sysd domains <command>
join- Join an authentik domain, for exampleak-sysd domains join <name_for_authentik_domain> -a <authentik_URL>. The command prompts for the enrollment token, or reads it from theAK_SYS_INSECURE_ENV_TOKENenvironment variable.list- List the domains that the device has joined, and which one is active.
help
ak-sysd help <command>
Where <command> is any authentik CLI command you want help with, for example: ak-sysd help domains
troubleshoot
ak-sysd troubleshoot <command>
check- Check the NSS and PAM configuration and whether the system agent is reachable. Useful on Linux as there are various components being used.inspect- Outputs the state database that the agent has.facts- Outputs device facts. These are the facts that are sent to authentik for device reporting.
version
Shows the version of the ak-sysd command and of the running system agent. The command fails if the system agent isn't running. To show the versions of all components, use ak version.
ak-sysd version