# License API

Use this API from your desktop, mobile or web software to **activate**, **validate** and **deactivate** license keys issued by adiorbit.com. No API key or account login is needed — the license key itself is the credential.

## Quick facts

| | |
| --- | --- |
| Base URL | `https://adiorbit.com/api/v1/licenses` |
| Method | `POST` for every endpoint |
| Request body | JSON, header `Content-Type: application/json` |
| Response body | JSON: `{ "payload": "<JSON string>", "signature": "<base64 or null>" }` |
| Rate limit | 60 requests per minute per IP (HTTP 429 with `Retry-After` when exceeded) |
| License key format | `XXXX-XXXX-XXXX-XXXX` — case and dashes are ignored |

## Product slugs

Every request names the product with `productSlug`. A key only works for its own product.

| Product | productSlug |
| --- | --- |
| OrBit TTS | `orbit-tts` |
| Anti Detect Browser Profile Manager | `anti-detect-browser-profile-manager` |
| Android Automation Studio | `android-automation-studio` |
| OrBit Faceless and AI Video Making Software | `orbit-faceless-and-ai-video-making-software` |
| AdsPower Module For Browser Automation Studio | `adspower-module-for-browser-automation-studio` |
| AdiOrBit SMTP | `adiorbit-smtp` |
| OrBit Live Game For Youtube | `orbit-live-game-for-youtube` |
| AdiOrbit Facebook Media Uploader | `adiorbit-facebook-media-uploader` |

## Endpoints

| Endpoint | Purpose |
| --- | --- |
| `POST https://adiorbit.com/api/v1/licenses/activate` | Register this device on the license (first run, or after reinstall). Safe to call again on an already-activated device. |
| `POST https://adiorbit.com/api/v1/licenses/validate` | Check the license is still valid (call on **every start**). With `machineId` it also checks this device is activated. |
| `POST https://adiorbit.com/api/v1/licenses/deactivate` | Free this device's seat so the key can be used on another device. |

## Request fields (exact names, case-sensitive)

| Field | Type | Required | Rules |
| --- | --- | --- | --- |
| `licenseKey` | string | yes | 16–40 characters, e.g. `K7QM-8XRT-4HPA-X2PA` |
| `productSlug` | string | yes | From the table above, e.g. `orbit-tts` |
| `machineId` | string | activate, deactivate: yes · validate: recommended | 8–256 characters, stable per device (see below) |
| `machineName` | string | no (activate only) | Up to 100 characters, shown to the customer, e.g. "Rasel's PC" |

Example body:

```json
{ "licenseKey": "K7QM-8XRT-4HPA-X2PA", "productSlug": "orbit-tts", "machineId": "3f1c9a0e5b7d4c21a8e6f0b2d9c4e7a1", "machineName": "Office PC" }
```

### Choosing machineId

Use something that stays the same across restarts and reinstalls of your app, and hash it (SHA-256) so the raw hardware ID never leaves the device:

- **Windows:** registry `HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid`
- **macOS:** `IOPlatformUUID` from `ioreg -rd1 -c IOPlatformExpertDevice`
- **Linux:** `/etc/machine-id`
- **Android:** `Settings.Secure.ANDROID_ID`
- **Web apps:** a random UUID stored in local storage on first visit

## Response

Every answer has this shape. **`payload` is a JSON string** — parse it a second time:

```json
{ "payload": "{\"ok\":true,\"license\":{...},\"issuedAt\":\"2026-11-19T10:00:00.000Z\"}", "signature": "base64..." }
```

Parsed `payload` on success:

```json
{
  "ok": true,
  "license": {
    "status": "ACTIVE",
    "product": { "slug": "orbit-tts", "name": "OrBit TTS", "version": "1.0.0" },
    "expiresAt": "2026-11-26T10:00:00.000Z",
    "activationLimit": 1,
    "activeActivations": 1,
    "machineActivated": true
  },
  "issuedAt": "2026-11-19T10:00:00.000Z"
}
```

- `expiresAt` is `null` for lifetime licenses. Free-trial licenses have an `expiresAt` a few days ahead.
- `status` is one of `ACTIVE`, `EXPIRED`, `SUSPENDED`, `REVOKED`, `SCHEDULED`.

Parsed `payload` on failure:

```json
{ "ok": false, "error": { "code": "LICENSE_EXPIRED", "message": "This license has expired." }, "license": { "...": "same fields as above, when known" }, "issuedAt": "..." }
```

Always decide using `ok` and `error.code`; show `error.message` to the user.

