Skip to content

CLI Configuration

This page covers everything that is shared across pakyas commands: global flags, environment variables, where state is stored, and exit codes.

When the same setting comes from several places, the CLI uses the first one it finds:

  1. Command-line flag (--org, --project, --format, …)
  2. Environment variable (PAKYAS_ORG, PAKYAS_PROJECT, PAKYAS_FORMAT, …)
  3. config.toml in the config directory
  4. Built-in default

Specific settings:

SettingResolution order
API keyPAKYAS_API_KEY (unless --ignore-env), then the stored key for the active organization, then a stored legacy key
Organization--org / PAKYAS_ORG, then the active organization saved by login or org switch, then the organization the API key belongs to (asked from the server via GET /api/v1/me)
Project--project / PAKYAS_PROJECT, then the default project saved by project default
Output format--format / PAKYAS_FORMAT, then format in config.toml, then table
ColorDisabled by --no-color, NO_COLOR, or color = false in config.toml
EndpointsAPI_URL / PING_URL, then api_url / ping_url in config.toml, then https://api.pakyas.com / https://ping.pakyas.com

Because the organization can be derived from the API key, a CI job that only sets PAKYAS_API_KEY can run pakyas ping <slug>, pakyas monitor <slug> -- ..., and pakyas check list without PAKYAS_ORG.

These flags work with every command and can go before or after the subcommand (pakyas --project infra check list and pakyas check list --project infra are the same).

FlagEnv varDefaultDescription
--org <ORG>PAKYAS_ORGsaved orgOrganization ID or name. An ID avoids an extra lookup.
--project <PROJECT>PAKYAS_PROJECTdefault projectProject ID, slug, or name.
--format <FORMAT>PAKYAS_FORMATtabletable, json, ndjson, or yaml.
-v, --verbose-offPrint extra diagnostic lines to stderr.
--no-update-checkPAKYAS_NO_UPDATE_CHECKoffSkip the background update check.
--ignore-env-offIgnore PAKYAS_API_KEY and use stored credentials.
--display-tz <TZ>PAKYAS_DISPLAY_TZlocallocal or utc. Used for timestamps in check inspect and check tail.
--time <MODE>PAKYAS_TIMEbothrelative, absolute, or both. Used for timestamps in check inspect.
--no-colorNO_COLORoffDisable colored output.
--plain-offASCII labels instead of symbols (used by check tail).
--debug-http-offPrint each API request (method and URL), the response status, and the response body to stderr. Headers, and therefore API keys, are never printed.
-h, --help--Show help.
-V, --version--Show the version.

Boolean environment variables (PAKYAS_NO_UPDATE_CHECK, NO_COLOR, PAKYAS_NO_EXTERNAL, PAKYAS_MIGRATION_MODE) accept 1, true, yes, or on. Any value other than empty, 0, false, no, or off turns them on.

Data goes to stdout. Warnings, notes, and errors go to stderr, so piping --format json output into jq is safe.

Commandtablejson / ndjson / yaml
check list, check logs, project list, org list, api-key listTableArray of rows ([] when empty). ndjson prints one object per line.
check showPretty JSONCheck object
check create, check create --dry-runHuman summaryCheck object (see check create)
project create, project defaultConfirmation messageProject object
api-key createKey and warningCreated key, including the secret
whoamiTextContext object
check tailEvent linesJSON array; with -f, one JSON object per line
check inspect, check doctorHuman reportJSON only for --format json; other formats print the human report

Other commands (ping, monitor, check pause/resume/delete/update/sync, auth ..., org switch, login, logout, update) print human-readable messages only.

In machine formats, check list prints raw status values (up, down, late, new, running, paused, …) without colors, and check logs prints RFC 3339 timestamps and raw ping types (success, fail, start).

VariableDescription
PAKYAS_API_KEYAPI key (pk_live_...). Overrides stored credentials unless --ignore-env is passed.
PAKYAS_ORGOrganization ID or name. Same as --org.
PAKYAS_PROJECTProject ID, slug, or name. Same as --project. Also filters check list.
PAKYAS_FORMATOutput format. Same as --format.
PAKYAS_PUBLIC_IDCheck public ID for ping and monitor. Same as --public-id; takes precedence over a slug argument.
PAKYAS_CONFIG_DIRUse this directory for config, credentials, and caches instead of the platform default.
PAKYAS_DISPLAY_TZlocal or utc. Same as --display-tz.
PAKYAS_TIMErelative, absolute, or both. Same as --time.
PAKYAS_NO_UPDATE_CHECKDisable the background update check.
NO_COLORDisable colored output.
CIWhen set (to any value), the background update check is skipped.
API_URLAPI base URL. Default https://api.pakyas.com.
PING_URLPing base URL. Default https://ping.pakyas.com.
XDG_CONFIG_HOMELinux only: moves the default config directory to $XDG_CONFIG_HOME/pakyas.

