Links CLI
Reach your devices and spaces from a terminal: sign in with your browser, list them, watch live streams and send commands.
This guide begins with What the CLI does, continues through Install, Sign in with your browser, Sign in without a browser, and finishes with A first session.
What the CLI does
The Links CLI (links) is the Device Terminal of the dashboard on your computer. From a terminal you can:
- list every device and every space your account reaches, online or offline
- connect to a device and watch its live event stream
- enter a space and watch all of its devices at once
- send device commands and space commands your role allows, such as
/identify,/lights 60or/power on
Your password never goes into the terminal. You sign in on the Links web page, the same way you sign in to the dashboard, and the CLI receives a token that works for 90 days and that you can revoke at any time.
Install
The CLI needs Node.js 20 or newer. Check with node --version.
npm install -g @linkseverything/cli
links --version
To run it once without installing:
npx @linkseverything/cli login
To update to the latest version, run the install command again.
Sign in with your browser
links login
- Your browser opens the Links sign-in page. Sign in as you do on the dashboard: password, two-factor code, SSO or passkey.
- The page asks Allow Links CLI to sign in? and shows the computer's name and what the CLI will reach: every workspace you belong to, or every workspace if you are a platform admin. Select Allow.
- The browser shows Signed in and the terminal confirms the account.
If the browser does not open, the terminal prints the address: paste it into any browser on the same computer.
The token is saved in ~/.links/credentials, readable only by your user (file 0600, folder 0700).
127.0.0.1) for the browser to come back, and proves with a one-time secret (PKCE) that it started the sign-in. The one-time code is valid for 60 seconds and works once. A sign-in link copied to another machine does not work.Sign in without a browser
On a server or any machine without a browser, create a token in the dashboard and paste it:
- Open Settings > Security & Apps > CLI access and select Create token.
- Give it a name, for example
build server, and copy the token. It starts withlkat_and is shown once. - On the machine run:
links login --token
and paste the token when asked; nothing is echoed while you paste. You can also pipe it: links login --token < token.txt.
For CI jobs, do not save a login: put the token in the LINKS_TOKEN environment variable. It is used instead of the saved file.
A first session
Start the terminal with links, then type commands that start with /. /help always lists what you can use right now.
$ linksSigned in as Ada Lovelace (workspace admin, 2 workspaces). Type /help.links> /listID Device Type Status Workspace Space3f9a1c2e Meeting Room Display smartDisplay online Acme Meeting Room 2links> /connect 3f9a1c2eConnected to Meeting Room Display 3f9a1c2e (smartDisplay, online). Streaming; Ctrl+C or /disconnect to stop.links:meeting-room-display> /identifysent smartDisplay.identifylinks:meeting-room-display> /disconnectlinks> /spaces --with-devicesID Space Type Location Workspace Devices4f2a9c1e Focus POD 1 POD Floor 2 Acme 2links> /space 4f2a9c1eEntered Focus POD 1 4f2a9c1e (POD, Acme). 2/2 devices online; space control online.links:space:focus-pod-1> /lights 60sent lights.setBrightness {"value":60}links:space:focus-pod-1> /leavelinks> /exit
Every device and space has a short ID: the first 8 characters of its uuid, like a short git commit hash. It never changes when lists change, so you can note it, share it or put it in a script and it keeps pointing at the same device. A name works too; when a name matches more than one, the CLI lists them with their IDs instead of guessing. Tab completes IDs and names after /connect and /space.
The full list of commands is in Links CLI command reference. Who may run which command is in Links CLI access, roles and security.
One command without the terminal
links run sends one command to a device or a space by its ID and exits. Use it in scripts, schedules or a note you keep for later:
$ links run 3f9a1c2e /identifysent smartDisplay.identify to Meeting Room Display 3f9a1c2edevice answered: executed$ links run 4f2a9c1e /lights 60sent lights.setBrightness to Focus POD 1 4f2a9c1e$ links run 3f9a1c2e /reboot/reboot asks for confirmation; add --yes to send it to Meeting Room Display.$ links run 3f9a1c2e /reboot --yessent smartDisplay.reboot to Meeting Room Display 3f9a1c2e
Space commands (/lights, /fan, /power and the others) take a space's ID; every other command takes a device's ID. For a device that is online, the CLI waits up to 8 seconds for the device's answer.
| Exit code | Meaning |
|---|---|
| 0 | Sent |
| 1 | Error: unknown ID, a name that matches more than one, or a command the device cannot do |
| 3 | Your level does not allow the command |
| 4 | The command asks for confirmation; add --yes |
Scripts and AI agents
Everything the terminal does also works without it, so a script or an AI agent can use the CLI: find a device, listen to it, act on it. Add --json to get one JSON value per line.
$ links list --json[{"id":"3f9a1c2e","name":"Meeting Room Display","type":"smartDisplay","online":true,"workspace":"Acme","space":"Meeting Room 2"}]$ links watch 3f9a1c2e --json{"kind":"watching","target":"device","id":"3f9a1c2e","name":"Meeting Room Display","online":true}{"kind":"event","live":true,"device":{"id":"3f9a1c2e","name":"Meeting Room Display"},"event":"commandAck","payload":{"request":{"status":"executed"}}}$ links run 3f9a1c2e /identify --json{"ok":true,"exitCode":0,"command":"smartDisplay.identify","commandId":"804aace5-...","ack":"executed"}
| Command | What it does |
|---|---|
links list [--all] [--json] | Devices with their IDs |
links spaces [--with-devices] [--json] | Spaces with their IDs |
links watch <id> [--json] | Streams one device's events (or every device of a space) until Ctrl+C |
links watch <id> --for 60 | Stops after 60 seconds |
links watch <id> --until commandAck | Stops at the first event of that type |
links run <id> /command [--json] [--yes] | Sends one command and reports the device's answer |
An agent usually runs links watch <id> --json in the background, reads the lines as they come, and acts with links run <id> /command --json. Events from before the watch started arrive with "live":false. The agent works with the signed-in account's token and can do only what that account's role allows; give an agent its own token (created in CLI access) so you can revoke it on its own.
Commands outside the terminal
| Command | What it does |
|---|---|
links login | Sign in with your browser |
links login --token | Sign in with a token created in the dashboard |
links | Start the interactive terminal |
links list, links spaces | Devices or spaces with their IDs (--json for scripts) |
links watch <id> | Stream one device's or space's events (--json) |
links run <id> /command | One command to a device or space, then exit |
links whoami | The signed-in account, its access level and the token's expiry |
links logout | Revoke this token on the server and delete the saved file |
links --version | The installed version |
links --help | Usage |
