Skip to Content
HeyBug docs
API

API keys

An API key lets a script, a CI job or an AI assistant act for your account on HeyBug.

An API key lets a script, a CI job or an AI assistant act for your account on HeyBug. Create keys on the API keys page (/settings/tokens). Every key starts with ot_, so you can spot one in a config file and know it belongs to HeyBug.

How a key looks

  • The prefix is ot_, followed by 40 random characters.
  • Send it in the header Authorization: Bearer ot_... over HTTPS.
  • The server keeps a hash of the key, not the key itself.
  • Lists show only a short prefix: the first eight characters after ot_, then an ellipsis, so you can tell keys apart. The full key is never shown in a list.

Example key (fake, same format): ot_0123456789abcdefghijABCDEFGHIJ0123456789 Shown only once

Create a key

  1. Open API keys in the sidebar (/settings/tokens) and choose Create API key.
  2. Type a name that says where the key is used, such as ci-main or laptop-claude.
  3. Choose Create key. The dialog shows the key.
  4. Copy it now. The page warns: "You won't see this again. Copy the key now and store it somewhere safe."

If you close the dialog without copying, the key is lost. Revoke it and create a new one.

Store the key

  • Shell on your machine. Export the key as HEYBUG_TOKEN and the server as HEYBUG_SERVER. Do not put either in a file that Git tracks.

  • CLI saved profile. Pipe the key in on standard input, so it never appears in your shell history:

    printf '%s' "$HEYBUG_KEY" | heybug auth login --token-stdin --server https://opentest.nagara.cloud

    The CLI writes it to ~/.heybug/credentials, with owner-only permissions.

  • CI. Store the key as a repository secret named HEYBUG_TOKEN. See CI.

  • Secret manager. Keep the key in your password manager or cloud vault and read it when a job starts. Environment secrets from stdin shows the pattern.

  • Never paste a key into chat, a ticket, a URL, a screenshot or a log line.

Example: check a key and run a test

export HEYBUG_SERVER=https://opentest.nagara.cloud
export HEYBUG_TOKEN=ot_0123456789abcdefghijABCDEFGHIJ0123456789   # replace with your key

heybug auth status   # user, workspace, key name, scopes and expiry
heybug run --url https://staging.crate.so

The same key works in an MCP client. Put it in the Authorization header as described in MCP.

When a key leaks

  1. Revoke it now. On the API keys page, choose Revoke next to the key and confirm Revoke this key?. The key shows as revoked, and calls that use it fail with 401.
  2. Create a replacement and update every place that used the old key: CI secrets, MCP config, your secret manager.
  3. Check Last used. A key that shows recent use you do not recognise is a sign that someone else had it. Review the runs started since then.
  4. Clean up this machine. heybug auth remove deletes the saved key on this machine. It does not revoke the key on the server, so do step 1 as well.

When it fails

  • 401 Unauthorized. The key is missing, mistyped, revoked or expired. Check HEYBUG_TOKEN for stray spaces or a line break, or create a new key.
  • "No token given" with exit code 2. Neither HEYBUG_TOKEN nor --token-stdin supplied a key. Set one of them and run the command again.
  • Exit code 3. Authentication failed. See CLI exit codes.
  • Lost the key. You cannot read it again. Revoke it and create a new one.

On this page