Variables used only by ping and monitor (external monitors, migration mode, timeouts) are listed on the monitor and External Monitors pages. See Environment Variables for a single list.

PlatformDefault directory
macOS~/Library/Application Support/com.pakyas.pakyas/
Linux~/.config/pakyas/ (or $XDG_CONFIG_HOME/pakyas/)
Windows%APPDATA%\pakyas\pakyas\config\

Set PAKYAS_CONFIG_DIR to use a different directory, for example to keep CI jobs or test runs isolated from your own login.

Files in the directory:

FileContents
config.tomlActive organization, default project, endpoints, and display preferences
credentials.jsonStored API keys, one per organization. Written by login, org switch, and auth key set; deleted by logout.
cache/checks.jsonSlug to public ID cache used by ping and monitor (looked up again after an hour)
cache/update.jsonResult of the last update check (refreshed at most once every 24 hours)
pakyas.lockLock file that prevents two processes from writing credentials at the same time
external_monitors.tomlOptional. See External Monitors.

credentials.json holds API keys in plain text. Protect the directory like you would ~/.ssh.

api_url = "https://api.pakyas.com"
ping_url = "https://ping.pakyas.com"
active_org_id = "3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74"
active_org_name = "Acme Corp"
active_org_timezone = "Asia/Manila"
active_project_id = "7c9e6679-7425-40de-944b-e07fc1f90ae7"
active_project_name = "Production"
format = "table"
color = true
KeyDescription
api_url, ping_urlEndpoints. API_URL and PING_URL override them.
active_org_*Set by login and org switch. The timezone is used to preview cron schedules.
active_project_*Set by project default, project create, login, and org switch.
formatDefault output format (table, json, ndjson, yaml).
colorfalse disables colors.

The CLI rewrites this file when you log in, switch organizations, or change the default project, so comments are not preserved.

Check slugs are unique within an organization. Commands that take a check accept a slug, the check ID, or the public (ping) ID shown in the PUBLIC_ID column of pakyas check list. Lookups search the whole organization, not only the default project.

ping and monitor cache slug to public ID lookups in cache/checks.json, so repeated pings don’t call the API. An entry is used for an hour; after that the next ping or monitor looks the slug up again. If that lookup fails because the API is unreachable, times out, or returns a rate-limit or server error, the cached public ID is used anyway and a warning is printed, so an API outage doesn’t stop your pings. (CLI 0.1.9 and earlier use entries for 24 hours and don’t fall back.) check list (without --project), check sync, and slug lookups refresh the organization’s entries; check create adds the new check and check delete removes it.

If you delete and recreate a check in the dashboard, pings to the old public ID are accepted but discarded until the entry is looked up again. Run pakyas check sync to switch to the new ID immediately.

CodeMeaning
0Success
1Any other error, for example the API rejected the request (invalid value, slug already taken). check doctor also exits 1 when findings meet --fail-on.
2Usage error: unknown flag, missing or invalid argument, conflicting flags, no organization or default project selected, nothing to change
3Not found: the organization, project, check or other resource doesn’t exist
4Temporary failure: the API is unreachable, timed out, rate limited (429) or had a server error (5xx). Safe to retry.
5Authentication: not logged in, or the API key is invalid, expired, revoked, missing for the organization, or for another organization
6Permission denied (403): the key’s scopes or project access, or your role, don’t allow it
7Unexpected response from the API

These codes are from CLI 0.1.10. Earlier versions exit 1 for every error (and 2 for argument parser errors).

pakyas monitor is different: it exits with the wrapped command’s exit code (128 + N if the command was killed by signal N), or 3 if the run could not be recorded in Pakyas. See monitor.

When the API rejects the key (HTTP 401), the error is:

Error: Authentication failed: the API key is invalid, expired, or revoked.
Run: pakyas login (or check PAKYAS_API_KEY)

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

The ping endpoint needs no authentication. Pass the check’s public ID and the CLI skips the API entirely: no API key, no organization lookup, no cache.

Terminal window
pakyas monitor --public-id 550e8400-e29b-41d4-a716-446655440000 -- ./backup.sh
pakyas ping --public-id 550e8400-e29b-41d4-a716-446655440000

Get the public ID from the PUBLIC_ID column of pakyas check list, from pakyas check show <slug>, or from the output of pakyas check create. You can also set it as PAKYAS_PUBLIC_ID.

Terminal window
export PAKYAS_API_KEY=pk_live_...
pakyas monitor nightly-backup -- ./backup.sh
pakyas check list --format json

No PAKYAS_ORG is needed: the CLI asks the server which organization the key belongs to. On a fresh runner the slug cache is empty, so the first ping of a run makes one or two extra API requests before pinging. ping and monitor only read check data, so a key with the read scope is enough.

Tips for CI:

  • Set PAKYAS_CONFIG_DIR to a job-local directory if the runner is shared.
  • The update check is skipped when CI is set; set PAKYAS_NO_UPDATE_CHECK=1 elsewhere.
  • Use --debug-http to see the API calls a command makes.