## Error codes

| HTTP | error.code | Meaning / what the app should do |
| --- | --- | --- |
| 400 | `INVALID_REQUEST` | Missing or malformed field — check the field names above |
| 404 | `LICENSE_NOT_FOUND` | Wrong key, or a key for a different product |
| 403 | `LICENSE_EXPIRED` | License (or free trial) ended — block features, show "Buy license" |
| 403 | `LICENSE_SUSPENDED` | Suspended by the seller — block features, show "Contact support" |
| 403 | `LICENSE_REVOKED` | Permanently revoked — block features |
| 403 | `LICENSE_NOT_STARTED` | Start date is in the future |
| 409 | `ACTIVATION_LIMIT_REACHED` | All seats used — the customer must deactivate another device first |
| 409 | `NOT_ACTIVATED` | (validate with machineId) This device isn't activated — call activate |
| 403 | `TRIAL_ALREADY_USED` | This device already used a free trial of the product — show "Buy license" |
| 429 | `RATE_LIMITED` | Too many requests — wait `Retry-After` seconds (this response is not wrapped in payload/signature) |
| 500 | `SERVER_ERROR` | Temporary server problem — treat like "offline" (not wrapped in payload/signature) |

## Recommended client flow

1. **First start:** ask for the license key → call `activate` with `machineId` → on `ok: true` save the key and the response locally.
2. **Every start:** call `validate` with the saved key and `machineId`.
   - `ok: true` → run normally, save the response and the time of this check.
   - `ok: false` → stop paid features and show `error.message` with a **Buy license** button linking to `https://adiorbit.com/products/<productSlug>`.
3. **Offline / network error / 5xx:** allow a short grace period (for example 3 days) based on the last successful check, then require a connection.
4. **"Move to another PC" button:** call `deactivate`, then clear the saved key.

## Verifying the signature (recommended)

Responses are signed with **Ed25519** over the exact `payload` string, so a fake server or an edited response can't unlock your app. Embed this public key in your software:

```text
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAGQMvd+kHLdFycVTGbmYaxRCAvRgqJNto0hQFD6SXPsU=
-----END PUBLIC KEY-----
```

Verify `signature` (base64) against the UTF-8 bytes of `payload` *before* parsing it. Also reject responses whose `issuedAt` is far in the past to stop replayed answers.

Node.js / Electron:

```js
import { createPublicKey, verify } from "node:crypto";
const PUBLIC_KEY = createPublicKey(`-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----`);
const valid = verify(null, Buffer.from(res.payload, "utf8"), PUBLIC_KEY, Buffer.from(res.signature, "base64"));
```

Python (`pip install cryptography`):

```python
from cryptography.hazmat.primitives.serialization import load_pem_public_key
import base64
key = load_pem_public_key(PUBLIC_KEY_PEM.encode())
key.verify(base64.b64decode(res["signature"]), res["payload"].encode())  # raises if invalid
```

C# / .NET: use the `NSec.Cryptography` or `BouncyCastle` package (Ed25519 isn't built into .NET).

## Examples

curl:

```bash
curl -X POST https://adiorbit.com/api/v1/licenses/validate -H "Content-Type: application/json" -d '{"licenseKey":"K7QM-8XRT-4HPA-X2PA","productSlug":"orbit-tts","machineId":"3f1c9a0e5b7d4c21a8e6f0b2d9c4e7a1"}'
```

JavaScript / TypeScript:

```ts
async function callLicenseApi(action: "activate" | "validate" | "deactivate", body: Record<string, string>) {
  const res = await fetch(`https://adiorbit.com/api/v1/licenses/${action}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) });
  const json = await res.json();
  if (!("payload" in json)) return json; // 429 / 500: { ok: false, error }
  return JSON.parse(json.payload);       // { ok, license, error?, issuedAt }
}
```

Python:

```python
import json, requests
def call_license_api(action, body):
    r = requests.post(f"https://adiorbit.com/api/v1/licenses/{action}", json=body, timeout=10)
    data = r.json()
    return json.loads(data["payload"]) if "payload" in data else data
```

C#:

```csharp
var http = new HttpClient();
var res = await http.PostAsJsonAsync("https://adiorbit.com/api/v1/licenses/validate", new { licenseKey, productSlug = "orbit-tts", machineId });
var outer = await res.Content.ReadFromJsonAsync<JsonElement>();
var payload = JsonDocument.Parse(outer.GetProperty("payload").GetString()!).RootElement;
bool ok = payload.GetProperty("ok").GetBoolean();
```
