CLI Configuration
This page covers everything that is shared across pakyas commands: global flags, environment variables, where state is stored, and exit codes.
Precedence
Section titled “Precedence”When the same setting comes from several places, the CLI uses the first one it finds:
- Command-line flag (
--org,--project,--format, …) - Environment variable (
PAKYAS_ORG,PAKYAS_PROJECT,PAKYAS_FORMAT, …) config.tomlin the config directory- Built-in default
Specific settings:
| Setting | Resolution order |
|---|---|
| API key | PAKYAS_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 |
| Color | Disabled by --no-color, NO_COLOR, or color = false in config.toml |
| Endpoints | API_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.
Global Flags
Section titled “Global Flags”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).
| Flag | Env var | Default | Description |
|---|---|---|---|
--org <ORG> | PAKYAS_ORG | saved org | Organization ID or name. An ID avoids an extra lookup. |
--project <PROJECT> | PAKYAS_PROJECT | default project | Project ID, slug, or name. |
--format <FORMAT> | PAKYAS_FORMAT | table | table, json, ndjson, or yaml. |
-v, --verbose | - | off | Print extra diagnostic lines to stderr. |
--no-update-check | PAKYAS_NO_UPDATE_CHECK | off | Skip the background update check. |
--ignore-env | - | off | Ignore PAKYAS_API_KEY and use stored credentials. |
--display-tz <TZ> | PAKYAS_DISPLAY_TZ | local | local or utc. Used for timestamps in check inspect and check tail. |
--time <MODE> | PAKYAS_TIME | both | relative, absolute, or both. Used for timestamps in check inspect. |
--no-color | NO_COLOR | off | Disable colored output. |
--plain | - | off | ASCII labels instead of symbols (used by check tail). |
--debug-http | - | off | Print 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.
Output Formats
Section titled “Output Formats”Data goes to stdout. Warnings, notes, and errors go to stderr, so piping --format json output into jq is safe.
| Command | table | json / ndjson / yaml |
|---|---|---|
check list, check logs, project list, org list, api-key list | Table | Array of rows ([] when empty). ndjson prints one object per line. |
check show | Pretty JSON | Check object |
check create, check create --dry-run | Human summary | Check object (see check create) |
project create, project default | Confirmation message | Project object |
api-key create | Key and warning | Created key, including the secret |
whoami | Text | Context object |
check tail | Event lines | JSON array; with -f, one JSON object per line |
check inspect, check doctor | Human report | JSON 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).
Environment Variables
Section titled “Environment Variables”| Variable | Description |
|---|---|
PAKYAS_API_KEY | API key (pk_live_...). Overrides stored credentials unless --ignore-env is passed. |
PAKYAS_ORG | Organization ID or name. Same as --org. |
PAKYAS_PROJECT | Project ID, slug, or name. Same as --project. Also filters check list. |
PAKYAS_FORMAT | Output format. Same as --format. |
PAKYAS_PUBLIC_ID | Check public ID for ping and monitor. Same as --public-id; takes precedence over a slug argument. |
PAKYAS_CONFIG_DIR | Use this directory for config, credentials, and caches instead of the platform default. |
PAKYAS_DISPLAY_TZ | local or utc. Same as --display-tz. |
PAKYAS_TIME | relative, absolute, or both. Same as --time. |
PAKYAS_NO_UPDATE_CHECK | Disable the background update check. |
NO_COLOR | Disable colored output. |
CI | When set (to any value), the background update check is skipped. |
API_URL | API base URL. Default https://api.pakyas.com. |
PING_URL | Ping base URL. Default https://ping.pakyas.com. |
XDG_CONFIG_HOME | Linux 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.
Config Directory
Section titled “Config Directory”| Platform | Default 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:
| File | Contents |
|---|---|
config.toml | Active organization, default project, endpoints, and display preferences |
credentials.json | Stored API keys, one per organization. Written by login, org switch, and auth key set; deleted by logout. |
cache/checks.json | Slug to public ID cache used by ping and monitor (looked up again after an hour) |
cache/update.json | Result of the last update check (refreshed at most once every 24 hours) |
pakyas.lock | Lock file that prevents two processes from writing credentials at the same time |
external_monitors.toml | Optional. See External Monitors. |
credentials.json holds API keys in plain text. Protect the directory like you would ~/.ssh.
config.toml
Section titled “config.toml”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| Key | Description |
|---|---|
api_url, ping_url | Endpoints. 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. |
format | Default output format (table, json, ndjson, yaml). |
color | false disables colors. |
The CLI rewrites this file when you log in, switch organizations, or change the default project, so comments are not preserved.
Check Identifiers and the Slug Cache
Section titled “Check Identifiers and the Slug Cache”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.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Any other error, for example the API rejected the request (invalid value, slug already taken). check doctor also exits 1 when findings meet --fail-on. |
| 2 | Usage error: unknown flag, missing or invalid argument, conflicting flags, no organization or default project selected, nothing to change |
| 3 | Not found: the organization, project, check or other resource doesn’t exist |
| 4 | Temporary failure: the API is unreachable, timed out, rate limited (429) or had a server error (5xx). Safe to retry. |
| 5 | Authentication: not logged in, or the API key is invalid, expired, revoked, missing for the organization, or for another organization |
| 6 | Permission denied (403): the key’s scopes or project access, or your role, don’t allow it |
| 7 | Unexpected 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.
CI and Cron Setup
Section titled “CI and Cron Setup”Option 1: Public ID (recommended)
Section titled “Option 1: Public ID (recommended)”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.
pakyas monitor --public-id 550e8400-e29b-41d4-a716-446655440000 -- ./backup.shpakyas ping --public-id 550e8400-e29b-41d4-a716-446655440000Get 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.
Option 2: API key only
Section titled “Option 2: API key only”export PAKYAS_API_KEY=pk_live_...pakyas monitor nightly-backup -- ./backup.shpakyas check list --format jsonNo 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_DIRto a job-local directory if the runner is shared. - The update check is skipped when
CIis set; setPAKYAS_NO_UPDATE_CHECK=1elsewhere. - Use
--debug-httpto see the API calls a command makes.
See Also
Section titled “See Also”- Installation - Install, update, and log in
- Environment Variables - Full variable list
- check - Check management commands