# Kernstra.getLicense()

```ts
static getLicense(): LicenseState
```

The current license state, as the exported `LicenseState`. `if (state.valid) state.features.includes('export')` type-checks: the valid half has every field, the invalid half the reason.

An invalid state's `reason` is one of `no-license`, `insecure-context` (plain HTTP), `malformed`, `unsupported-algorithm`, `invalid-signature`, `not-yet-valid`, `expired`, `origin-mismatch`, `wrong-holder`, `revoked`, `paused` or `stale` (the licensing API has not confirmed the license for more than 48 hours, or never on this browser and the check could not get through; the SDK loads, watermarked and without `extract`, and asks again whenever a document is opened). A `paused` state carries `pauseReason`: `payment`, `suspended`, `term_ended`, `trial_ended` or `other`. During a licensing-API outage `getLicense()` says why output is watermarked. It reports a verdict as soon as it arrives; documents already open keep the rights they were opened with.

- Kind: static method
- Since: 1.0.0

Returns `LicenseState`: A union narrowed on `valid`: the valid half carries `watermark`, `env`, `plan`, `features`, `offline` and, on a license with an expiry date, `expiresAt`; the invalid half carries `watermark: true`, a `reason` and, when the reason is `paused`, a `pauseReason`.

```ts
const state = Kernstra.getLicense();
if (!state.valid) console.warn('License not valid:', state.reason);
else if (state.watermark) console.warn('Output is watermarked (development token)');
```

Part of [Kernstra](https://kernstra.com/docs/web-sdk/api/kernstra) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/kernstra/getlicense
