Skip to content

Sell activation keys

For retail sale, for example a box on a shelf or a key sold by a reseller, sell activation keys. The customer types a key into your software, and LaaSio activates it on up to the key’s device limit. Every device on a key shares one term, which starts at the key’s first activation.

  1. On the Keys tab in the console, generate keys or upload your own from a CSV file, and link each key to a SKU. A key without a SKU is stock: it can’t be activated yet.
  2. Your software sends the key once, when the customer enters it, in the body of POST /api/v1/lookup.
  3. LaaSio puts the device on the key, as an ordinary client holding the key’s SKU, and answers with its signed licenses and a verdict on the key.
  4. From then on, the ordinary lookup returns the device’s licenses. No key needed.

Like the lookup, these calls use only public values (your organization ID, the client ID and the key), so they are safe to build into your software. Activation keys are included from the Indie plan.

  • Device limit: how many devices a key may activate. LaaSio enforces it. It is separate from your SKU’s limits, which your software reads and enforces itself.
  • Values: generated keys look like XXXXX-XXXXX-XXXXX-XXXXX (100 bits, so they can’t be guessed). Uploaded keys may be any 6 to 64 letters and digits. Matching ignores case, spaces and dashes, so abcde-12345 and ABCDE12345 are the same key.
  • Term: starts at the first activation and runs for the SKU’s duration. Later devices join that term.
  • Status: unused, active, expired, locked, used (spent as a renewal key) or revoked.

POST /api/v1/lookup takes the lookup’s fields in a JSON body, plus the key:

Field Required Description
org yes Your organization ID.
client yes The device’s client ID, as in the lookup.
key no The key the customer typed. Without it, the call is a plain lookup.
key_action no Leave out to activate. renew uses the key as a renewal key.
app no As in the lookup.

The answer is the lookup’s answer plus activation, LaaSio’s verdict on the key:

{
"data": [ "…signed license entries, as in the lookup…" ],
"activation": { "result": "refused", "reason": "key_full",
"message": "This key is already active on the maximum number of devices. Remove a device from it first." }
}
result Meaning
activated The device is on the key now. The first activation starts the key’s term.
moved The device was on another key and moved to this one. Its old slot freed up.
already_active The device was already on this key. Nothing changed.
renewed The renewal key extended the device’s key, for all of its devices.
refused Nothing changed. reason and message say why. Show message to the customer.

A refused key changes nothing, and the lookup still answers. If the application has a default SKU, the device can still get its trial.

A device that already has a license for the key’s application:

  • an automatic trial is replaced by the key, and counts as a converted trial;
  • an assignment that has ended is replaced;
  • a running license you assigned is kept, and the key is refused with already_licensed.
reason Meaning
key_invalid No such key, or it was revoked or used up as a renewal key.
key_locked The key is locked.
key_not_ready The key is not linked to a SKU yet.
key_expired The key’s term has ended.
key_full The key is on its maximum number of devices. The customer can remove one first.
key_in_use A renewal key that was already used or activated.
no_key_to_renew Renewing, but the device is not on a key the renewal key can renew.
already_licensed The device already has a running license you assigned.
client_invalid The client ID contains spaces.
plan_required Your LaaSio plan doesn’t include activation keys.
plan_limit Adding clients is paused on your plan (see Plans and limits). Devices already activated keep working.
too_many_attempts Too many invalid keys from this IP address. Invalid keys are limited to 10 per IP address per hour.

To sell renewals in the same way, sell another key for the same application. The customer enters it with key_action: "renew". An unused renewal key extends the key the device is on:

  • the term grows by the renewal key’s SKU duration, counted from the current end (even if it has lapsed);
  • the key takes the renewal key’s SKU and device limit;
  • every device on the key is renewed at once, so the customer enters the renewal key on one device only;
  • the renewal key is used up and can’t be activated anywhere.

Without key_action, a new key always means use this key for this device: the device moves to it, and the rest of the household stays on the old key.

POST /api/v1/deactivate with org, client and key in the body takes the device off its key, for example before the customer replaces the computer. Its slot frees up. Only the device on the key with that client ID can leave, and it works even when the key is locked.

The answer is {"deactivation": {"result", "reason", "message"}}, with result either deactivated or refused. A refusal’s reason is key_invalid, not_on_key or too_many_attempts.

Each example defines activateKey() and deactivateKey(), then activates the example key and prints the verdict. Check licenses with the lookup examples as usual.

Terminal window
# Activate (add "key_action": "renew" to use it as a renewal key)
curl -s -X POST 'https://laasio.functual.com/api/v1/lookup' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"org":"lzo_YOUR_ORG_ID","client":"PC-123","key":"ABCDE-12345-FGHIJ-KLMNO"}'
# Deactivate this device (frees its slot on the key)
curl -s -X POST 'https://laasio.functual.com/api/v1/deactivate' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"org":"lzo_YOUR_ORG_ID","client":"PC-123","key":"ABCDE-12345-FGHIJ-KLMNO"}'

Your servers can manage keys with the provisioning key, for example to build a “My devices” page in your customer portal, or to revoke a key after a chargeback. Keys are addressed by their ID, shown in the address of the key’s page in the console. Devices are addressed by their client ID.

Endpoint Body Effect
POST /api/v1/activation-keys/{id}/devices/add client_id Puts a device on the key, under the same rules as activating from the software. Refused: 422 with reason.
POST /api/v1/activation-keys/{id}/devices/remove client_id Takes a device off the key. Its slot frees up.
POST /api/v1/activation-keys/{id}/renew end (optional) Extends an activated key by one SKU duration, or to a later end. Every device follows.
POST /api/v1/activation-keys/{id}/lock No new activations, moves or renewals. Devices already on the key keep working.
POST /api/v1/activation-keys/{id}/unlock Undoes a lock.
POST /api/v1/activation-keys/{id}/revoke Revokes the key for good. Every device on it loses the license at once.

Each answers with the key: its status, devices (how many devices are on it), max_devices, its SKU and its term. An unknown key ID is a 404.

Example: removing a device from a key.

Terminal window
curl -X POST 'https://laasio.functual.com/api/v1/activation-keys/KEY_ID/devices/remove' \
-H "X-API-Key: $LAASIO_PROVISIONING_KEY" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"client_id":"PC-123"}'