Skip to content

auth Command

The CLI authenticates with API keys. Each key belongs to one organization, so the CLI stores one key per organization in credentials.json in its config directory.

Key selection for every command:

  1. PAKYAS_API_KEY, unless --ignore-env is passed
  2. The stored key for the active organization
  3. A stored legacy key (not tied to an organization, from older CLI versions)
Terminal window
pakyas login [--api-key <KEY>] [--no-browser]
FlagDescription
--api-key <KEY>Store this key instead of opening the browser
--no-browserLog in with email and password in the terminal; the CLI creates a read,write key for your first organization
Terminal window
# Browser login (default): pick an organization in the browser
pakyas login
# Existing key
pakyas login --api-key pk_live_...
# Email and password
pakyas login --no-browser

After login the CLI prints the organization, the default project (the first project of the organization), and the key prefix. login --api-key stores the key under the organization it belongs to; it only changes the active organization if none is set yet.

Terminal window
pakyas logout

Deletes credentials.json, which removes all stored keys for every organization. config.toml (active organization, default project) is kept. PAKYAS_API_KEY is not affected, so commands keep working if it is set. To remove the key of a single organization, use auth key rm.

Terminal window
pakyas whoami

Shows the organization, default project, and the API key that commands will actually use, with its source:

Organization: Acme Corp
Default project: Production
API Key: pk_live_a1b2... (stored (organization))

The source is PAKYAS_API_KEY, stored (organization), or stored (legacy). If --org points to an organization other than the saved one, the line reads Organization ID: <id>.

With --format json:

{
"api_key_prefix": "pk_live_a1b2...",
"api_key_source": "stored (organization)",
"default_project_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"default_project_name": "Production",
"organization_id": "3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74",
"organization_name": "Acme Corp"
}

When no API key is available, whoami exits 5 with Not logged in. Run: pakyas login, so scripts can use it as an auth check:

Terminal window
pakyas whoami >/dev/null 2>&1 || echo "pakyas is not authenticated"

whoami only reads local state (plus one request to find the key’s organization if none is configured). It doesn’t validate the key; use auth key verify for that.

Terminal window
pakyas auth status

Shows the active organization and its stored key, the default project, all stored keys, and warnings:

Authentication Status
=====================
Active Organization:
Name: Acme Corp
ID: 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74
Key: pk_live_a1b2... (stored)
Label: build-box-2026-11-01
Last verified: 2026-11-07 09:12:44 UTC
Default Project:
Name: Production
ID: 7c9e6679-7425-40de-944b-e07fc1f90ae7
Stored Credentials:
2 organization(s) with stored keys
- 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74: pk_live_a1b2...
- a8d1e2f3-4b5c-4d6e-8f70-1a2b3c4d5e6f: pk_live_c3d4...

If PAKYAS_API_KEY is set, the output starts with a warning that it overrides the stored credentials. If the active organization has no stored key, or a legacy key is present, auth status says so and suggests the command to fix it.

Terminal window
pakyas auth key list

Lists the keys stored on this machine:

Stored API Keys:
Organization: 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74
Key: pk_live_a1b2...
Label: build-box-2026-11-01
Added: 2026-11-01 08:30
Last verified: 2026-11-07 09:12
Organization: a8d1e2f3-4b5c-4d6e-8f70-1a2b3c4d5e6f
Key: pk_live_c3d4...
Label: build-box-2026-10-15
Added: 2026-10-15 14:02
Last verified: (never)

Keys are shown as their first 12 characters. The label is the host name and the date the key was stored.

Terminal window
pakyas auth key set --org <ORG> [--key <KEY>]
FlagDescription
--org <ORG>Organization ID or name to store the key for. Required.
--key <KEY>API key. Prompted for (hidden input) if omitted.

The key must start with pk_. The CLI checks it with the server and refuses to store it if it belongs to a different organization. The key is stored under the organization’s ID, even when you pass its name. (Names need CLI 0.1.10 or later.)

Terminal window
pakyas auth key set --org "Acme Corp"
pakyas auth key set --org a8d1e2f3-4b5c-4d6e-8f70-1a2b3c4d5e6f --key pk_live_...
Terminal window
pakyas auth key verify [--org <ORG>]

Checks the stored key for the organization (ID or name; the active one by default) against the server and updates its last-verified time. Exits 5 if the server rejects the key, and 1 if no key is stored for the organization.

Terminal window
pakyas auth key rm (--org <ORG> | --legacy) [-y]
FlagDescription
--org <ORG>Remove the key stored for this organization (ID or name)
--legacyRemove the legacy key (not tied to an organization)
-y, --yesSkip the confirmation prompt

--org and --legacy are mutually exclusive; one is required.

Terminal window
pakyas auth key rm --org a8d1e2f3-4b5c-4d6e-8f70-1a2b3c4d5e6f -y
pakyas auth key rm --legacy