Humanbound website
Documentation
Management

API Keys

Create and scope Humanbound user API keys (hb_…) for headless access — CI/CD pipelines, Docker, automation scripts, and SIEM forwarders.

A Humanbound user API key (hb_…) is the credential for headless access — CI/CD pipelines, the Docker image, automation scripts, and SIEM forwarders — where an interactive hb login isn't possible. The key authenticates as its owner, bounded by the scope and selection you give it. hb api-keys covers create, list, update, and revoke.

Shown once

The key value appears only in the create response. Only a hash is stored, so it can never be retrieved again — copy it straight into your secret store. Lost a key? Revoke it and create a new one.

Create a key

# Least privilege by default: read-only, all orgs you own
hb api-keys create --name "CI Key"

# Scoped: read-only, one org, one project, expires at a fixed time
hb api-keys create --name "CI Key" \
  --scope read \
  --org <org-id> \
  --projects <project-id> \
  --expires 1767225600
FlagMeaningDefault
--nameLabel shown in hb api-keys listrequired
--scoperead | write | admin (cumulative)read
--orgRestrict to organisation id(s); repeatableall orgs you own
--projectsRestrict to project id(s); repeatableall projects you own
--expiresExpiry as epoch secondsnever expires

--org and --projects are validated at creation: you can only scope a key to an organisation you own and to projects inside it. Anything else is rejected immediately, so you never end up holding a key that silently can't do anything.

Use a key headlessly

Set the key in the environment — no hb login, no browser:

export HUMANBOUND_API_KEY=hb_…            # the key from `create`
export HUMANBOUND_ORG_ID=<org-id>         # the organisation you own
export HUMANBOUND_PROJECT_ID=<project-id> # the project to work on

hb test --wait --fail-on high             # run a scan and gate the build
hb findings                               # read findings
hb posture                                # read the security posture
hb report -o report.html                  # export a report

With HUMANBOUND_API_KEY set, the CLI sends the key on every request and skips OAuth entirely.

See CI/CD Integration and Docker for ready-made pipeline snippets.

Which commands work headlessly

The connect → test → gate loop a pipeline needs:

CommandMinimum scopeNotes
hb connectwriteProvisions a project + integration; use --yes for non-interactive
hb testwritePass --provider-id to skip provider auto-selection
hb status <id>readSingle experiment; --all is not available headlessly
hb logsread
hb findingsread
hb posturereadAlso --org
hb reportreadProject, --org, and --assessment <id> reports
hb assessments / hb assessments showreadFind the assessment id for hb report --assessment
hb assessments create / clonewriteCustom assessments run headlessly — pair --yes with --json, add --wait to block in CI
hb assessments terminatewrite--force to skip the prompt
hb providersreadList only

Anything not listed still requires hb login. Notably:

  • hb api-keys … — key management is deliberately interactive-only: you cannot mint, rotate, or revoke a key using a key.
  • hb orgs, hb members, hb projects — organisation and team administration.
  • hb providers create|update|delete — provider setup (listing works headlessly).

If a command isn't supported, it fails with a clear error rather than falling back to a browser login.

What a key can reach

Two rules bound every request, and both must pass:

  1. Owner-only. A key reaches only organisations its creator owns — never one where you are merely a member (admin, developer, or expert). Sharing a key with a teammate therefore keeps the blast radius inside your own organisation.
  2. Scope + selection. The route's minimum scope must be satisfied (admin ⊇ write ⊇ read), and the target org/project must be within the key's --org / --projects selection.

A key can only ever narrow what its owner can do — it never grants more. Key management itself (hb api-keys …) always requires an interactive login: you cannot mint a key with a key.

Sharing keys with your team

As the organisation owner, create a tightly-scoped key (--scope read, one --projects, an --expires) and hand that to a teammate's pipeline. Requests made with it are attributed to you, the owner — so rotate per consumer rather than sharing one key everywhere.

List keys

hb api-keys list

Shows id, name, scope, active state, and the key prefix (hb_ + 8 characters) — never the secret itself.

Update a key

hb api-keys update <id> --name "New Name"   # rename
hb api-keys update <id> --scope write       # change scope
hb api-keys update <id> --inactive          # deactivate (requests → 401)
hb api-keys update <id> --active            # reactivate

Revoke a key

hb api-keys delete <id>            # with confirmation
hb api-keys delete <id> --force    # skip confirmation

Deactivating (--inactive) stops a key immediately and is reversible; deleting is permanent. Rotation is create-new → switch the secret → revoke-old.

Scopes

Scopes are cumulative — a route declares the minimum it needs, so a higher scope also satisfies the lower ones:

  • read — view projects, experiments, findings, posture, and reports (default)
  • write — everything read can do, plus create projects (hb connect) and run tests (hb test)
  • admin — everything write can do, plus admin-level actions

Pick the lowest scope that works: a read key can gate a build on existing findings, but cannot start a test or create a project.