kvbox.cloud
Guides

API keys

Named tokens a program uses in place of your login, for CI, agents and scripts.

A program cannot type a password. An API key is a token you make once and hand to it: a CI job, an agent, a script on a server. The program then acts as you, in your account and in every org you belong to.

kvbox key create ci                  # prints the key, once; it works for 90 days
kvbox key create ci --expires 30d    # another life: a duration, or a day (2027-01-31)
kvbox key create ci --expires never  # no end date: it works until you remove it
kvbox key ls                         # names and dates, never the keys
kvbox key rm ci                      # whatever uses it is refused from its next request on

The key starts with kvb_ and is shown only when it is made: kvbox keeps a hash of it, not the key. For a lost one, make a new key and remove the old. The same list is in the web app under API keys.

Using a key

Put it in the program's environment as KVBOX_TOKEN. The CLI then uses it instead of a login, and needs no kvbox login first:

export KVBOX_TOKEN=kvb_...
kvbox ls
kvbox exec dev -- npm test

KVBOX_URL names the control plane when it is not the kvbox cloud (KVBOX_URL=https://cp.example.com). While KVBOX_TOKEN is set it wins over a login stored on the machine; --local still goes to this machine's own server. kvbox whoami says which is in use.

The TypeScript SDK reads the same two variables: new Kvbox() acts with the key in KVBOX_TOKEN.

kvbox connect, kvbox exec and kvbox deploy work too: the CLI makes an SSH key on the machine when there is none and has it signed for a day, each time it connects.

In GitHub Actions:

- run: npm install -g @kvbox/cli
- run: kvbox deploy --name pr-${{ github.event.number }} -y
  env:
    KVBOX_TOKEN: ${{ secrets.KVBOX_TOKEN }}

What a key can do

Everything you can, with two exceptions: a key cannot make, list or remove API keys or approve a kvbox login, and an admin's key cannot use the admin routes. Those need your login (kvbox login, or the web app), so a key that leaks cannot make itself a replacement.

Removing a key refuses its next call at once. It does not take back what the key already fetched: an SSH certificate it had signed works for up to a day, and a bucket access key, a database password or an org member it added stays until you remove them too. After a leak, remove the key, then check those.

  • An account holds up to 20 keys. Names are yours alone: lowercase letters, digits, ., _ or -.
  • A key has no scope of its own yet: it is not limited to one org, and there is no read-only key. Give a program its own key, so you can remove that one alone.
  • A key expires after 90 days unless you say otherwise, so a forgotten one stops by itself. One that never expires has to be asked for: --expires never, or "No expiry" in the web app.
  • An expired key stays in the list, marked expired, until you remove it. Make a new one in its place.
  • kvbox logout does not end a key. Remove it with kvbox key rm.

Over HTTP the key is a bearer like any login's token: Authorization: Bearer kvb_....

On this page