lmsq
v0.1.6
Published
CLI for the Lemon Squeezy API — manage your store, subscriptions, orders, and more from the command line. AI-agent optimized output.
Maintainers
Readme
Unofficial — this project is not affiliated with or endorsed by Lemon Squeezy. It is a community-built tool powered by the official TypeScript SDK.
Comprehensive command-line interface for the Lemon Squeezy API. Full API coverage with AI-agent optimized output.
Features
- Complete API coverage — 62 operations across 22 resource types (stores, orders, subscriptions, license keys, checkouts, webhooks, and more)
- AI-agent optimized — flat
key: valueoutput by default,--fieldsto select specific attributes,--only-ids/--count/--pluckfor minimal output - Works everywhere — ships as a single JS file, installs via npm/npx/yarn/pnpm/bun (Node.js 18+)
- Developer-friendly — comprehensive
--helpon every command, consistent patterns, descriptive error messages - Multiple output modes — auto-detects TTY for colored tables vs. token-efficient text.
--jsonfor clean flattened JSON.
Give it to your AI agent
Install the Agent Skill so your AI assistant knows how to use lmsq — all commands, flags, output modes, and best practices:
npx skills add miketromba/lemonsqueezy-cliThat's it. Your assistant can now manage your Lemon Squeezy store from any conversation.
Installation
npm (recommended)
npm install -g lmsqWorks with any package manager — Node.js 18+ required:
npm install -g lmsq # npm
yarn global add lmsq # yarn
pnpm add -g lmsq # pnpm
bun add -g lmsq # bunOr run without installing:
npx lmsq --helpVerify:
lmsq --versionFrom Source
git clone https://github.com/miketromba/lemonsqueezy-cli.git
cd lemonsqueezy-cli
bun install
bun run dev -- --help # run from source (requires Bun)Quick Start
# 1. Authenticate with your Lemon Squeezy API key
lmsq auth login --key lsq_live_xxxxxxxxxxxx
# 2. Verify
lmsq auth status
lmsq user
# 3. Start using it
lmsq stores list
lmsq orders list --page-size 3
lmsq subscriptions list --filter-status active --countUsage Examples
# Get a specific order
lmsq orders get 12345
# List active subscriptions (just IDs)
lmsq subscriptions list --filter-status active --only-ids
# Get a subscription status (bare value — 1 token)
lmsq subscriptions get 456 --pluck status
# List orders with specific fields only
lmsq orders list --fields status,total,user_email
# Create a checkout
lmsq checkouts create --store-id 1 --variant-id 1
# Create a discount
lmsq discounts create --store-id 1 --name "Launch Sale" --amount 20 --amount-type percent
# Issue a full refund
lmsq orders refund 12345
# Activate a license (public API, no auth needed)
lmsq licenses activate --key XXXXX-XXXXX-XXXXX --instance-name "my-server"
# Get clean JSON output
lmsq orders get 12345 --json
# Get raw JSON:API response
lmsq orders get 12345 --json-rawOutput Modes
The CLI auto-detects whether stdout is an interactive terminal:
- TTY (terminal) — colored tables with pagination hints
- Non-TTY (piped/AI agent) — flat
key: valuelines, no colors, no decoration
Override with flags:
| Flag | Effect |
|------|--------|
| --json | Clean flattened JSON (no JSON:API wrappers) |
| --json-raw | Full unmodified API response |
| -f, --fields id,status,email | Only return specific attributes |
| --only-ids | One ID per line (list commands) |
| --count | Just the total count (list commands) |
| --pluck status | Just the bare value (get commands) |
| --first | Return only the first result (list commands) |
| -p, --page N | Page number (default: 1) |
| -s, --page-size N | Results per page (default: 5, max: 100) |
Commands
lmsq auth login / logout / status
lmsq user Show authenticated user
lmsq stores list / get
lmsq customers list / get / create / update / archive
lmsq products list / get
lmsq variants list / get
lmsq prices list / get
lmsq files list / get
lmsq orders list / get / invoice / refund
lmsq order-items list / get
lmsq subscriptions list / get / update / cancel
lmsq subscription-invoices list / get / generate / refund
lmsq subscription-items list / get / update / usage
lmsq usage-records list / get / create
lmsq discounts list / get / create / delete
lmsq discount-redemptions list / get
lmsq license-keys list / get / update
lmsq license-key-instances list / get
lmsq checkouts list / get / create
lmsq webhooks list / get / create / update / delete
lmsq affiliates list / get
lmsq licenses activate / validate / deactivateEvery command has full --help. Drill down for details:
lmsq --help # All command groups
lmsq subscriptions --help # All subscription actions
lmsq subscriptions update --help # All update optionsAuthentication
# Interactive (prompts for key)
lmsq auth login
# Direct
lmsq auth login --key lsq_live_xxxxxxxxxxxx
# Environment variable (CI/CD, scripts, AI agents)
export LEMONSQUEEZY_API_KEY=lsq_live_xxxxxxxxxxxx
# Per-command override
lmsq stores list --api-key lsq_test_xxxxxxxxxxxxResolution order: --api-key flag > LEMONSQUEEZY_API_KEY env var > ~/.config/lemonsqueezy-cli/config.json
AI Agent Usage
The CLI is designed as a first-class tool for LLMs, coding assistants, and autonomous agents. When called via shell tools (non-TTY), output is automatically token-efficient:
# ~3 tokens
lmsq subscriptions list --filter-status active --count
# 47
# ~20 tokens per resource
lmsq orders list --fields id,status,total
# id: 12345
# status: paid
# total: 4900
#
# id: 12346
# status: refunded
# total: 2900
#
# [page 1/10, 47 total]
# 1 token
lmsq subscriptions get 456 --pluck status
# activeToken savings by output mode:
| Mode | Tokens per resource |
|------|-------------------|
| --json-raw (full JSON:API) | ~2,000 |
| --json (flattened) | ~200 |
| Default text (all fields) | ~150 |
| --fields id,status | ~20 |
| --only-ids | ~5 |
| --count | ~3 total |
Development
Requires Bun for development (the published package only needs Node.js).
git clone https://github.com/miketromba/lemonsqueezy-cli.git
cd lemonsqueezy-cli
bun install
bun test # 59 tests, ~14ms
bun test --watch # TDD workflow
bun run lint # Biome linter
bun run typecheck # TypeScript check
bun run dev -- --help # Run from source (Bun)
bun run build # Bundle for Node → dist/lmsq.js
node dist/lmsq.js --help # Verify the Node bundle worksHow the build works
bun run build compiles all TypeScript source + all dependencies into a single dist/lmsq.js file (~111 KB) with a #!/usr/bin/env node shebang. Zero runtime dependencies — everything is inlined. This is what gets published to npm.
prepublishOnly runs the build automatically before npm publish, so you can never accidentally publish without building.
License
MIT
