Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@loftyai/lofty-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
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 with automatic priority fallthrough. Choose the one that fits your use case.
Method 1: Token URL (CI/CD & Automation — Highest Priority)
For automated environments where you exchange a session ID for tokens via a custom endpoint. Set two env vars; tokens are fetched and cached automatically.
export LOFTY_TOKEN_URL="https://your-auth-server.com/api/token"
export LOFTY_SESSION_ID="your_session_id"To explicitly fetch and verify:
lofty-cli auth login-session
# Or with inline flags (overrides env vars):
lofty-cli auth login-session --tokenurl https://... --sessionid your_session_idTokens are cached in ~/.config/tokens/lofty-session-cache.json and refreshed automatically when expired.
Method 2: Browser Authorization (Recommended for humans)
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 3: 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 4: 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 (all levels)
lofty-cli auth test # Verify with a real API callEnvironment Variables
| Variable | Required | Description |
|---|---|---|
LOFTY_TOKEN_URL |
For Token URL mode | Endpoint to exchange session ID for tokens |
LOFTY_SESSION_ID |
For Token URL mode | Session ID sent to LOFTY_TOKEN_URL |
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 login-session |
Fetch and cache token via Token URL + Session ID |
lofty-cli auth login-browser |
Authorize via browser (OAuth PKCE) |
lofty-cli auth login |
Manually obtain OAuth access_token |
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 (Token URL cache, PKCE, OAuth cache, customer key) |
lofty-cli auth status |
Show authentication status overview (all levels) |
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 |