Authentication & Version

How the CLI authenticates against NGSRV, and what ngsrv version prints.

ngsrv token <value>

Saves an API token to ~/.ngsrv/tokens.json (mode 0600) so subsequent commands can authenticate. The token must start with ngsrv_ — create one in Dashboard → API Tokens.

# save token

$ ngsrv token ngsrv_xxxxxxxxxxxxxxxxxxxxxxxx

✅ Token saved.

Where the CLI looks for a token

  1. ~/.ngsrv/tokens.json (written by ngsrv token).
  2. The NGSRV_API_TOKEN environment variable, when no token file is present (CLI v2.2.9+). The value must start with ngsrv_. This is the recommended way to authenticate inside Docker, Kubernetes, and CI runners.

Treat tokens as secrets.

Anyone with your token can create tunnels, mint domains, and consume your team's quota. Rotate tokens from the dashboard if they leak.

ngsrv version

Prints the CLI version. Use --verbose / -v to also include the build date, git commit, and host OS / arch (useful when filing an issue).

$ ngsrv version

ngsrv version 2.2.9

$ ngsrv version --verbose

ngsrv version 2.2.9
build: 2026-05-15T03:01:22Z
commit: 0a1b2c3
os: darwin/arm64

The legacy ngsrv --version flag prints the same compact version line.