Skip to content

keypaste token

Creates, lists and revokes scoped tokens, which only feed keypaste run --token or --bundle: a token injects an environment’s stage into a command and never prints a value.

Terminal window
keypaste token create <name> --scope <scopes> [--ttl <n(m|h|d)>] [--allow-prod] [--json]
keypaste token ls [--json]
keypaste token revoke <name|id>
keypaste token bundle <name> -o <file> [--force] [--token <token|-|env>]

Every verb also takes --vault <path> and --keyfile <path>. create and revoke change the vault, so lock it in the app or stop keypaste approve first.

OptionVerbsEffect
--scope <scopes>createRequired. What it may inject: read:<project>/<stage>/<KEY or *>, several separated by commas.
--ttl <n(m|h|d)>createHow long it works, 30d by default.
--allow-prodcreateLets it reach a protected stage, which then asks you live every time.
--jsoncreate, lsMachine-readable output.
-o, --output <file>bundleRequired. Where to write the bundle.
--forcebundleReplace a file that is there.
--token <token|-|env>bundleThe token, which the process holding the vault checks. - reads it from standard input, env from KEYPASTE_TOKEN.
  • create prints the token once and never stores it.
  • ls lists each token’s name, prefix, scope and expiry, never a secret. The app’s Settings › Scoped tokens lists and revokes them too.
  • keypaste run --token asks the desktop app or keypaste approve holding the vault, so the job must reach that process.
  • bundle seals the token’s sets into a file that keypaste run --bundle opens with the token alone, with no vault. It never holds a protected stage. A bundle can’t be revoked, and its expiry is checked against the job’s own clock, so rotate its values once it is retired or may have leaked.
Terminal window
keypaste token create ci-staging --scope 'read:acme-api/staging/*'
KEYPASTE_TOKEN=… keypaste run --token env -p staging acme-api -- npm test
keypaste token bundle ci-staging -o staging.bundle --token env
keypaste run --bundle staging.bundle --token env -- npm test
keypaste token revoke ci-staging