Skip to Content
HeyBug docs
Troubleshooting

Missing or wrong API token

HeyBug agents and the CLI authenticate with an API token.

HeyBug agents and the CLI authenticate with an API token. This page covers what to do when a token is missing, wrong, or revoked.

"HEYBUG_TOKEN is not set"

The CLI and the local MCP server (heybug mcp) read the token from HEYBUG_TOKEN.

Fix: create a token under Settings → API tokens (/settings/tokens), copy it, and export it:

export HEYBUG_SERVER=https://heybug.example.com
export HEYBUG_TOKEN=ot_…

The token is shown only once. If you no longer have it, create a new key — old tokens cannot be revealed.

HTTP 401 from the MCP endpoint

The remote MCP endpoint (/api/mcp) rejects the request with 401 when the Authorization: Bearer <token> header is missing, wrong, or the token was revoked.

Fix:

  1. Check HEYBUG_TOKEN holds the full token you copied when you created it (no leading or trailing spaces).
  2. Create a new key at /settings/tokens if the token was revoked, and update every client config that uses it.
  3. Restart your coding agent after changing the config; most clients read it only at start.

A key was revoked

Revoked keys stop working everywhere at once, including configs already pasted into agents. Create a new key, paste it into the agent's config (or print it again with heybug mcp-config <client> and heybug connect --print), and restart the agent.

Where tokens live

  • Create, list and revoke tokens: /settings/tokens (API: GET /api/tokens, POST /api/tokens, DELETE /api/tokens/{tokenId}).
  • Tokens are scoped to the workspace they were created in; a key works only in that workspace.
  • Secrets are write-only: after saving, the page shows that a token is set, never its value.

Related guides: MCP clients, Connect an agent, CLI.

On this page