Skip to main content
tunnelbyte token
Prints the cached API token to stdout. Designed for shell substitution so you can load it into an env var in one line:
export TB_KEY=$(tunnelbyte token)
Exits 0 if a token is found, 1 if not.

TTY vs pipe behaviour

  • TTY (running it directly in a terminal): adds a trailing newline so it reads cleanly.
  • Pipe / command substitution: no trailing newline. $(tunnelbyte token) captures exactly the token bytes, no stray \n.

Example

$ tunnelbyte token | pbcopy            # copy to macOS clipboard
$ export TB_KEY=$(tunnelbyte token)    # load into a shell var
$ curl -H "Authorization: Bearer $TB_KEY" https://api.tunnelbyte.dev/v1/usage

Notes

  • The token is whatever tier you’re currently on (anonymous, free, or paid). Same token the CLI uses for every other command.
  • If no token is cached yet, run tunnelbyte signup or any tunnelbyte <region> invocation first - the latter will mint an anonymous token on the spot.
  • To clear the cached token, use tunnelbyte logout.