Skip to content

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.

sunlicense --help

Naming a license ​

Anywhere a license is expected, give whichever you have:

You typeMatches
7QF2-EDRF-CJ78-RBRTThe full key
7QF2A 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 ​

bash
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 --status active

bash
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

sunlicense licenses show

Products and policies ​

bash
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 = unlimited

A 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 ​

bash
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.

bash
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" --json

Product 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.

bash
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-paint
  • seal encrypts 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" names com/example/Foo.class, its entry in the jar). Members never see the key.
  • setup report marks the parts SunLicense can't see from outside done: notice and portal-link.
  • files push uploads 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.

bash
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 only

Deleting and the Trash ​

bash
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 start

Deleted items stay in the Trash for 30 days; their licenses stop working at once. Deleting for good is in the dashboard only.

API keys ​

bash
sunlicense keys
sunlicense keys create --name "Acme Editor 2.x"   # shown once
sunlicense keys revoke "Acme Editor 2.x" --yes    # by name, prefix or id

Obfuscate ​

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.

bash
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
FlagWhat 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 ​

bash
claude mcp add sunlicense --env SUNLICENSE_TOKEN=slp_... -- sunlicense mcp

sunlicense 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 signupCreate an organization and sign in as its Owner
sunlicense whoamiOrganization, role, plan, server, session time left
sunlicense switch [account]List saved accounts, or switch to one
sunlicense logout [account] [--all]Sign out
sunlicense openOpen 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.

bash
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 length

For 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:

bash
SUNLICENSE_TOKEN=$SUNLICENSE_CI_TOKEN sunlicense licenses --status active --json | jq length

Or sign in once with it (echo "$TOKEN" | sunlicense login --with-token), or with a password:

bash
echo "$SUNLICENSE_PASSWORD" | sunlicense login --email [email protected] --password-stdin

A 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:

bash
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 id

The 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 ​

CodeMeaning
0Done (for validate and verify-offline: valid)
1Failed, or the license is not valid
2validate / deactivate could not reach SunLicense (your app should fall back to its offline license)
130You cancelled a prompt

Environment variables ​

Variable
SUNLICENSE_SERVERAPI server for login and signup (default https://api.sunlicense.com)
SUNLICENSE_TOKENUse this personal access token (slp_…) or session token instead of a saved account
SUNLICENSE_CONFIGWhere sessions are saved
SUNLICENSE_API_KEYAPI key for validate and deactivate (else read from the project's .env.local or .env)
SUNLICENSE_LICENSE_KEYLicense key validate and deactivate use without --key (else read from the project's .env.local or .env)
SUNLICENSE_PUBLIC_KEYPublic key for verify-offline
SUNLICENSE_NO_UPDATE_CHECKSet to 1 to turn off the daily update check
SUNLICENSE_DOWNLOAD_URLWhere sunlicense update downloads from (default https://sunlicense.com/download)
NO_COLORPlain output, no colours

Send feedback

Found something broken, or have an idea? It goes straight to our board.

The first line becomes the title.
Images (optional, up to 5: paste, drop or capture)
Check each image before sending, and remove any that show something private.

We also receive this page's address and your browser version.

Ctrl Enter to send