Use the ably auth keys switch command to switch to a different API key for the current app. If no key identifier is provided, the CLI presents an interactive list of available keys.
Synopsis
ably auth keys switch [key-name-or-value] [options]Arguments
key-name-or-value
An optional key name (APP_ID.KEY_ID) or full key value (APP_ID.KEY_ID:KEY_SECRET) to switch to. If not provided, the CLI displays an interactive prompt to select from available keys.
Options
--app
The app ID to switch keys for. Uses the currently selected app if not specified.
--json
Output results as compact JSON. Mutually exclusive with --pretty-json.
--pretty-json
Output results in formatted JSON. Mutually exclusive with --json.
--verbose | -v
Enable verbose logging. Can be combined with --json or --pretty-json.
Examples
Switch keys interactively:
ably auth keys switchSwitch to a specific key by key name:
ably auth keys switch "aBcDeF.gHiJkL"Switch to a specific key by full key value:
ably auth keys switch "aBcDeF.gHiJkL:keySecret"Switch keys and output the result in JSON format:
ably auth keys switch --jsonSee also
- Auth — Explore all
ably authcommands. - CLI reference — Full list of available commands.