Skip to content
API Reference

Commands

Authenticate, manage credentials, configure the CLI, and run commands with Keycard.

The keycard CLI handles authentication, credential management, resource authorization, and secure agent sessions.

Sign in to your Keycard account. This opens a browser for the OIDC sign-in flow and stores tokens securely in your system keyring.

Terminal window
keycard auth signin --zone <zone-id>

Check your current identity:

Terminal window
keycard auth whoami --zone <zone-id>

Sign out and remove stored tokens:

Terminal window
keycard auth signout --zone <zone-id>

Authorize access to one or more resources. If you don’t have an active session, this command initiates sign-in automatically.

Terminal window
keycard auth resource <url> [url...] --zone <zone-id>

Use this when a tool reports that resource access requires authorization.

Run a command inside a Keycard secure session. The session provisions just-in-time credentials and enforces policy on tool use.

Terminal window
keycard run --zone <zone-id> -- <command>

Specify a custom environment template with the -t flag:

Terminal window
keycard run --zone <zone-id> -t .env.template -- <command>

Inside a secure session, the environment variables KEYCARD_RUN=1 and KEYCARD_RUN_SESSION_ID are set automatically.

Exchange a refresh token for an access token scoped to a resource URL:

Terminal window
keycard credential read <url> --zone <zone-id>

The CLI loads configuration from a keycard.toml file in the current directory by default. Override the path with --config or the CLI_CONFIG environment variable.

[zone]
id = "your-zone-id"
[run]
template_file = ".env.template"
CommandDescription
keycard runRun a command in a Keycard secure session
keycard auth signinAuthenticate with your account
keycard auth signoutRemove local authentication tokens
keycard auth whoamiIdentify the current account
keycard auth resourceAuthorize access to resources
keycard credential readRead a credential for a URL
keycard versionShow version info