Skip to Content
Xeonr Developer Docs
Access and tokens

Personal API keys

Create xk_ keys that act as you, limited to repositories, groups and scopes, for scripts, git over HTTPS and the registry.

A personal API key (xk_…) is a long-lived credential that acts as you. Use one where a sign-in that refreshes itself won't do: a script, a CI system outside branchd, or a Docker or git client on a server.

A personal key:

  • acts as you, and never does more than your current role allows;
  • reaches everything you can reach, or only the repositories and groups you bind it to (at most 50; a group covers everything under it);
  • carries only the scopes you give it, picked by level or one by one;
  • expires within 365 days. Only an organisation administrator may issue a key that never expires;
  • stops working when you revoke it, or if your account is deactivated;
  • can never manage keys, SSH keys, session credentials, bots or access grants.

You can only create a key while signed in as yourself. An agent, a bot, a pipeline job or another key cannot make one. You can't give a key a scope your own sign-in doesn't hold.

The secret is shown once, when the key is created. branchd keeps only its prefix.

In the console

Open API keys in your settings (/-/settings/tokens). Choose a name, whether it reaches everything or only some repositories and groups, a level or individual scopes, and an expiry.

With the CLI

# A key that pulls images from one repository, for 30 days
branchd token create ci-pull --repo acme/api --scopes forge:package:read --expires 30d

# Clone everything in a group, at the read level (the default), for 90 days (the default)
branchd token create build-clone --group acme

# List your keys, then revoke one
branchd token list
branchd token revoke 0b6c1d2e-3f40-4a5b-8c6d-7e8f90a1b2c3

branchd token create <name> takes:

FlagMeaning
--repo PATHBind the key to this repository. Repeat for more.
--group PATHBind the key to this group and everything under it. Repeat for more.
--level LEVELread (default), write, maintain or admin. See levels.
--scopes S,...Exactly these scopes, instead of a level
--expires WHEN<n>d (up to 365d), a date YYYY-MM-DD, or never (organisation administrators only). Default 90d.
-d, --descriptionA note for yourself
--jsonPrint the whole response

Without --repo or --group, the key reaches everything you can. Only the secret goes to standard output, so it can be piped:

branchd token create ci-push --repo acme/api --scopes forge:package:edit --expires 30d \
  | docker login registry.branchd.run -u token --password-stdin

branchd token list shows your keys with their prefix, what they reach, their scopes (or level), expiry, last use and state. --all includes revoked ones. branchd token revoke <id> takes the key's id or its full urn:xeonr:auth:api-key:… name. --yes is needed when there is no terminal to confirm on.

Using a key

WhereHow
APIAuthorization: Bearer xk_…
git over HTTPSThe key as the password. The username is ignored.
Registrydocker login registry.branchd.run -u token --password-stdin

The API

xeonr.forge.v1.PersonalKeyService:

MethodDoes
GetPersonalKeyOptionsThe scopes you may issue, with descriptions; the levels; the maximum lifetime; whether you may omit an expiry; the maximum number of bindings
CreatePersonalKeyname (1–64 characters), description, either everything: true or bindings[] (each {type: REPOSITORY or GROUP, path, scopes[]}; a binding with no scopes takes the key's), level and/or scopes[], and expires_at or no_expiry
ListPersonalKeysYour keys. include_revoked adds revoked ones.
RevokePersonalKeyBy key (urn:xeonr:auth:api-key:<uuid>). Revoking twice is not an error.

A binding to a repository or group you can't read is refused as not found. An expiry more than 365 days away is refused, and so is no_expiry from anyone but an organisation administrator.

On this page