Commands and scripting
Everything the app does is also a command. In a terminal, a command that's missing something asks for it (a policy to pick, a customer's email); in a script it never prompts, and says which flag is missing instead.

Naming a license
Anywhere a license is expected, give whichever you have:
| You type | Matches |
|---|---|
7QF2-EDRF-CJ78-RBRT | The full key |
7QF2 | A license whose key starts with this (if only one does) |
[email protected] | The customer's email (if they have one license) |
1dac7798-d6db-… | The license id |
With nothing, in a terminal, you get a list to pick from.
Licenses
sunlicense licenses # all, newest first; keys masked
sunlicense licenses --status active -s acme # filter by status and text
sunlicense licenses --product "Acme Paint" --reveal
sunlicense licenses show [email protected] # details, machines and recent checks
sunlicense licenses issue # asks for policy and customer; copies the key
sunlicense licenses issue --policy Studio --product "Acme Paint" --email [email protected] --name "Olivia Chen"
sunlicense licenses revoke 7QF2 # asks first; --yes to skip
sunlicense licenses suspend 7QF2 --yes
sunlicense licenses reinstate 7QF2
sunlicense licenses download 7QF2 -o olivia.lic # signed offline file (- for stdout)
sunlicense licenses delete 7QF2 # to the Trash; asks first, --yes to skip
Products and policies
sunlicense products
sunlicense products create "Acme Paint" --description "Raster image editor"
sunlicense policies --product "Acme Paint"
sunlicense policies create --product "Acme Paint" --name Studio --type subscription --machines 3 --days 365
sunlicense policies create --product "Acme Paint" --name Lifetime --type perpetual --machines 0 # 0 = unlimitedA product is the app you sell; a policy is the terms its licenses get. Policies can be named the same in different products, so add --product when a name repeats.
Product analytics
sunlicense analytics # active installs of every product
sunlicense analytics "Acme Paint" # installs now, today and in 30 days
sunlicense analytics acme-paint --days 30 # plus installs per day
sunlicense analytics acme-paint --metric os # by operating system, in the last complete hour
sunlicense analytics acme-paint -m runtimeVersion --parent java --days 7 # Java versions, per day on average
sunlicense analytics acme-paint -m features -d 30 # feature usage (Lite and Standard)Metrics: installs, licensed, productVersion, os, osVersion, arch, cores, locale, runtime, runtimeVersion, platform, platformVersion, country, sdk, features, or chart:<id> for a custom chart. --source licensed|unlicensed filters, --limit shows more values, --json prints the API's answer. The same numbers are on the product's Analytics tab (product analytics); sunlicense init prints the product analytics id and the snippet that starts reporting.
On Standard, sunlicense analytics page create builds one analytics page for a product: active installs, licensed vs unlicensed, product version, platform and OS, feature usage (with --features) and the custom charts named with --charts (their ids in your code). A chart your app reported a moment ago can take a little while to show up, so it waits for it (--wait, default 60 s); running it again updates the page with the same title.
sunlicense analytics page create --product acme-paint --charts brush_type,canvas_size --features export,layers
sunlicense analytics page create --product acme-paint --title "Acme Paint at a glance" --jsonProduct setup
Each product has a Setup tab: the parts of a full setup (license check, analytics, core unlock, ownership notice, tamper reports, protected files…) that tick by themselves once your app shows them working. The setup prompt does all of it; these commands are what it runs, and work by hand too.
sunlicense setup status acme-paint # which parts are done
sunlicense setup report --product acme-paint notice portal-link # parts only your code knows about
sunlicense seal core.bin --product acme-paint > core.sealed # core unlock: seal part of the app
sunlicense seal core.bin --product acme-paint -o core.sealed --digest "build/libs/*.jar"
sunlicense files push data/rules.dat --product acme-paint # protected files (Standard)
sunlicense files list acme-paintsealencrypts a file (or stdin,-) under the product's unlock key on SunLicense's servers and prints the sealed text (SLS1.…, at most 512 KB in). Ship it in your app: the SDK unseals it after a valid license check, so a copy with the check removed can't run that part.--digest <glob>(repeatable,**works) puts the SHA-256 of those files inside, so the SDK can report a modified copy. Each file is named by its path below the pattern's folders (--digest "build/classes/java/main/**/*.class"namescom/example/Foo.class, its entry in the jar). Members never see the key.setup reportmarks the parts SunLicense can't see from outside done:noticeandportal-link.files pushuploads protected files (a file with the same name is replaced); licensed copies download them at run time with their license key, and a suspended, expired or revoked license gets nothing.
Releases
Publish a version buyers download, from a release script or CI (Standard). It uploads the files, waits for SunLicense's check and publishes; a draft of the same version gets the files instead. See Publish releases.
sunlicense releases create build/libs/acme-1.4.0.jar --product acme-paint --version 1.4.0 --notes @CHANGELOG.md
sunlicense releases create dist/pack.mcpack --product acme-paint --version 1.5.0-beta.1 --draft # upload, don't publish
sunlicense releases list acme-paint # versions, status, files, storage used
sunlicense releases delete --product acme-paint --version 1.5.0-beta.1 # drafts onlyDeleting and the Trash
sunlicense products delete "Acme Paint" # with its policies and licenses; says how many first
sunlicense policies delete Studio --product "Acme Paint"
sunlicense trash # what's there, what went with it, days left
sunlicense trash restore "Acme Paint" # by name, id or a license's key startDeleted items stay in the Trash for 30 days; their licenses stop working at once. Deleting for good is in the dashboard only.
API keys
sunlicense keys
sunlicense keys create --name "Acme Editor 2.x" # shown once
sunlicense keys revoke "Acme Editor 2.x" --yes # by name, prefix or idObfuscate
Obfuscate a built file on SunLicense's servers and download the result (the obfuscated file, its mapping and a report). The language is detected from the file; the exit code is non-zero if the run fails, so it fits a build or CI step. See Obfuscation.
sunlicense obfuscate build/libs/app.jar # detect the language, use defaults, write next to the file
sunlicense obfuscate build/libs/app.jar --profile release -o dist/
sunlicense obfuscate app.jar --config proguard.pro # a raw engine config (advanced)
sunlicense obfuscate app.jar --engine proguard --json # pick the engine; JSON for scripts
sunlicense obfuscate build/libs/app.jar --product acme-paint # counts toward the product's setup
sunlicense obfuscate profiles # list your saved profiles| Flag | What it does |
|---|---|
--profile <name|id> | Use a saved profile |
--product <code|name|id> | The product this build is for: its linked profile, and the run ticks Obfuscated release builds on its Setup tab |
--engine <id> | Override the language's default engine |
--config <file> | Run a raw engine config (checked first) |
-o, --output-dir <dir> | Where to write the outputs (default: the input file's folder) |
--title <text> | A title for the task (shown under Tasks) |
AI assistants
claude mcp add sunlicense --env SUNLICENSE_TOKEN=slp_... -- sunlicense mcpsunlicense mcp is an MCP server on stdio for Claude Code, Codex, Cursor and other assistants (every plan; Free has 50 tool calls a day). Setup and tools: AI assistants (MCP).
Account
| Command | |
|---|---|
sunlicense login [--email E] [--with-token] [--local | --server URL] | Sign in with your password or a personal access token (details) |
sunlicense signup | Create an organization and sign in as its Owner |
sunlicense whoami | Organization, role, plan, server, session time left |
sunlicense switch [account] | List saved accounts, or switch to one |
sunlicense logout [account] [--all] | Sign out |
sunlicense open | Open the web dashboard |
sunlicense update [--check] [--auto-check on|off] | Install the latest version after checking its signature, only look, or turn the daily check on or off (details) |
Scripts and CI
Add --json to any command for machine-readable output. It's the API's data as-is, so license keys are not masked in JSON.
KEY=$(sunlicense licenses issue --policy Pro --product "Acme Editor" \
--email [email protected] --json | jq -r .key)
sunlicense licenses revoke "$KEY" --yes
sunlicense licenses --status active --json | jq lengthFor CI, create a personal access token (dashboard → Settings → Personal access tokens) with only the scopes the job needs, store it as a secret and pass it in SUNLICENSE_TOKEN (with SUNLICENSE_SERVER for a server other than production); nothing is written to disk then:
SUNLICENSE_TOKEN=$SUNLICENSE_CI_TOKEN sunlicense licenses --status active --json | jq lengthOr sign in once with it (echo "$TOKEN" | sunlicense login --with-token), or with a password:
echo "$SUNLICENSE_PASSWORD" | sunlicense login --email [email protected] --password-stdinA password session lasts 12 hours. Use a member with the smallest role that can do the job.
Test an integration
These use an API key, exactly like your app, not your session:
export SUNLICENSE_API_KEY=slk_...
sunlicense validate # after sunlicense init: the test license from .env
sunlicense validate --key 7QF2-EDRF-CJ78-RBRT # ✓ VALID, and activates this machine
sunlicense validate --key 7QF2-EDRF-CJ78-RBRT --release # ✓ VALID, then frees this machine's slot again
sunlicense validate --key 7QF2-EDRF-CJ78-RBRT --fingerprint machine-b
sunlicense deactivate --key 7QF2-EDRF-CJ78-RBRT # free this machine's slot
sunlicense verify-offline --file license-7QF2.lic # no network; uses your org's key when signed in
sunlicense verify-offline --file license-7QF2.lic --public-key public-key.txt
sunlicense fingerprint # this machine's idThe fingerprint is the CLI's own machine id. Each SDK computes its own, so pass --fingerprint to act on a machine your app registered.
Exit codes
| Code | Meaning |
|---|---|
0 | Done (for validate and verify-offline: valid) |
1 | Failed, or the license is not valid |
2 | validate / deactivate could not reach SunLicense (your app should fall back to its offline license) |
130 | You cancelled a prompt |
Environment variables
| Variable | |
|---|---|
SUNLICENSE_SERVER | API server for login and signup (default https://api.sunlicense.com) |
SUNLICENSE_TOKEN | Use this personal access token (slp_…) or session token instead of a saved account |
SUNLICENSE_CONFIG | Where sessions are saved |
SUNLICENSE_API_KEY | API key for validate and deactivate (else read from the project's .env.local or .env) |
SUNLICENSE_LICENSE_KEY | License key validate and deactivate use without --key (else read from the project's .env.local or .env) |
SUNLICENSE_PUBLIC_KEY | Public key for verify-offline |
SUNLICENSE_NO_UPDATE_CHECK | Set to 1 to turn off the daily update check |
SUNLICENSE_DOWNLOAD_URL | Where sunlicense update downloads from (default https://sunlicense.com/download) |
NO_COLOR | Plain output, no colours |
