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 (first few characters)
  • Scopes granted
  • Created date
  • Last used date
  • Status (active/expired)
Terminal window
pakyas api-key list
# Output:
# Name ID Prefix Scopes Created Last Used Status
# CI Pipeline key_abc123def456... pk_live_ci... read,write 2024-01-15 2024-01-20 active
# Local Dev key_xyz789ghi012... pk_live_lo... read 2024-01-10 never active
# Old Key key_old456abc789... pk_live_ol... manage 2023-06-01 2023-12-15 expired

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, defaults to read)
--expires <DAYS>Days until expiration: 1-365 (omit for no expiration)
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

Once you have the key, store it locally for CLI use:

Terminal window
# Store the key for your organization
pakyas auth key set --org org_abc123 --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 to revoke (from api-key list output)
FlagDescription
-y, --yesSkip confirmation prompt
Terminal window
# Revoke a key (with confirmation prompt)
pakyas api-key revoke key_abc123def456
# Revoke without confirmation (use in scripts)
pakyas api-key revoke key_abc123def456 -y
ScopeAccess LevelPermissions
readRead-onlyList checks, view status, read logs
writeRead + WriteCreate/update checks, send pings, plus all read permissions
manageFull accessAPI key management, organization settings, plus all write permissions
  • Monitoring/dashboards: Use read only
  • CI/CD pipelines: Use read,write (send pings, update checks)
  • 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 org_abc123 --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 org_abc123 --key pk_live_new...
pakyas auth key verify
# 4. Revoke the old key
pakyas api-key revoke key_oldkey123 -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
  • auth Command - Local credential management and authentication status