Swif CLI is a command-line tool that lets IT admins and engineers manage devices, check compliance, and retrieve agent installer information — all from the terminal. It supports multiple environments, structured output for automation, and secure browser-based authentication.
Installation
Install Swif CLI globally via npm:
npm install -g @swif-ai/cli
Verify the installation:
swif --version
Authentication
Swif CLI uses secure browser-based login. Each session is tied to a profile that corresponds to your Swif environment (us, eu, or dev).
Log in
swif login --profile us
Swif CLI uses browser login by default. If you are in a headless or restricted environment, use device-code login instead:
swif login --device-auth --profile us
For CI or non-interactive use:
swif --no-input login --device-auth --profile us
Check your session
swif auth status --json
swif whoami --profile us
Log out
swif logout --profile us
Logging out clears your saved session for that profile.
Profiles and Context
Swif CLI supports multiple environment profiles. You can work with us, eu, or dev — each maintains its own session and team context.
List available contexts
swif context list --profile us
Show active context
swif context show --profile us
Switch context
swif context use <team-id> --profile us
Device Management
List devices
View all devices in your team:
swif device list --profile us
Filter devices with any combination of these flags:
Flag | Description |
| Filter by device owner |
| Filter by operating system |
| Filter by device type |
| Show only compliant devices |
| Show only non-compliant devices |
| Show devices with an active agent |
| Show devices with no agent installed |
| Show devices with a serial number |
| Show devices without a serial number |
Example:
swif device list --profile eu --os macOS --compliant
Get device details
swif device get <device-id-or-serial> --profile us
Check device status
swif device status <device-id-or-serial> --profile us
Assign a device
Assign an unassigned device to a team member:
swif device assign <device-id-or-serial> --employee user@company.com --profile us
Reassign a device
Transfer a device to a different team member:
swif device reassign <device-id-or-serial> --employee newuser@company.com --profile us
Unassign a device
Remove the current owner from a device:
swif device unassign <device-id-or-serial> --profile us
All write commands include safe failure handling — for example, assigning a device that's already assigned, or unassigning a device with no owner, will return a clear error message without changing any state.
Device Auditing
The device audit command generates report-style results for fleet oversight:
swif device audit --unassigned --profile us
swif device audit --non-compliant --profile eu
swif device audit --mdm-pending --profile us
swif device audit --no-agent --profile us
You can combine audit flags with --owner, --os, and --device-type for more targeted results:
swif device audit --non-compliant --os windows --profile us --output json
When no devices match the audit criteria, the CLI displays a clear summary instead of a blank table.
Agent Installer Lookup
Retrieve the latest Swif agent installer URL for a given OS — useful for scripted deployments and automation pipelines:
swif agent installer latest --os mac --profile us
swif agent installer latest --os windows --profile eu
swif agent installer latest --os linux-arm64 --profile dev
Supported OS aliases include:
macwindowslinux-x64linux-arm64
The installer URL is resolved from backend metadata (not a static CDN path), so it always points to the current release.
Output Formats
Most commands support structured output for scripting and automation:
Flag | Format |
| JSON object |
| Newline-delimited JSON |
(default) | Human-readable table |
Example:
swif device list --profile us --output json
swif agent installer latest --os mac --profile eu --json
Non-Interactive Mode
For CI/CD pipelines and automated scripts, use --no-input to suppress all interactive prompts. The CLI will exit with a non-zero code if user input would normally be required.
Troubleshooting
Issue | Resolution |
Login fails to open browser | The CLI tries ports 8765–8769 for the browser callback. If all are in use, it falls back to device-code login automatically. |
"No employee matched" error | The email you provided doesn't exist in the active team context. Verify the email address and current profile. |
Empty device list | Confirm you are logged in to the correct profile and that your team has enrolled devices in that environment. |
Requirements
Node.js (LTS recommended)
npm
A Swif account with team access
