---
url: https://docs.sunlicense.com/guide/concepts.md
---
# Concepts

```
Organization ─┬─ Products ── Policies ── Licenses ── Machines (activations)
              ├─ Customers ─────────────────┘ (each license belongs to one)
              ├─ Team members (roles)
              └─ API keys
```

## Organization

Your company's account. Everything below belongs to exactly one organization, and organizations are isolated from each other at the database level.

## Product

An app you sell, for example "Acme Editor". It has a name and a short code (`acme-editor`).

## Policy

A license template for a product: type (`PERPETUAL`, `SUBSCRIPTION` or `TRIAL`), **max machines**, **max IPs** and **duration**. Licenses are issued *from* a policy, so changing the policy's machine or IP limit changes it for every license on that policy.

### IP limits

**Max IPs** limits how many network addresses a license works from: the classic "one server" rule for game-server
plugins, and it works even when your app sends no fingerprint. Each new address the app connects from takes a slot
(IPv6 counts per /64, the block one home or server gets); a known address keeps working, and one address too many is
refused with `TOO_MANY_IPS`. An address unused for the policy's **free after** days (30 unless you choose otherwise)
frees its slot by itself, and you can free one or all on the license page. With both limits set, both apply. SunLicense
stores the addresses only for licenses on policies with an IP limit, so you can recognise your buyer's server (see the
[Privacy policy](/legal/privacy)).

## License

What your customer holds: a key (`K7QX-M2PD-9HWT-R4CN`), the customer's email, an expiry date from its policy, and a status:

| Status | Validates? | Can change to |
|---|---|---|
| `ACTIVE` | Yes, if not expired and a machine slot is free | `SUSPENDED`, `REVOKED` |
| `SUSPENDED` | No (`SUSPENDED`) | `ACTIVE` (reinstate), `REVOKED` |
| `REVOKED` | No (`REVOKED`) | Nothing. Revocation is permanent |

## Customer

One of your buyers. Every license belongs to a customer, and the **Customers** page lists them with their licenses, machines, marketplace purchases and activity. You rarely create one by hand:

* **Issuing a license** to an email finds the customer with that email, or creates one.
* **Marketplace sales** find the same customer by their store account (a BuiltByBit user id, a Tebex username…) first, then by email. Buyers known only by an account id get a customer without an email.
* **Discord claims** add the buyer's Discord account to the customer of the license they claimed.

A license keeps the email and name it was issued to (that is what a Discord claim or the redeem page checks); editing the customer changes their contact details, not old licenses.

* **Block customer** suspends every active license they hold (validation answers `SUSPENDED` within seconds) and new licenses for them start suspended. **Unblock** reinstates exactly the licenses the block suspended; ones you suspended by hand stay suspended.
* **Merge** two customers when one buyer shows up twice (two emails, or a store account and an email): the duplicate's licenses, store accounts and notes move over and the duplicate is deleted. If either was blocked, the merged customer is blocked.

Customers use the license permissions: `licenses.read` to see them, `licenses.write` to edit, block, merge or delete.

## Deleting and the Trash

Products, policies, licenses and customers can be deleted from their row's **⋯** menu or the **Delete** card at the
bottom of their page. A deleted item goes to the **Trash** (Settings → Trash) with everything that hangs off it:

| You delete | What goes with it |
|---|---|
| A product | Its policies and licenses |
| A policy | The licenses issued from it |
| A customer | Their licenses |
| A license | Nothing else |

The dialog shows exactly how many licenses go along; deleting a product, a customer, or a policy that has licenses asks
you to type its name. Licenses in the Trash **stop working at once**: your app gets `NOT_FOUND`, the same answer as for a
key that doesn't exist. Nobody is emailed, no Discord post goes out and no automation runs, and Discord roles the license
gave come off until it is restored.

**Undo** in the toast, or **Restore** in the Trash, brings the item back with everything that went with it, for
30 days. After that it is deleted for good (Owners and Admins can do that sooner with **Delete forever**). A restore
waits for what it belongs to: restore a product before a license of it that you deleted separately. Trashed items don't
count against your plan's limits, and their names, codes and emails are free to reuse; a trashed license's key is never
given to a new license.

## Machine (activation)

A license in use on one computer, identified by a **fingerprint** your app sends (any stable machine id). The first validation from a new fingerprint activates it if the policy has a free slot. You can deactivate a machine from the dashboard, or the app can call `deactivate` when a user moves to a new computer.

## Validation result codes

| Code | Meaning | What your app should do |
|---|---|---|
| `VALID` | License is active, not expired, machine allowed | Let the user in |
| `NOT_FOUND` | No license with this key in your organization | Ask the user to check the key |
| `EXPIRED` | Past the license's expiry date | Offer a renewal |
| `REVOKED` | Revoked by you | Block |
| `SUSPENDED` | Temporarily blocked by you | Block, show a support contact |
| `TOO_MANY_MACHINES` | Already active on the maximum number of machines | Ask the user to deactivate another machine |
| `TOO_MANY_IPS` | Already used from the maximum number of IP addresses | Ask the user to stop using it elsewhere, or free an address on the license page |
| `BLACKLISTED` | One of your [access rules](/guide/access-rules) blocks this machine, network, country or customer | Block, show a support contact |
