1 · Activate an installation
Run once when your product is installed. The same host re-activates freely; a new host needs a free seat.
curl -X POST https://demo.twerple.com/api/v1/licenses/activate \
-H "Content-Type: application/json" \
-d '{"key": "NVM-XXXXX-XXXXX-XXXXX-XXXXX", "host": "customer-site.com", "version": "1.2.0"}'
{"ok": true, "product": "nebula-crm", "tier": "standard", "seats": 1, "used": 1,
"support_until": "2027-04-28", "recheck_seconds": 259200}
2 · Verify on a schedule
Cheap and side-effect free — call it as often as you like and cache the answer for the recheck window.
curl -X POST https://demo.twerple.com/api/v1/licenses/verify \
-H "Content-Type: application/json" \
-d '{"key": "NVM-XXXXX-XXXXX-XXXXX-XXXXX", "host": "customer-site.com"}'
{"ok": true, "valid": true, "product": "nebula-crm", "tier": "standard",
"support_until": "2027-04-28", "seats": 1, "used": 1, "host_active": true}
3 · Ship updates
Ask for the newest released version — notes, size and checksum included — then stream the ZIP with the same key.
curl -X POST https://demo.twerple.com/api/v1/updates/latest \
-d '{"key": "NVM-XXXXX-XXXXX-XXXXX-XXXXX"}'
{"ok": true, "product": "nebula-crm", "version": "1.3.0",
"released_at": "2026-10-12T09:00:00+00:00", "notes": "- Fixed…", "bytes": 48211204,
"sha256": "9f2…c41"}
# then
curl -X POST https://demo.twerple.com/api/v1/updates/download \
-d '{"key": "NVM-…"}' --output update.zip
The client kit — paste into your product
A single dependency-free PHP class that activates, verifies with caching, and survives network hiccups gracefully.
final class NovaLicense
{
public function __construct(
private string $server = 'https://demo.twerple.com',
private string $cacheFile = __DIR__.'/license-state.json',
) {}
public function activate(string $key, string $host, string $version = ''): array
{
return $this->call('/api/v1/licenses/activate', ['key' => $key, 'host' => $host, 'version' => $version]);
}
public function valid(string $key, string $host): bool
{
$state = is_file($this->cacheFile) ? (array) json_decode((string) file_get_contents($this->cacheFile), true) : [];
if (($state['until'] ?? 0) > time()) {
return (bool) ($state['valid'] ?? false);
}
$answer = $this->call('/api/v1/licenses/verify', ['key' => $key, 'host' => $host]);
if (! isset($answer['valid'])) {
return (bool) ($state['valid'] ?? true); // offline: keep the last answer
}
file_put_contents($this->cacheFile, json_encode([
'valid' => $answer['valid'],
'until' => time() + 259200,
]), LOCK_EX);
return (bool) $answer['valid'];
}
private function call(string $path, array $payload): array
{
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\nAccept: application/json",
'content' => json_encode($payload),
'timeout' => 10,
'ignore_errors' => true,
]]);
$body = @file_get_contents($this->server.$path, false, $context);
return $body === false ? [] : (array) json_decode($body, true);
}
}
Sell your own products with this API built in
Every product you list gets signed keys, activations and update delivery — your buyers get the same experience you just read about.
Become a creator