ChartnautDocs

Sign in

chartnaut login connects the CLI to your Chartnaut account through your browser. You approve it once per computer, and the CLI stays signed in until its key expires, after 90 days by default, or until you sign out or revoke it.

It works on every plan, Free included. Plans

Sign in

Run chartnaut login. It prints a code and opens your browser:

$ chartnaut login
Opening your browser… (or go to https://terminal.chartnaut.com/morpheus/cli-auth?code=KTRW-BHXM)
Code: KTRW-BHXM
  1. In the browser, check that the code on the page matches the one in your terminal. The page also shows your computer's name.

  2. Click Connect. If you are signed out of Chartnaut, sign in first and the page comes back.

  3. The page reads Connected. You can close this tab., and the terminal finishes:

Signed in as jane.
The Connect the Chartnaut CLI page
The approval page, showing the computer's name and the code.

The code works for 10 minutes. Cancel on the page stops the sign-in, and the terminal prints Sign-in cancelled.

Choose how long the key works

The approval page says This key expires on a date, with a choice of 7 days, 30 days and 90 days. It offers only lengths up to what the terminal asked for, so whoever approves can shorten the key's life but never lengthen it. The terminal prints the expiry date once you are signed in.

chartnaut login asks for 90 days. Ask for less with --expires:

chartnaut login --expires 7d

--expires takes 7d, 30d or 90d.

Connect only a code you started yourself. Anyone who gets you to click Connect on their code gets a terminal signed in to your account.

Check who you are signed in as

$ chartnaut whoami
user:   jane
plan:   starter
key:    CLI on Janes-MacBook-Pro.local · expires 2027-01-09
scopes: scripts:read scripts:write runs:write
api:    https://api.chartnaut.com/v1

When the key is about to expire

From 7 days before the expiry date, every command prints a one-line warning on stderr with the date, and still does its work. Run chartnaut login --force before then to get a fresh key without a gap. Once the key has expired, every command says your key expired. Run chartnaut login. and exits 3, and a plain chartnaut login signs you in again.

What signing in creates

Signing in creates an API key named CLI on followed by your computer's name. It has every scope and the expiry chosen when you approved it. Keys made by chartnaut login before sign-in keys had an expiry were given one 90 days after that change shipped. It is listed with your other keys on the Developers page, in the menu under your name, and revoking it there signs that computer out.

The CLI saves the key in ~/.config/chartnaut/credentials.json, readable only by you. Your own program can sign in the same way with Start a sign-in and Poll a sign-in. On Windows the folder is under your user folder, %USERPROFILE%\.config\chartnaut.

Sign in on a server or over SSH

chartnaut login --no-browser prints the link instead of opening a browser. Open it on any device where you are signed in to Chartnaut, such as your phone, and click Connect. The terminal finishes on its own.

Use a key you already have

For CI or a machine you cannot approve from, make a key under Developers with Create API key, then either save it:

chartnaut login --token cn_live_…

or set it in the environment. CHARTNAUT_TOKEN overrides the saved key for every command:

export CHARTNAUT_TOKEN=cn_live_…

With CHARTNAUT_TOKEN set, login and logout still change the saved key, and each prints a reminder that the variable is still set and wins. API keys

Switch account or sign in again

chartnaut login on a computer that is already signed in stops there:

Already signed in as jane. Use --force to switch.

chartnaut login --force signs in again. Once the new sign-in works, the CLI revokes the key it used before, so you are not left with an old key that still works. If the saved key was already revoked or has expired, a plain chartnaut login signs you in again without --force.

Sign out

$ chartnaut logout
Signed out.

logout revokes this computer's key on Chartnaut and deletes the saved copy. If Chartnaut cannot be reached, it deletes the copy and prints Signed out here. Revoke the key in Settings → Developers to finish. Do that on the Developers page.

When sign-in does not work

You see

Cause

What to do

This code has expired. on the page, or The code expired. in the terminal

More than 10 minutes passed.

Run chartnaut login again.

error: unauthorized: not logged in. on any command

This computer has no saved key and CHARTNAUT_TOKEN is not set.

Run chartnaut login.

your key expired. Run chartnaut login.

The key reached its expiry date.

Run chartnaut login.

plan_limit on a command

It would pass a plan cap, such as a fourth definition on Free. The message says which.

Upgrade, or make room. Plans

All of these exit with code 3. Errors and exit codes