How-To · 5 min

Licences, devices & 402s

One page for all of licensing: how it works, both activation paths, restoring after a trial, registering headless machines, device limits, offline behaviour — and every cause of a 402 with its fix.

How licensing works

Three facts make the rest of this page simple: a licence is attached to your CHYNJ account email, however it was issued; a device is "connected" when its fingerprint is registered against the licence — Kaptain does that for you at activation (only a SHA-256 of the fingerprint ever leaves the machine); and your account portal is the source of truth — your key and every connected device live there, even if a licence email never arrived (check spam for [email protected], or just copy the key from the portal's License card).

Activate: sign in, or paste a key

Option A — sign in (recommended). On the wizard's Account step, sign in with the account the licence is on (2FA code if enabled). Kaptain finds the licence attached to your email, applies it, and registers this machine automatically — it appears under Devices in your portal, and the device certificate enrolls in the same act. From then on the box re-checks your account every few hours, so renewals and licence moves apply themselves.

Option B — paste the key. On the Plan step, Have a license key? reveals the field (already visible on an expired-trial machine); paste KAPTAIN-XXXXXXXX-XXXX-XXXX and continue. Use this when only the key travelled — a teammate's machine, say.

Restore after a trial (including a remote machine)

A trial binds to the machine, so a box whose trial ended doesn't know about a licence you got later. You never reinstall — the licence and sign-in screens stay reachable on an expired box. On that machine, sign in (durable: licensing becomes automatic from then on) or paste the key on the "Trial expired" screen. Remote? With Tailscale enabled open http://<its-tailnet-address>:8810 from anywhere; otherwise SSH/remote-desktop in and open http://localhost:8810 there.

Headless box (SSH only): kaptain device register (flags: --nickname "build-server", --no-browser, --json) — it prints a URL and short code and waits; approve from any browser; it finishes by printing this box's access code once; then kaptain stop then kaptain start (one line on Linux/macOS: kaptain stop && kaptain start). Nothing is ever pasted into the command and a password is never typed into the CLI. (kaptain account accepts only status/open; kaptain license only status/refresh — no signin, no set.)

402 — every cause

Every API answer of 402 carries the same message: this machine holds no current signed entitlement. These are all the ways to get here, and the right fix for each:

CauseHow it happensFix
Never bound (the common one)fresh install where account sign-in was skippedkaptain device register — steps below
Device revokedthe device was deleted in your account portalre-register the same way
Lease expiredthe box was offline long enough that the background refresh couldn't renew (a short outage is fine — leases outlive it)reconnect to the internet; it renews itself. Still 402 after that: re-register
Moved to new hardwarethe data folder was copied to a different machine — the certificate is bound to the original installationregister the new machine (see moving a box)
Trial endedthe server stops issuing leases when the trial is consumedsubscribe or restore in the portal, then refresh
Clock skewthe machine's clock is far enough off that the lease "isn't valid yet"fix the system clock
Build below minimum versiona lease can require a minimum safe Kaptain versionSettings ▸ Update Kaptain, or kaptain update

kaptain device status and kaptain license status print exactly which of these this machine is in. (Dev builds without compiled trust keys don't run this gate at all — 402 is a release-build behaviour.)

The fix, step by step

  1. On the Kaptain machine:
    kaptain device register
    It prints a short pairing code and waits.
  2. Open chynj.ca/account (any device), sign in, approve the code. The command notices within seconds.
  3. It finishes by writing the device certificate and a fresh access code (chynj_…) — shown once. Save it: every paired browser and phone re-pairs with this new code, one time.
  4. Restart if it was running: kaptain stop then kaptain start (one line on Linux/macOS: kaptain stop && kaptain start). 402s are gone.

Codes expire if left unapproved — if the portal rejects one, just run the command again for a fresh code.

What changes afterwards

Why pasting a licence key isn't enough

A licence key activates a plan; the device certificate proves this machine may use it. Pasting a key alone never issues a certificate — sign in during setup or run kaptain device register. Until one has run, a release build can refuse the machine with exactly the 402 this page opens with.

Devices, limits & offline

Troubleshooting

Agent-readable version: index.md · Every claim on this page was exercised on a real install before being written. Something missing that cost you time? That is a documentation bug — tell us.