Skip to content

API keys

Last updated: 3 December 2026 · CLI 0.4.0

The CLI and automations connect to your account with an API key. Keys start with hb_live_ and belong to an organization.

Creating a key

  1. Open the API keys page in the panel.
  2. Give the key a name (at most 60 characters; letters, digits, spaces, ., _ and -). You can set an expiry if you like; without one the key never expires.
  3. Copy the full key right away. It is shown only when it is created; afterwards the panel shows only its last four characters.

You can keep at most 25 active keys per organization.

Scopes

A key reaches the public API of that organization on behalf of the user who created it: account info (GET /me; hb whoami shows this), the balance, machines, command execution and files, snapshots, templates and the usage summary. Operations that need a signed-in session, such as secrets, webhooks, members, payment and package operations and the API keys themselves, cannot be done with any key; you do those in the panel. A key stops working if the user who created it leaves the organization or their account is closed.

A key can be narrowed with scopes. A key without scopes (including every key created before 26 November 2026) reaches the whole public API; a scoped key can call only the endpoints its scopes allow:

ScopeWhat it allows
machines:readViewing machines and templates
machines:createCreating machines
machines:managePausing, resuming and stopping a machine and changing its settings (single and bulk); stopping and removing background services
machines:execRunning commands on a machine, following the output, reading and writing files; adding, editing, starting background services and reading their logs
machines:deleteDeleting machines
snapshots:readViewing snapshots
snapshots:writeTaking and deleting snapshots
account:readReading account info, the balance and the usage summary

A request outside the key's scopes is rejected with 403 and the code INSUFFICIENT_SCOPE; details.requiredScope tells you the scope needed. The scope each endpoint needs is listed on the Endpoints page.

CI template: a key created from the CI page in the panel carries the scopes machines:create, machines:read, machines:exec, machines:delete and account:read and is valid for at most 90 days; it cannot be non-expiring. Details: Using hadronbox in CI.

Storage and security

  • Keep the key like a password; do not paste it into a code repository, a log or a chat.
  • Do not pass the key as a command-line argument; the CLI does not accept that either. Use an environment variable or hb login.
  • Create a separate key for each place you use it (your computer, CI, an agent); if one leaks, you revoke only that one.
  • Revoke keys you no longer use in the panel. hb logout deletes the key from this computer only; it does not revoke it on the server.

If a key has leaked

  1. Revoke the key right away on the API keys page in the panel. A revoked key never works again.
  2. Create a new key and update the places where you use it.
  3. If the leak is in a code repository, remove the key from the repository history too; revoking it is still required.

Using hadronbox in CI

Create a separate key for CI and save it as the repository's secret named HADRONBOX_API_KEY. The CLI reads this variable before a saved login, so hb login is not needed in CI:

npx hadronbox whoami

Do not print the key to the output, and do not give secrets to pull request workflows from forks. For CI, create a scoped, expiring key with the template on the CI page. GitHub Actions and Woodpecker examples, timeouts and the clean-up step: Using hadronbox in CI.

API keys · hadronbox docs