Skip to content

api-key Command

The api-key command manages API keys on the Pakyas server. Use this command to create new API keys, list existing keys, and revoke keys that are no longer needed.

Lists all API keys in the active organization.

Terminal window
pakyas api-key list
  • Key name
  • Key ID (use this for revocation)
  • Key prefix (8 characters after pk_live_)
  • Scopes granted
  • Created date
  • Last used date
  • Status (active/expired)
+-------------+--------------------------------------+----------------+-------------+---------+-----------+--------+
| NAME | ID | PREFIX | SCOPES | CREATED | LAST USED | STATUS |
+-------------+--------------------------------------+----------------+-------------+---------+-----------+--------+
| CI Pipeline | 2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d | pk_...a1b2c3d4 | read, write | 23d ago | 2h ago | active |
| Local Dev | 9f8e7d6c-5b4a-4392-8170-6f5e4d3c2b1a | pk_...e5f6a7b8 | read | 28d ago | never | active |
+-------------+--------------------------------------+----------------+-------------+---------+-----------+--------+

With --format json|ndjson|yaml, each row has name, id, prefix, scopes, created, last_used, and status (active or expired). An empty list prints [].

Creates a new API key on the server.

Terminal window
pakyas api-key create <NAME> [-s SCOPES] [--expires DAYS]
ArgumentDescription
NAMEName for the API key (required, e.g., “CI Pipeline”, “Local Dev”)
FlagDescription
-s, --scopes <SCOPES>Scopes to grant: read, write, manage (comma-separated or repeated; default read)
--expires <DAYS>Days until expiration: 1-365 (omit for no expiration)

When the CLI is authenticated with an API key, the new key can’t do more than that key: it can only have scopes the key holds, and it must expire no later than the key does (if the key expires, --expires is required). Keys limited to selected projects can’t create keys at all. See API keys.

Terminal window
# Create a read-only key for monitoring dashboards
pakyas api-key create "Dashboard Reader"
# Create a CI/CD key with write scope and 90-day expiry
pakyas api-key create "GitHub Actions" -s read,write --expires 90
# Create an admin key with full access (use sparingly)
pakyas api-key create "Admin Key" -s read,write,manage
# Create a key for a specific environment
pakyas api-key create "Production Deploy" -s write --expires 30

With --format json (or ndjson/yaml), the created key is printed as an object. This is the only time the secret (key) is shown:

{
"id": "2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d",
"name": "GitHub Actions",
"key": "pk_live_a1b2c3d4...",
"key_prefix": "a1b2c3d4",
"scopes": ["read", "write"],
"expires_at": "2027-02-05T09:12:44Z",
"created_at": "2026-11-07T09:12:44Z"
}
Terminal window
# Create a key and pass the secret straight to your CI secret store
pakyas api-key create "GitHub Actions" -s read,write --expires 90 --format json \
| jq -r '.key' | gh secret set PAKYAS_API_KEY

To use the key from the CLI on this machine, store it for your organization (find the ID with pakyas org list):

Terminal window
pakyas auth key set --org 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74 --key pk_live_...

Revokes an API key on the server. This action cannot be undone.

Terminal window
pakyas api-key revoke <ID> [-y]
ArgumentDescription
IDAPI key ID (a UUID from the ID column of api-key list)
FlagDescription
-y, --yesSkip confirmation prompt
Terminal window
# Revoke a key (with confirmation prompt)
pakyas api-key revoke 2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d
# Revoke without confirmation (use in scripts)
pakyas api-key revoke 2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d -y
ScopeAccess LevelPermissions
readRead-onlyList checks, view status, read logs
writeRead + WriteCreate, update, pause, and delete checks, plus all read permissions
manageFull accessAPI key management, organization settings, plus all write permissions
  • Monitoring/dashboards: Use read only
  • Pinging by slug (ping, monitor): read is enough. Pings by --public-id need no key at all.
  • CI/CD pipelines that change checks: Use read,write
  • Automation scripts: Use write if creating checks, otherwise read
  • Administrative tools: Use manage only when necessary
Terminal window
# Create a scoped key with expiration
pakyas api-key create "GitHub Actions - prod" -s read,write --expires 90
# Copy the key and add to CI secrets (shown only once)
# Then optionally store locally for testing:
pakyas auth key set --org 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74 --key pk_live_...

Key rotation involves creating a new key before revoking the old one:

Terminal window
# 1. Create new key
pakyas api-key create "CI Pipeline v2" -s read,write --expires 90
# 2. Update the key in your CI/CD system (GitHub Secrets, etc.)
# 3. Verify the new key works
pakyas auth key set --org 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74 --key pk_live_new...
pakyas auth key verify
# 4. Revoke the old key (ID from `pakyas api-key list`)
pakyas api-key revoke 9f8e7d6c-5b4a-4392-8170-6f5e4d3c2b1a -y
Terminal window
# Read-only key for staging dashboards
pakyas api-key create "Staging Dashboard" -s read
# Write key for production deployments
pakyas api-key create "Production Deploy" -s read,write --expires 30
# Manage key for infrastructure automation (use sparingly)
pakyas api-key create "Terraform" -s read,write,manage --expires 7