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.
api-key list
Section titled “api-key list”Lists all API keys in the active organization.
pakyas api-key listWhat It Shows
Section titled “What It Shows”- 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)
Example
Section titled “Example”+-------------+--------------------------------------+----------------+-------------+---------+-----------+--------+| 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 [].
api-key create
Section titled “api-key create”Creates a new API key on the server.
pakyas api-key create <NAME> [-s SCOPES] [--expires DAYS]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
NAME | Name for the API key (required, e.g., “CI Pipeline”, “Local Dev”) |
| Flag | Description |
|---|---|
-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.
Examples
Section titled “Examples”# Create a read-only key for monitoring dashboardspakyas api-key create "Dashboard Reader"
# Create a CI/CD key with write scope and 90-day expirypakyas 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 environmentpakyas api-key create "Production Deploy" -s write --expires 30JSON Output
Section titled “JSON Output”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"}# Create a key and pass the secret straight to your CI secret storepakyas api-key create "GitHub Actions" -s read,write --expires 90 --format json \ | jq -r '.key' | gh secret set PAKYAS_API_KEYAfter Creation
Section titled “After Creation”To use the key from the CLI on this machine, store it for your organization (find the ID with pakyas org list):
pakyas auth key set --org 3f2b8c1e-7d4a-4e1b-9c3f-2a6d8e5b1c74 --key pk_live_...api-key revoke
Section titled “api-key revoke”Revokes an API key on the server. This action cannot be undone.
pakyas api-key revoke <ID> [-y]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
ID | API key ID (a UUID from the ID column of api-key list) |
| Flag | Description |
|---|---|
-y, --yes | Skip confirmation prompt |
Examples
Section titled “Examples”# 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 -yScope Reference
Section titled “Scope Reference”| Scope | Access Level | Permissions |
|---|---|---|
read | Read-only | List checks, view status, read logs |
write | Read + Write | Create, update, pause, and delete checks, plus all read permissions |
manage | Full access | API key management, organization settings, plus all write permissions |
Scope Selection Guidelines
Section titled “Scope Selection Guidelines”- Monitoring/dashboards: Use
readonly - Pinging by slug (
ping,monitor):readis enough. Pings by--public-idneed no key at all. - CI/CD pipelines that change checks: Use
read,write - Automation scripts: Use
writeif creating checks, otherwiseread - Administrative tools: Use
manageonly when necessary
Common Workflows
Section titled “Common Workflows”Creating Keys for CI/CD Pipelines
Section titled “Creating Keys for CI/CD Pipelines”# Create a scoped key with expirationpakyas 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_...Rotating Keys
Section titled “Rotating Keys”Key rotation involves creating a new key before revoking the old one:
# 1. Create new keypakyas 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 workspakyas 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 -yScoped Keys for Different Environments
Section titled “Scoped Keys for Different Environments”# Read-only key for staging dashboardspakyas api-key create "Staging Dashboard" -s read
# Write key for production deploymentspakyas 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 7See Also
Section titled “See Also”- auth - Local credential management and authentication status
- CLI Configuration - Using keys in CI