# Add your application to Seatify

This guide adds licensing to your application. At the end, your application claims a license on the first run, validates it on each start, sends heartbeats while it runs and releases the license when the user signs out.

## Before you start

You need these objects in the dashboard:

- A [product](../../../concepts/products/) and a [publishable key](../../../concepts/products/#publishable-keys) for it. Your application sends the publishable key with every request.
- A [policy](../../../concepts/policies/) for the product. The policy decides whether a claim binds a device, a customer or both, and whether heartbeats are required.
- A [license](../../../concepts/licenses/) issued from the policy. Your user enters its key in your application.

The examples call `https://license.seatify.dev`. In curl, the keys and the fingerprint are the variables `$SEATIFY_PUBLISHABLE_KEY`, `$LICENSE_KEY` and `$DEVICE_FINGERPRINT`. In the other languages, they are variables of your application.

## Choose a fingerprint

Your application identifies the device with a fingerprint. Seatify compares the fingerprint as an exact string, and the case of the letters matters. A different fingerprint is a different device, and it takes another device slot. See [Devices](../../../concepts/seats-and-devices/#devices).

Use a value that stays the same when your application restarts or updates. Most platforms provide such a value:

| Platform | Value |
| --- | --- |
| macOS | `IOPlatformUUID`, from the `IOPlatformExpertDevice` entry of the I/O Registry. |
| Windows | `MachineGuid`, in the registry key `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography`. |
| Linux | The contents of `/etc/machine-id`. |
| iOS | `identifierForVendor` of `UIDevice`. The value changes when the user removes all your applications from the device. |
| Android | `Settings.Secure.ANDROID_ID`. The value is different for each app signing key. |

You can send a hash of the value instead of the value itself. Send the hostname of the device too. The dashboard shows the device by this name.

## Choose a customer reference

If the policy binds customers, the claim names the user with a customer reference. Seatify finds the customer by this reference only. See [References](../../../concepts/customers/#references).

Use a value that identifies the person and does not change. Send the same value from every device of that person. Then the person holds one seat on all their devices.

| Source | Value |
| --- | --- |
| Your own user system | The user ID, such as `user-42`. |
| Email address | The address that the user signs in with or bought the license with. |
| Payment provider or store | The customer ID that the provider gives the buyer, such as a Stripe or Paddle customer ID. |
| Sign-in provider | The user ID from Sign in with Apple, Google or Microsoft. This is the `sub` claim of the ID token. |

If your application has no user system, use the email address.

### Email addresses

Seatify compares the reference exactly. It removes the spaces around the reference, but it does not change the letters. Two spellings of one address are two customers, and each one takes a seat. So change each address to one standard form before you send it:

1. Convert the address to the Unicode Normalization Form C (NFC). A letter with an accent, such as `é`, can be one character, or a letter and a separate accent mark. The two forms look the same, but they are different references. NFC always uses the one-character form.
2. Change all letters to lower case. `Ada@Example.com` and `ada@example.com` are then one customer.

Keep all other characters. An address can contain an apostrophe, a plus sign or a dot, such as `o'brien@example.com`. These characters are part of the address.

Some keyboards change a straight apostrophe (`'`) into a curly apostrophe (`’`). These are two different characters. Use an input field for email addresses, because it keeps the straight apostrophe.

## Steps

{{% steps %}}

### Claim the license

Claim the license on the first run, after the user enters the license key. The policy decides what the claim binds. A claim can bind the device, take a seat for the user, or both. If the policy binds neither, the claim creates no binding. The first claim also activates the license.

A customer or a device is required only if the policy binds it. Seatify ignores a customer or a device that the policy does not bind. So send the device and the customer in every claim. For the customer, send the customer reference. See [Choose a customer reference](#choose-a-customer-reference).

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl https://license.seatify.dev/v1/licenses/claim \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "key": "$LICENSE_KEY",
  "device": { "fingerprint": "$DEVICE_FINGERPRINT", "hostname": "studio-mac" },
  "customer": { "external_ref": "user-42", "email": "ada@example.com" }
}
EOF
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
import Foundation

struct LicenseCheck: Decodable {
    let valid: Bool
    let reason: String?
}

let body: [String: Any] = [
    "key": licenseKey,
    "device": ["fingerprint": fingerprint, "hostname": hostname],
    "customer": ["external_ref": userID, "email": email],
]

var request = URLRequest(url: URL(string: "https://license.seatify.dev/v1/licenses/claim")!)
request.httpMethod = "POST"
request.setValue(publishableKey, forHTTPHeaderField: "Seatify-Publishable-Key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONSerialization.data(withJSONObject: body)

let (data, _) = try await URLSession.shared.data(for: request)
let check = try JSONDecoder().decode(LicenseCheck.self, from: data)
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
using System.Net.Http.Json;

using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Seatify-Publishable-Key", publishableKey);

var response = await client.PostAsJsonAsync("https://license.seatify.dev/v1/licenses/claim", new
{
    key = licenseKey,
    device = new { fingerprint, hostname },
    customer = new { external_ref = userId, email },
});
var check = await response.Content.ReadFromJsonAsync<LicenseCheck>();

record LicenseCheck(bool Valid, string? Reason);
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
body, err := json.Marshal(map[string]any{
	"key":      licenseKey,
	"device":   map[string]string{"fingerprint": fingerprint, "hostname": hostname},
	"customer": map[string]string{"external_ref": userID, "email": email},
})
if err != nil {
	return err
}

req, err := http.NewRequest("POST", "https://license.seatify.dev/v1/licenses/claim", bytes.NewReader(body))
if err != nil {
	return err
}
req.Header.Set("Seatify-Publishable-Key", publishableKey)
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	return err
}
defer res.Body.Close()

var check struct {
	Valid  bool    `json:"valid"`
	Reason *string `json:"reason"`
}
err = json.NewDecoder(res.Body).Decode(&check)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const response = await fetch("https://license.seatify.dev/v1/licenses/claim", {
  method: "POST",
  headers: {
    "Seatify-Publishable-Key": publishableKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    key: licenseKey,
    device: { fingerprint, hostname },
    customer: { external_ref: userId, email },
  }),
});
const check = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

A successful claim answers with `valid` set to `true`:

```json
{
  "valid": true,
  "status": "active",
  "expired": false,
  "reason": null,
  "license": {
    "id": "<license id>",
    "name": "Studio team",
    "expires_at": "2026-12-20T00:00:00Z",
    "activated_at": "2026-01-22T01:50:56Z"
  },
  "entitlements": [
    {
      "code": "CORE",
      "name": "Core"
    },
    {
      "code": "EXPORT_4K",
      "name": "4K Export"
    }
  ],
  "limits": {
    "max_devices": 50,
    "max_seats": 25,
    "max_processes": 4
  },
  "device": {
    "id": "<device binding id>",
    "expires_at": "2026-09-25T14:21:46Z"
  },
  "heartbeat": {
    "required": true,
    "interval_seconds": 3600,
    "grace_seconds": 1800
  },
  "process": null,
  "process_heartbeat": {
    "tracked": true,
    "interval_seconds": 300,
    "grace_seconds": 120
  }
}
```

If `valid` is `false`, the `reason` field names the cause. See [Handle the answer](#handle-the-answer). A claim from a device that is already bound returns the same binding and does not use another device slot.

### Store the license key

After a successful claim, store the license key on the device. Your application reads the key on each start and sends it with every request.

Store the key in upper case. Seatify ignores the case of the letters, but an encrypted license file needs the key in upper case. See [License keys](../../../concepts/licenses/#license-keys).

### Validate on each start

Validate the license each time your application starts. Send the stored key and the fingerprint.

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl https://license.seatify.dev/v1/licenses/validate \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "key": "$LICENSE_KEY",
  "device": { "fingerprint": "$DEVICE_FINGERPRINT" }
}
EOF
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
let body: [String: Any] = [
    "key": licenseKey,
    "device": ["fingerprint": fingerprint],
]

var request = URLRequest(url: URL(string: "https://license.seatify.dev/v1/licenses/validate")!)
request.httpMethod = "POST"
request.setValue(publishableKey, forHTTPHeaderField: "Seatify-Publishable-Key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONSerialization.data(withJSONObject: body)

let (data, _) = try await URLSession.shared.data(for: request)
let check = try JSONDecoder().decode(LicenseCheck.self, from: data)
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
var response = await client.PostAsJsonAsync("https://license.seatify.dev/v1/licenses/validate", new
{
    key = licenseKey,
    device = new { fingerprint },
});
var check = await response.Content.ReadFromJsonAsync<LicenseCheck>();
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
body, err := json.Marshal(map[string]any{
	"key":    licenseKey,
	"device": map[string]string{"fingerprint": fingerprint},
})
if err != nil {
	return err
}

req, err := http.NewRequest("POST", "https://license.seatify.dev/v1/licenses/validate", bytes.NewReader(body))
if err != nil {
	return err
}
req.Header.Set("Seatify-Publishable-Key", publishableKey)
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	return err
}
defer res.Body.Close()

var check struct {
	Valid  bool    `json:"valid"`
	Status *string `json:"status"`
	Reason *string `json:"reason"`
}
err = json.NewDecoder(res.Body).Decode(&check)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const response = await fetch("https://license.seatify.dev/v1/licenses/validate", {
  method: "POST",
  headers: {
    "Seatify-Publishable-Key": publishableKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    key: licenseKey,
    device: { fingerprint },
  }),
});
const check = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

Decide on `valid`. You can show `status` to the user. An expired license can still be valid, because the policy can keep access after expiry. See [Statuses](../../../concepts/licenses/#statuses).

A validation does not bind a device. If the policy binds devices and the answer has the reason `not_claimed`, claim the license again. This happens after a release, or when a heartbeat lease has ended while your application was closed.

### Send heartbeats

Send heartbeats only if the policy requires them. The claim answer says so in `heartbeat.required`. Send a heartbeat every `heartbeat.interval_seconds` while your application runs.

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl https://license.seatify.dev/v1/licenses/heartbeat \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "key": "$LICENSE_KEY",
  "device": { "fingerprint": "$DEVICE_FINGERPRINT" }
}
EOF
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
let body: [String: Any] = [
    "key": licenseKey,
    "device": ["fingerprint": fingerprint],
]

var request = URLRequest(url: URL(string: "https://license.seatify.dev/v1/licenses/heartbeat")!)
request.httpMethod = "POST"
request.setValue(publishableKey, forHTTPHeaderField: "Seatify-Publishable-Key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONSerialization.data(withJSONObject: body)

let (data, _) = try await URLSession.shared.data(for: request)
let check = try JSONDecoder().decode(LicenseCheck.self, from: data)
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
var response = await client.PostAsJsonAsync("https://license.seatify.dev/v1/licenses/heartbeat", new
{
    key = licenseKey,
    device = new { fingerprint },
});
var check = await response.Content.ReadFromJsonAsync<LicenseCheck>();
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
body, err := json.Marshal(map[string]any{
	"key":    licenseKey,
	"device": map[string]string{"fingerprint": fingerprint},
})
if err != nil {
	return err
}

req, err := http.NewRequest("POST", "https://license.seatify.dev/v1/licenses/heartbeat", bytes.NewReader(body))
if err != nil {
	return err
}
req.Header.Set("Seatify-Publishable-Key", publishableKey)
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	return err
}
defer res.Body.Close()

var check struct {
	Valid  bool    `json:"valid"`
	Reason *string `json:"reason"`
}
err = json.NewDecoder(res.Body).Decode(&check)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const response = await fetch("https://license.seatify.dev/v1/licenses/heartbeat", {
  method: "POST",
  headers: {
    "Seatify-Publishable-Key": publishableKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    key: licenseKey,
    device: { fingerprint },
  }),
});
const check = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

Each heartbeat starts the lease of the device again. The answer shows when the lease ends in `device.expires_at`. When the lease ends, Seatify releases the device, and a heartbeat answers `not_claimed`. Claim the license again in that case. See [Heartbeats and leases](../../../concepts/seats-and-devices/#heartbeats-and-leases).

### Release the license

Release the license when the user signs out or moves the license to another device. Send the stored key and the fingerprint. Then remove the stored key.

{{< tabs >}}
{{< tab name="curl" >}}
```bash
curl https://license.seatify.dev/v1/licenses/release \
  -H "Seatify-Publishable-Key: $SEATIFY_PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  --data @- <<EOF
{
  "key": "$LICENSE_KEY",
  "device": { "fingerprint": "$DEVICE_FINGERPRINT" }
}
EOF
```
{{< /tab >}}
{{< tab name="Swift" >}}
```swift
struct ReleaseResult: Decodable {
    let released: Bool
    let reason: String?
}

let body: [String: Any] = [
    "key": licenseKey,
    "device": ["fingerprint": fingerprint],
]

var request = URLRequest(url: URL(string: "https://license.seatify.dev/v1/licenses/release")!)
request.httpMethod = "POST"
request.setValue(publishableKey, forHTTPHeaderField: "Seatify-Publishable-Key")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try JSONSerialization.data(withJSONObject: body)

let (data, _) = try await URLSession.shared.data(for: request)
let result = try JSONDecoder().decode(ReleaseResult.self, from: data)
```
{{< /tab >}}
{{< tab name="C#" >}}
```csharp
var response = await client.PostAsJsonAsync("https://license.seatify.dev/v1/licenses/release", new
{
    key = licenseKey,
    device = new { fingerprint },
});
var result = await response.Content.ReadFromJsonAsync<ReleaseResult>();

record ReleaseResult(bool Released, string? Reason);
```
{{< /tab >}}
{{< tab name="Go" >}}
```go
body, err := json.Marshal(map[string]any{
	"key":    licenseKey,
	"device": map[string]string{"fingerprint": fingerprint},
})
if err != nil {
	return err
}

req, err := http.NewRequest("POST", "https://license.seatify.dev/v1/licenses/release", bytes.NewReader(body))
if err != nil {
	return err
}
req.Header.Set("Seatify-Publishable-Key", publishableKey)
req.Header.Set("Content-Type", "application/json")

res, err := http.DefaultClient.Do(req)
if err != nil {
	return err
}
defer res.Body.Close()

var result struct {
	Released bool    `json:"released"`
	Reason   *string `json:"reason"`
}
err = json.NewDecoder(res.Body).Decode(&result)
```
{{< /tab >}}
{{< tab name="JavaScript" >}}
```javascript
const response = await fetch("https://license.seatify.dev/v1/licenses/release", {
  method: "POST",
  headers: {
    "Seatify-Publishable-Key": publishableKey,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    key: licenseKey,
    device: { fingerprint },
  }),
});
const result = await response.json();
```
{{< /tab >}}
{{< /tabs >}}

The answer has `released` set to `true`. The device slot is free immediately. The release keeps the seat of the user. A release also works on an expired or suspended license. See [Release](../../../concepts/seats-and-devices/#release).

{{% /steps %}}

## Handle the answer

The License API answers every licensing outcome with the status 200, a refusal too. Your application decides on `valid`, or on `released` for a release. The `reason` field names the cause of a refusal.

| Reason | Answered by | What your application does |
| --- | --- | --- |
| `license_not_found` | Every step | Ask the user to enter the key again. |
| `product_mismatch` | Every step | The key belongs to another product. Ask the user for the right key. |
| `expired` | Claim, validate, heartbeat | Tell the user that the license has expired. |
| `suspended` | Claim, validate, heartbeat | Tell the user that the license is suspended. |
| `device_required` | Claim, validate | Send the device. The policy binds devices. |
| `customer_required` | Claim | Send the customer. The policy binds customers. |
| `device_limit_reached` | Claim | Tell the user that all devices are in use. The user must release another device first. |
| `seat_limit_reached` | Claim | Tell the user that all seats are taken. |
| `not_claimed` | Validate, heartbeat, release | Claim the license again. After a release, no action is needed. |
| `heartbeat_not_required` | Heartbeat | Stop sending heartbeats. The policy does not require them. |

Other statuses mean that the request itself is wrong:

| Status | Cause |
| --- | --- |
| 400 | The body is not valid. The `errors` field names each field that is wrong. |
| 401 | The publishable key is missing or not valid. |
| 429 | Your application sent too many requests. Try again later. |

If the License API cannot be reached, your application decides what to do. For a license that must work without a network, see [Offline validation](../../offline-use/offline-validation/).

## Signed responses

Every answer with the status 200 is signed. Your application can check the signature before it trusts the answer. See [Verify signed responses](../../signatures/verify-signed-responses/).

## Next steps

- [Verify signed responses](../../signatures/verify-signed-responses/)
- [Offline validation](../../offline-use/offline-validation/)
- [Limit concurrent runs](../limit-concurrent-runs/)
- [Licensing models](../licensing-models/)
- [Claim a license](../../../license-api/licenses/claim/), [Validate a license](../../../license-api/licenses/validate/), [Send a license heartbeat](../../../license-api/licenses/heartbeat/) and [Release a license](../../../license-api/licenses/release/)

