# Offline license

> The license file of a self-hosted installation - what it contains, how to mount it as a Secret, the states and what they mean, the grace period, a read-only mode that never locks your data, renewal, the license-status command and the dx_license_days_left metric.

Self-hosted DataxLand uses an **offline license**: a `license.json` file DataxLand issues under your contract. The installation
verifies the file's signature with a public key built into the image, **never calls home to DataxLand** and works on a closed
network.

## What the file contains

The JSON file holds the format (`dataxland-license/1`), the signing key ID, a payload and a digital signature. The payload
records:

| Field | Meaning |
| --- | --- |
| `license_id` | License ID |
| `customer` | Customer name |
| `edition`, `plan` | Edition and plan (Enterprise) |
| `limits.workspaces` | Maximum number of workspaces; `null` means unlimited |
| `limits.seats` | Maximum number of users; `null` means unlimited |
| `features` | Features under the contract, shown on the admin page |
| `issued_at`, `not_before`, `expires_at` | Issue date, start of validity, expiry date |
| `grace_days` | Grace period in days after expiry, default 30 |
| `deployment` | `selfhost` |

Editing the payload breaks the signature and makes the license invalid. To change limits or the term, contact DataxLand for a
new file.

## Mount the license

```bash
kubectl -n dataxland create secret generic dataxland-license --from-file=license.json=./license.json
```

```yaml
license:
  existingSecret: dataxland-license
  key: license.json      # name of the key in the Secret that holds the file
```

The chart mounts the file read-only at `/etc/dataxland/license/license.json` in `api`, `worker` and `mcp`. If you install
without a license, Helm prints a warning with the commands to create the Secret and upgrade.

## States

The installation checks the license at startup, then again **every hour** and **whenever the file changes**.

| State | When | Installation |
| --- | --- | --- |
| `valid` | Within the term | Fully working, workspace and user limits enforced |
| `grace` | Expired, still within the grace period | Same as `valid`; the admin page shows a warning |
| `expired` | Past the grace period too | Read-only |
| `not_yet_valid` | Before `not_before` | Read-only |
| `invalid` | Wrong format, bad signature, unknown signing key, not issued for self-hosting | Read-only |
| `missing` | No file mounted | Read-only |

### Read-only mode

Read-only mode **never locks your data**:

- Still working: dashboards, asking Si, MCP, data export, sign-in.
- Blocked: creating workspaces, inviting users, running builds or refreshing data. The API returns a 402 error with code
  `license_inactive`.

Data stays at the last build until a valid license is in place.

### Limits

- **Workspaces**: counts the active workspaces across the whole installation, including sample workspaces.
- **Users**: counts the accounts that are not locked across the whole installation.

At a limit you cannot create more workspaces or invite more people (402 error with code `license_limit`); everything that
already exists keeps working. Locking accounts that are no longer used frees up seats.

## Check the status

In the app: **Admin → Operations**, section **Deployment and licence** shows
the customer, license ID, expiry date, days left (including grace), usage against limits and the feature list.

From the command line:

```bash
kubectl -n dataxland exec deploy/dataxland-worker -- python -m pipelines.cli license-status
```

The command prints JSON with the license state, usage and air-gapped mode, and exits with code 1 when the license is no longer
in force, so you can use it in health-check scripts.

## Monitoring expiry

`api` exports the Prometheus metric `dx_license_days_left`: the number of days until the installation switches to read-only
(including grace), with a `state` label for the current state. Example alert rule:

```yaml
- alert: DataxLandLicenseExpiring
  expr: dx_license_days_left < 45
  for: 1h
  annotations:
    summary: DataxLand license has under 45 days left; contact DataxLand to renew
```

## Renewal

1. Contact DataxLand to get a new license file.
2. Replace the Secret's contents:

   ```bash
   kubectl -n dataxland create secret generic dataxland-license \
     --from-file=license.json=./license.json --dry-run=client -o yaml | kubectl apply -f -
   ```

3. Kubernetes updates the mounted file in the pods within a few minutes; the installation notices the change and reloads it,
   **no restart needed**. Confirm with `license-status` or the admin page.

## Related

- [Install with Helm](/en/docs/self-host/helm)
- [Air-gapped mode](/en/docs/self-host/airgapped)
- [Enterprise plan](/en/enterprise)
