---
url: https://docs.sunlicense.com/api/validation.md
---
# Validation API

Called by your customers' apps, authenticated with an **API key**. Validation is never limited by your plan.

## POST /api/v2/license/validate

The endpoint the [official SDKs](/guide/sdks) call. **200 = valid, 400 = rejected.**

```http
POST /api/v2/license/validate
Authorization: Bearer slk_...
Content-Type: application/json

{ "license": "K7QX-M2PD-9HWT-R4CN", "host": "machine-a" }
```

```json
{ "valid": true, "status": 200, "message": "License is valid", "code": "VALID", "expiresAt": "2027-10-12T09:23:51Z" }
```

The machine id is read from the first of `fingerprint`, `hwid`, `host` or `macAddress`.

Result codes: `VALID`, `NOT_FOUND`, `EXPIRED`, `REVOKED`, `SUSPENDED`, `TOO_MANY_MACHINES`, `TOO_MANY_IPS` (the policy's [IP limit](/guide/concepts#ip-limits) is reached) and `BLACKLISTED` (one of your [access rules](/guide/access-rules) blocks the machine, address, country or customer). Every code except `VALID` is a 400 here, so SDKs written for SunLicense V1 treat `BLACKLISTED` and `TOO_MANY_IPS` as rejections without an update.

## POST /api/v1/validate

The same rules with a different shape: a rejected license is `200` with `valid: false`, so "the server said no" is never confused with "the server is down".

```json
// request
{ "licenseKey": "K7QX-M2PD-9HWT-R4CN", "fingerprint": "machine-a", "hostname": "Jane's laptop" }
// response
{ "valid": false, "code": "TOO_MANY_MACHINES", "detail": "License is already active on the maximum number of machines",
  "expiresAt": "2027-10-12T09:23:51Z", "machines": { "used": 2, "max": 2 } }
```

When the license's policy limits IP addresses, the answer also has `"ips": { "used": 1, "max": 1 }`, and a call from one
address too many is `TOO_MANY_IPS` ("License is already used from the maximum number of IP addresses"). The address is
the one your app connects from, never a value in the request. Treat unknown codes as a rejection: new ones may be added.

### Core unlock and integrity reports

For a product that has [sealed data](#post-api-v1-products-id-seal), a **valid** answer from either endpoint also has
`"unlock": "<base64>"`: the key that opens the product's sealed blobs (`SLS1.…`). It's only there when the check is
valid and the license is active and not expired; a suspended, expired or revoked license never gets it, and products
that never sealed anything answer exactly as before. Keep the last unlock on the machine for at most 7 days, so the app
keeps working through an outage; drop it when a check says the license isn't valid.

Both endpoints accept two optional fields, which your app's own file check fills in:

```json
{ "licenseKey": "K7QX-M2PD-9HWT-R4CN", "fingerprint": "machine-a", "integrity": "MODIFIED", "integrityDetail": "plugin.jar" }
```

`integrity` is `OK` or `MODIFIED` (anything else is ignored), `integrityDetail` at most 200 characters (longer is cut).
They never change the answer and are never sent back; a modified copy shows up in [Sentinel](/guide/sentinel) as a
license running a modified copy, with Suspend as the fix.

## POST /api/v1/activate

Same request and response as `/api/v1/validate`, for apps that activate explicitly on first run.

## POST /api/v1/deactivate

```json
// request
{ "licenseKey": "K7QX-M2PD-9HWT-R4CN", "fingerprint": "machine-a" }
// response
{ "deactivated": true }
```

## GET /api/v1/public-key

Your organization's Ed25519 public key for [offline verification](/guide/offline-licenses).

```json
{ "keyId": "2026-10-12-1a2b3c4d", "algorithm": "Ed25519", "publicKey": "MCowBQYDK2VwAyEA…" }
```

## POST /api/v1/products/{id}/seal

For your team, not your customers' apps: signed in or a token with **products.write**. Encrypts up to 512 KB of your
app's core (a class, a rules table, a key) under the product's unlock key, which never leaves SunLicense except to a
valid license. `digests` are optional SHA-256 hashes of files your app checks at runtime (hash files that don't contain
the blob itself).

```json
// request
{ "data": "Y2xhc3MgQ29yZSB7IH0=", "digests": { "plugin.jar": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" } }
// response
{ "sealed": "SLS1.AAECAwQFBgcICQoL…", "bytes": 14, "digests": { "plugin.jar": "9f86d081…" } }
```

The format (key derivation, blob layout, digests) is published as test vectors for SDK authors in
[`protection-test-vectors.json`](https://github.com/ka0un/SunLicenseCom/blob/master/cloud/docs/specs/protection-test-vectors.json).
