@loftyai/lofty-cli
v0.3.9
Published
CLI for the Lofty CRM API - manage leads, agents, listings, tasks, and more
Readme
lofty-cli
CLI for the Lofty CRM API. Made with api2cli.dev.
Install
npm i @loftyai/lofty-cliAuthentication
lofty-cli supports multiple authentication methods. Choose the one that fits your use case.
Method 1: Browser Authorization (Recommended)
The simplest way to authenticate — open a browser, log in, and you're done.
lofty-cli auth login-browserThe browser opens the Lofty login page. After you log in and authorize, the CLI saves the token locally and auto-refreshes it when it expires.
Method 2: OAuth2 Client Credentials
For server-to-server integrations. Requires three credentials.
Step 1: Configure vendor credentials
export LOFTY_CLIENT_ID="your_client_id"
export LOFTY_CLIENT_SECRET="your_client_secret"Register a developer account at Lofty Vendor Portal to obtain these.
Step 2: Configure customer key
Option A — Environment variable:
export LOFTY_CUSTOMER_KEY="eyJhbGciOiJIUzI1NiJ9..."Option B — Save to local file:
lofty-cli auth set "eyJhbGciOiJIUzI1NiJ9..."Log in to Lofty CRM → Settings > Integrations > API to find your Customer Key.
Method 3: Direct Access Token
If you already have an access_token (e.g., from CI/CD or another system):
export LOFTY_ACCESS_TOKEN="your_access_token"
export LOFTY_REFRESH_TOKEN="your_refresh_token"Verify Authentication
lofty-cli auth status # Show authentication status
lofty-cli auth test # Verify with a real API callEnvironment Variables
| Variable | Required | Description |
|---|---|---|
| LOFTY_ACCESS_TOKEN | No | Direct access token (skips other auth methods) |
| LOFTY_REFRESH_TOKEN | No | Refresh token (used with LOFTY_ACCESS_TOKEN) |
| LOFTY_CLIENT_ID | For OAuth mode | Vendor client ID |
| LOFTY_CLIENT_SECRET | For OAuth mode | Vendor client secret |
| LOFTY_CUSTOMER_KEY | For OAuth mode | User's customer key |
| LOFTY_BASE_URL | No | Override API base URL (default: https://api.lofty.com) |
Usage
# View all available resources
lofty-cli --help
# Examples
lofty-cli leads list
lofty-cli leads get --id "lead_id"
lofty-cli leads create --body '{"first_name":"John","last_name":"Doe"}'
lofty-cli transaction list
lofty-cli communication list
lofty-cli tasks-appointments-v2 list --lead-id "lead_id"
lofty-cli calendar-v2 list --lead-id "lead_id"Note: The
tasksresource is deprecated. Usetasks-appointments-v2for task/appointment management andcalendar-v2for calendar/meeting management instead.
Resources
| Resource | Description |
|---|---|
| leads | Lead management (list, get, create, update, delete, etc.) |
| transaction | Transaction/deal management |
| communication | Email, SMS, and communication logs |
| tasks-appointments-v2 | Task & appointment management (replaces tasks) |
| calendar-v2 | Calendar event & meeting slot management |
| notes | Note management |
| calls | Call records |
| alerts | Alert/notification management |
| members | Team member management |
| listings | Property listing management |
| webhooks | Webhook management |
| lead-routing | Lead routing/assignment rules |
| team-features | Team feature toggles |
| agent-org | Agent organization management |
| agent-user | Agent user management |
| log-type | Log type definitions |
| system-logs | System audit logs |
| opportunity | Opportunity management |
| vendor | Vendor management |
Run lofty-cli <resource> --help for detailed commands and options.
Auth Commands
| Command | Description |
|---|---|
| lofty-cli auth set <key> | Save customer key to local file |
| lofty-cli auth show | Display current customer key (masked) |
| lofty-cli auth show --raw | Display full customer key |
| lofty-cli auth remove | Delete customer key and OAuth cache |
| lofty-cli auth logout | Clear all credentials (PKCE, OAuth cache, customer key) |
| lofty-cli auth login | Manually obtain OAuth access_token |
| lofty-cli auth login-browser | Authorize via browser (OAuth PKCE) |
| lofty-cli auth status | Show authentication status overview |
| lofty-cli auth test | Verify auth by making a test API call |
Update Notifications
lofty-cli checks for new versions in the background (at most once every 24 hours). If a newer version is available, a one-line upgrade hint is shown:
Update available: 0.3.1 → 0.4.0
Run: npm install -g @loftyai/lofty-cliGlobal Flags
All commands support:
| Flag | Description |
|---|---|
| --json | Output as JSON |
| --format <type> | Output format: text, json, csv, yaml |
| --verbose | Enable verbose/debug logging |
| --no-color | Disable colored output |
| --no-header | Omit table headers |
