REST API Version 2.0

API Integration & Developer Documentation

Comprehensive developer specifications for authenticating client applications, validating licenses, enforcing hardware device fingerprints, and managing usage quotas atomically.

Overview & Architecture

LicenseServer is a zero-trust software license verification backend. All authorization decisions, token counts, expiration dates, and hardware binding rules are enforced strictly server-side. The client application acts purely as a consumer and never serves as a source of truth for license validity.

Strict Device Binding
Hardware hashes ensure tokens cannot be shared between machines.
Atomic Token Consumption
Concurrency-safe usage decrement prevents quota overconsumption.
Dynamic Tiers
Renaming or modifying tiers updates client displays in real-time.

Authentication & Base URL

License API requests do not require static API keys. Instead, every call is authenticated via the combination of your License Token and the client machine's Hardware Device Fingerprint.

Base URL
REST Endpoint Prefix
https://apilicense.my.id/public/api/license
HTTP Headers required for all POST requests:
Content-Type: application/json
Accept: application/json
POST /api/license/validate
Primary Handshake

Executes full multi-step validation: checks token validity, expiration, device hardware fingerprint binding, maximum allowed devices, and remaining usage limits.

Parameter Request

Hanya Butuh Token
Field Type Requirement Keterangan
token string Required Token lisensi unik software (contoh: PS-PREM-8F2K9X7M). Hanya ini yang wajib dikirim!
device_name string Optional Nama/label perangkat kustom (opsional). Jika dikosongkan, server otomatis mendeteksi nama hostname/OS.
Deteksi Perangkat Otomatis (Zero-Setup):
Anda tidak perlu repot membuat device_fingerprint manual. Saat script dijalankan, sistem server akan secara otomatis mendeteksi hardware (OS, Platform, IP, dan identitas fisik) perangkat client dan langsung mendaftarkannya ke dashboard perangkat website Anda!

Contoh Integrasi Kode (Terpisah & Siap Pakai)

1. Python Integration (Rekomendasi Script)
Cukup masukkan token lisensi Anda. Saat script dijalankan, sinyal dikirim ke server dan perangkat langsung muncul di menu Devices admin website!
import requests

# 1. Masukkan token lisensi Anda (tidak perlu fingerprint manual)
TOKEN = "PS-PREM-8F2K9X7M"
SERVER_URL = "https://apilicense.my.id/public/api/license/validate"

# 2. Kirim sinyal ke server — perangkat otomatis terdeteksi & terdaftar di website
try:
    response = requests.post(SERVER_URL, json={
        "token": TOKEN
    }, timeout=10)
    
    data = response.json()
    
    if data.get("valid"):
        print(f"[✓] LISENSI VALID! Status: {data.get('status')}")
        print(f"[✓] Tier: {data.get('license_tier_name')}")
        print(f"[✓] Sisa Kuota: {data.get('remaining_token')}")
        print(f"[✓] Perangkat Anda telah otomatis terhubung ke sistem!")
    else:
        print(f"[✗] DITOLAK: {data.get('message')}")
        
except Exception as e:
    print(f"[!] Gagal terhubung ke server lisensi: {e}")
2. cURL (Terminal / Bash / Command Prompt)
Eksekusi 1 baris di terminal. Mengirim token secara langsung dan aman.
curl -X POST "https://apilicense.my.id/public/api/license/validate" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"token": "PS-PREM-8F2K9X7M"}'
3. PHP Integration (Backend & Web Apps)
Contoh fungsi validasi lisensi untuk aplikasi PHP / Laravel / WordPress.
<?php
$token = "PS-PREM-8F2K9X7M";

$ch = curl_init("https://apilicense.my.id/public/api/license/validate");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "token" => $token
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "Accept: application/json"
]);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
if (!empty($result['valid'])) {
    echo "Lisensi Valid! Tier: " . ($result['license_tier_name'] ?? 'Aktif');
} else {
    echo "Lisensi Ditolak: " . ($result['message'] ?? 'Error');
}

Success Response (200 OK)

{
  "status": "authorized",
  "valid": true,
  "success": true,
  "registered": true,
  "license_tier_name": "Premium",
  "remaining_token": 650,
  "is_unlimited": false,
  "usage_count": 350,
  "limit_type": "Usage Count",
  "device_authorized": true,
  "server_time": "2026-09-11T21:20:01+07:00",
  "expires_at": "2026-09-20T21:20:01+07:00"
}
GET / POST /api/license/check
Lightweight Quota Lookup

Returns the latest server-side token quota, dynamic license tier, device authorization status, and server timestamp without consuming usage units.

curl -X POST "https://apilicense.my.id/public/api/license/check" \
  -H "Content-Type: application/json" \
  -d '{"token": "PS-PREM-8F2K9X7M"}'
Token Not Found (200 OK)
{
  "success": true,
  "registered": false,
  "status": "NOT_REGISTERED",
  "license_tier_name": null,
  "remaining_token": 0
}
Device Unauthorized (200 OK)
{
  "success": false,
  "registered": true,
  "status": "DEVICE_NOT_AUTHORIZED",
  "license_tier_name": "Premium",
  "remaining_token": 0,
  "device_authorized": false
}
POST /api/license/usage
Atomic Decrement

Secara atomik mencatat eksekusi tugas di server dan mengurangi sisa kuota lisensi sebanyak 1 poin. Aman terhadap race conditions.

curl -X POST "https://apilicense.my.id/public/api/license/usage" \
  -H "Content-Type: application/json" \
  -d '{"token": "PS-PREM-8F2K9X7M", "action": "RUN_ANALYTICS_JOB"}'
POST /api/license/heartbeat
Active Usage Time

Untuk lisensi bertipe durasi aktif (Active Usage Time), aplikasi client mengirim heartbeat berkala (misal tiap 60 detik) untuk menjaga validitas sesi dan memotong sisa waktu aktif.

curl -X POST "https://apilicense.my.id/public/api/license/heartbeat" \
  -H "Content-Type: application/json" \
  -d '{"token": "PS-PREM-8F2K9X7M"}'
POST /api/license/deactivate

Menutup sesi aktif perangkat secara rapi saat pengguna keluar dari software atau aplikasi ditutup.

curl -X POST "https://apilicense.my.id/public/api/license/deactivate" \
  -H "Content-Type: application/json" \
  -d '{"token": "PS-PREM-8F2K9X7M"}'

Standardized Error Responses

When an operation fails or a security threshold is violated, the API returns appropriate HTTP status codes with structured JSON error payloads:

403 Forbidden — Limit Reached
{
  "status": "limit_reached",
  "valid": false,
  "message": "License usage limit has been reached."
}
403 Forbidden — Device Unauthorized
{
  "status": "device_unauthorized",
  "valid": false,
  "message": "This license is bound to another hardware device fingerprint."
}
429 Too Many Requests — Rate Limited
{
  "status": "rate_limited",
  "valid": false,
  "message": "Too many requests. Please slow down."
}

Deteksi & Pengikatan Perangkat Otomatis

Zero-Configuration: Tanpa Perlu Fingerprint Manual!

Anda tidak perlu lagi repot membuat algoritma fingerprint di aplikasi klien. Cukup kirimkan token, sistem server kami secara otomatis menangkap sinyal hardware (Platform, OS, IP, dan machine identifier), mengikatnya secara permanen ke lisensi, dan langsung menampilkannya pada dashboard admin website Anda.

Code copied to clipboard!