photon account commands.
A service key acts as your account. Treat it like a password.
Which credential to use (see the
full table):
- Your own machine:
photon login. - CI: a service identity API key with only the permissions the job needs. See Use a key in CI.
- An app’s own calls: a project API key.
- Automation that must act as your account: an account service key.
- Creating or rotating keys: a person, not CI or an agent.
Create a key
Every key needs a name and an explicit expiry decision. Pass either--expires-at with an RFC 3339 timestamp, or --no-expiry:
Use a key in CI
CI gets a service identity API key, unless the job must act as your account, such as one that runsphoton account commands. A service identity API key
works in one organization, across its projects, and holds only the permissions
a person grants it in the Dashboard, under the organization’s service
identities. Grant only what the job needs. This job lists a project’s webhooks,
so its key holds only project:read:
PHOTON_API_TOKEN, and the CLI saves no
credential for it. An account service key goes in the variable the same way,
for automation that must act as your account. See
which credential to use and
how the CLI uses a key from the environment.
Sign in with a key
On a machine that should stay signed in, such as a long-lived server, save the key withphoton login --service-key. It reads one complete credential from
non-interactive stdin. The CLI refuses to read it from a terminal, so it
never lands in your shell history or in the process list:
--force to replace the current session:
PHOTON_API_TOKEN is set,
photon login --service-key refuses, because the variable’s key would win. See
where credentials are stored.
After signing in, every other command works exactly as it does for a human
session:
List and revoke keys
list shows unrevoked keys only, expired ones included, newest first. Photon’s
response carries each key’s metadata without its secret:
revoke asks for confirmation unless you pass --yes. Automation must pass
it, since a non-interactive command with no answer exits with code 2.
Credential format
A service key is apho_ask_ prefix, a 26-character key ID, and a secret. The
key ID is the part you pass to revoke and the part that appears in list
output. The whole credential is at most 512 bytes and must be piped in exactly
as issued, with no surrounding whitespace beyond a single trailing newline.
Recovery
create and revoke are journaled mutations. If the network fails after the
request leaves your machine, the result is recorded and you can replay it —
see Recoverable operations. This matters most for create,
where a lost response means a lost credential.