CLI Reference
pikeway keys add
Save an API key on this machine under a label.
Synopsis
bash
pikeway keys add --label <label> --key pk-... [--json]
Description
Appends the key to the local config file (created with mode 600 if needed). The first key you add becomes the active one; later keys are saved but not activated. Switch with pikeway keys activate.
- The key is not checked against the gateway. To save and verify in one step, use pikeway setup --key.
- Labels are unique. Adding a label that already exists fails; remove the old one first with pikeway keys remove.
- Create keys in the console at
/console/keys.
Options
--labelstringrequiredName for the key, e.g.
main, ci, agent.--key, -kpk-…requiredThe key to save. This is the same flag as the global --key, so -k works too.
Examples
bash
# first key: saved and activated pikeway keys add --label main --key pk-AbCdEf0123456789xYz9 # a second key for CI, short alias for --key pikeway keys add --label ci -k pk-9fQr7s6t5u4v3w2xT2mw # replace an existing label pikeway keys remove --label main && pikeway keys add --label main --key pk-... # read the key from a secret store instead of typing it pikeway keys add --label agent --key "$(pass show pikeway/agent)"
Output
First key
added main (active)
Later keys
added ci
--json
json
{ "added": "ci", "active": "main" }Errors and exit codes
| Exit | Message | When |
|---|---|---|
| 2 | missing --label | --label was not given or has no value. |
| 2 | missing --key | --key was not given or has no value. |
| 2 | a key labelled "main" already exists (remove it first) | The label is taken. Nothing is changed. |
Typing a key on the command line leaves it in your shell history. In shared environments prefer
PIKEWAY_API_KEY from a secret manager, or a leading space if your shell ignores those.