Command reference
All commands support the --json flag for machine-readable output.
Authentication
lark login
Log in to Lark via your browser. Opens the dashboard authorization page, and the CLI receives your session token automatically.
Your session is saved to ~/.lark/config.json.
lark logout
Log out and clear the stored session.
lark whoami
Show the currently logged-in user.
Configuration
lark config set-project <id>
Set the default project for all commands. The project is verified before saving.
lark config show
Show current configuration.
Projects
lark projects list
List all your projects.
lark projects create <name>
Create a new project. The name is converted to a DNS-compatible project ID automatically.
lark projects show [id]
Show project details including settings, secret key, and database counts. Uses the default project if id is omitted.
lark projects update [id]
Update project settings. At least one setting flag is required.
lark projects delete [id]
Delete a project and all its databases. This is irreversible.
lark projects regenerate-secret [id]
Regenerate the project secret key. The old key is immediately invalidated.
Databases
lark databases can be shortened to lark db.
lark db list
List databases in the current project.
lark db create <id>
Create a new database.
lark db delete <id>
Delete a database and all its data. This is irreversible.
Data
All data commands require a database ID and most require a path. Paths start with /.
lark data get <database> <path>
Read data at a path.
lark data set <database> <path> <value>
Overwrite data at a path. Use - as the value to read from stdin.
lark data update <database> <path> <value>
Shallow merge data at a path. Existing keys not in the payload are preserved. Use - for stdin.
lark data push <database> <path> <value>
Push data with an auto-generated key. Returns the generated key. Use - for stdin.
lark data delete <database> <path>
Delete data at a path.
lark data export <database> [path]
Export data as JSON. Path defaults to / (entire database).
lark data import <database> [path]
Import data from a JSON file. Path defaults to /. This overwrites data at the target path.
Import overwrites all data at the target path. If you import to /, the entire database is replaced.
lark data watch <database> <path>
Stream real-time changes as Server-Sent Events. Press Ctrl+C to stop.
Output:
With --json, outputs newline-delimited JSON (one object per line):
Security rules
lark rules get [id]
Get the current security rules for a project. Uses the default project if id is omitted.
lark rules set [id]
Set security rules from a file or stdin. Supports JSON5 (comments and trailing commas). Uses the default project if id is omitted.
Monitoring
lark dashboard [id]
Show project metrics. Uses the default project if id is omitted. Defaults to the last 24 hours.
Displays:
- Current: CCU, peak CCU, bytes in/out, reads/writes, permission denials
- Summary: Peak CCU, total bandwidth, total operations, average latency
- Recent events: Last 10 events
lark events [id]
Show project events (connections, errors, warnings). Uses the default project if id is omitted.
lark billing [id]
Show billing information. Uses the default project if id is omitted. Defaults to the current billing period.
Displays: period start, peak CCU, total bandwidth, total storage.
Global flags
These flags work with every command:
Configuration file
The CLI stores its configuration in ~/.lark/config.json. This file is created automatically when you run lark login and contains your session token and default project setting.
You generally don’t need to edit this file directly.