# Licenses

A license gives a customer the right to use a [product](../products/). Your application proves this right with the license key.

Each license is issued from one [policy](../policies/). The policy sets the rules of the license and decides its product. A license cannot move to another policy.

## License properties

| Property | Description |
| --- | --- |
| Key | The license key. Seatify creates the key when the license is issued. The key never changes. See [License keys](#license-keys). |
| Policy | The policy that the license was issued from. |
| Owner | The [customer](../customers/) who bought the license. The owner is the billing and support contact. The people who use the license are its [seats](../seats-and-devices/). This property is optional. |
| Name | A name for the license. This property is optional. |
| Expiry date | The date when the license expires. See [Expiry](#expiry). |

## License keys

A license key looks like this:

```text
PRO-7KQ4M-X2HNC-9RWTB-FJ3YD-8VMPA
```

- The key has five groups of five characters. Dashes separate the groups.
- If the policy has a key prefix, the prefix comes first. See [Policy properties](../policies/#policy-properties).
- The five groups use the digits 2 to 9 and upper-case letters. They never use 0, 1, I, L, O or U, because these characters are easy to confuse.
- Seatify removes spaces around the key and ignores the case of the letters. The dashes must match.
- Store the key in upper case. Your application decrypts an [encrypted license file](../policies/#offline-validation) with a key that is made from the license key, so the case matters there.
- A key is valid only for its own product. The License API refuses a key of another product with the reason `product_mismatch`.
- The License API answers an unknown key with the reason `license_not_found`.

## Statuses

Seatify works out the status of a license on each request.

| Status | Meaning |
| --- | --- |
| `active` | The license has not expired, or it has no expiry date. |
| `grace` | The expiry date has passed, but the grace period of the policy has not ended. |
| `expired` | The expiry date and the grace period have passed. |
| `suspended` | The license is suspended. This status takes priority over all other statuses. See [Suspension](#suspension). |

The status is not the same as validity. The License API returns both:

| Status | `valid` | `expired` |
| --- | --- | --- |
| `active` | `true` | `false` |
| `grace` | `true` | `false` |
| `expired` | `true` or `false` | `true` |
| `suspended` | `false` | `false` |

An expired license is still valid if the policy uses Keep access or Perpetual fallback. See [After expiry](../policies/#after-expiry).

`valid` can also be `false` for other reasons. For example, the device has not claimed the license. The `reason` field names the cause. Your application must decide on `valid`. It can show `status` to the user.

## Expiry

The policy decides when the expiry date is set:

| Policy | Expiry date |
| --- | --- |
| Lifetime | The license has no expiry date. It never expires. |
| Time-limited, expiry starts at issue | The date is set when the license is created. |
| Time-limited, expiry starts at first activation | The date is set at the first claim. Until then, the license has no expiry date, and its status is `active`. |

The expiry date is the time of issue or activation plus the duration of the policy.

You can change the expiry date of one license. The change does not affect other licenses. A license without an expiry date never expires.

## Activation

The first successful claim activates a license. Seatify records the time of activation, and the License API returns it. A license that was never claimed has no time of activation.

- A validation does not activate a license.
- A refused claim does not activate a license.
- Later claims do not change the time of activation.

## Suspension

Suspension stops a license from working. You can reinstate the license later.

While a license is suspended:

- Claim, validate, heartbeat and check-out fail with the reason `suspended`. Process spawn and process heartbeat fail too.
- The Distribution API refuses the license key.
- Release and process exit still work.
- The seats and the device bindings stay. Suspension does not release them.
- License files that were already issued keep working offline until they expire.

If the policy requires heartbeats, heartbeats fail during a suspension. When the lease of a device ends, that device is released.

After reinstatement, the license works again immediately. It keeps the seats and device bindings that it had before.

## License files

A license file is a signed copy of a license. Your application can check the file without a network call. The file holds the status, the expiry date, the limits and the entitlements of the license.

- The policy must allow offline validation.
- The file stays valid for the license file lifetime of the policy. The default is 30 days.
- If the policy binds devices, the file is valid on one device only. That device must claim the license first.
- Check-out fails for a license that is not valid, such as a suspended license.

See [Check out a license file](../../license-api/licenses/check-out/) and [Offline validation](../../guides/offline-use/offline-validation/). For a device that never goes online, see [Devices with no internet](../../guides/offline-use/devices-with-no-internet/).

## Limits and entitlements

A license can override some limits of its policy. See [License overrides](../policies/#license-overrides).

A license gets all entitlements of its policy. It can also have extra entitlements of its own. See [Entitlements](../entitlements/).

## Deletion

Deletion is permanent. The key stops working immediately, and the License API answers it with `license_not_found`. The seats and device bindings of the license are deleted too.

To stop a license for a time, suspend it instead.

