> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lerian.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# License Manager

> How a licensed Lerian product validates its license key, what each result allows, and how it behaves when the license service does not answer.

Lerian issues a license key for each Enterprise product and plugin. The product validates the key when it starts, and again at a fixed interval. This page describes what you configure, which host the product calls, and what each result allows.

<Note>
  These behaviors describe products built on the Go library. Products built on the TypeScript library differ. The cache lasts 24 hours. The check applies to every route, health probes included. A rate-limit answer does not extend the number of attempts. The product never reads the `X-Organization-Id` header, and it sends the configured organization identifiers to the license service on every check.
</Note>

## What a license key is

***

A license key covers one product and the organization identifiers that you declare for it. A product accepts the key only for those organizations, and only for itself. Store the key as a secret, and keep it out of source control.

## What the product reads from the environment

***

| Variable           | Content                                                                                                                        |
| :----------------- | :----------------------------------------------------------------------------------------------------------------------------- |
| `LICENSE_KEY`      | The key that Lerian issued for this product.                                                                                   |
| `ORGANIZATION_IDS` | The organization identifiers that the key covers, separated by commas. Use `global` when Lerian licenses the whole deployment. |
| `IS_DEVELOPMENT`   | Optional. Set it to `true` to validate against `https://license.dev.lerian.io` instead of the production host.                 |

A product that has no organization identifier does not start.

## How the check runs

***

The product sends its own name, the license key and one organization identifier to `https://license.lerian.io`. Lerian operates that service. Open outbound HTTPS to that host from every workload that runs a licensed product, or every check fails. A workload that sets `IS_DEVELOPMENT` to `true` needs the same rule for `https://license.dev.lerian.io`.

The product validates at startup, then repeats the check every seven days in the background. It keeps each result in memory for eight days. One attempt waits up to five seconds for an answer. The background refresh makes three attempts, or five attempts when the service reports too many requests. The startup check makes one attempt.

Each request must carry the organization identifier in the `X-Organization-Id` header, unless you set `ORGANIZATION_IDS` to `global`. The product compares the header against `ORGANIZATION_IDS`, then answers from the cached result or repeats the check. Requests to `/health`, `/version` and `/swagger/` skip the check.

## What each result allows

***

| Result                      | What the product does                                                                                        |
| :-------------------------- | :----------------------------------------------------------------------------------------------------------- |
| Active                      | The product runs. It logs a warning 30 days before expiry, and a stronger warning in the last 7 days.        |
| Trial                       | The product runs and logs the days that remain. It logs a warning in the last 2 days.                        |
| Expired, grace period open  | The service grants 14 days of grace from the day it records the expiry. The product runs and logs a warning. |
| Grace period closed         | The service suspends the key. The product stops.                                                             |
| No valid license at startup | The product stops and writes the reason to the log.                                                          |

## When the license service does not answer

***

The product prefers a result it already holds. If the service returns a server error, a product that declares one organization or `global` uses the last cached result for that organization. If it holds no cached result, the product continues for seven more days and repeats the check later. A product that declares several organizations does not read the cache on a server error. It continues for seven more days.

If the network fails, a product that declares one organization or `global` again uses the cached result. If it holds no cached result, the request fails with code `LCS-0012`. If every configured organization fails for a reason other than too many requests, the product stops. This applies at startup and at every later check.

<Warning>
  The product stops if the license service stays unreachable beyond the cached result's eight days. It also stops if it restarts with no cached result during an outage. Monitor the outbound rule and the validation logs.
</Warning>

## Error codes

***

Each failure carries a stable code. The [License Manager error list](/en/platform/licensing/license-manager-error-list) gives every code and the message that comes with it.
