API Documentation

Complete reference for integrating LicenseOS into your products.

Introduction

LicenseOS provides a RESTful API for software license management. All API endpoints are versioned under /api/v2.

Base URL

https://your-domain.com/api/v2

Quick Start

  1. Register as a developer and get approved.
  2. Generate an API Key from the Developer Dashboard.
  3. Use the API Key in the X-API-KEY request header.
  4. Integrate the SDK or call API endpoints directly from your software.

Authentication

Protected endpoints require an API key passed via the X-API-KEY header.

curl https://your-domain.com/api/v2/license/check \
  -H "X-API-KEY: sk_live_xxxxxxxxxxxxxxxx" \
  -d "license_key=XXXX-XXXX-XXXX-XXXX"
HeaderDescription
X-API-KEYYour developer API key
Content-Typeapplication/x-www-form-urlencoded (POST)

License: Activate

POST /api/v2/license/activate

Activate a license key on a specific domain. This creates a domain binding that allows the license to be used on that domain.

Request Parameters

ParameterTypeRequiredDescription
license_keystringYesLicense key (format: XXXX-XXXX-XXXX-XXXX)
domainstringYesDomain to activate (e.g. example.com)
productstringNoProduct slug (for SDK reference)

Response (Success)

{
  "status": "active",
  "message": "License activated successfully.",
  "max_domains": 1,
  "expire_at": "2025-12-31T23:59:59+00:00",
  "is_trial": false
}

License: Check

POST /api/v2/license/check

Check the current status and validity of a license key. Use this to verify licenses before granting access to features.

Response

{
  "status": "valid",
  "expire_at": "2025-12-31T23:59:59+00:00",
  "max_domains": 1,
  "activations": 1,
  "is_trial": false
}

Status Values

StatusDescription
validLicense is active and not expired
expiredLicense has passed its expiry date
inactiveLicense has been deactivated by admin
invalidLicense key not found

Update: Check

GET /api/v2/update/check

Check if a newer version of a product is available. Used by the WordPress SDK for auto-update functionality.

Query Parameters

ParameterTypeDescription
productstringProduct slug
versionstringCurrent version for comparison
license_keystringLicense key for authenticated downloads

Update: Download

GET /api/v2/download

Secure download endpoint that validates the license key before serving the ZIP file. Returns the product archive directly.

On success: application/zip

On failure: 403

SDK: WordPress

The LicenseOS WordPress SDK provides drop-in integration for WP plugins. It handles license activation, status checking, and automatic updates.

Installation

  1. Download licenseos-sdk.php from your Developer Dashboard.
  2. Place the file in your plugin's root directory.
  3. Require and initialize in your plugin's main file.

Basic Setup

// Load the SDK
require_once __DIR__ . '/licenseos-sdk.php';

// Initialize (call once, early in plugin lifecycle)
LicenseOS::init(
    'https://your-domain.com/api/v2',
    'sk_live_xxxxxxxx'
);

// Enable WordPress auto-update
LicenseOS::enableAutoUpdate(
    'my-plugin-slug',
    get_option('my_plugin_license')
);

SDK Methods

MethodDescription
init($url, $key)Initialize SDK with API URL and key
activate($key, $domain, $product)Activate license on a domain
check($key)Check license status
checkUpdate($slug, $version)Check for newer version
enableAutoUpdate($slug, $key)Hook into WP update system

Errors & Rate Limits

HTTP Status Codes

CodeDescription
200Success
400Bad request (missing/invalid parameters)
401Invalid or missing API key
403Unauthorized (invalid license for download)
404Product not found
429Rate limit exceeded
500Server error

Best Practices

  • Cache license checks — Don't call the API on every page load. Cache results for 1-6 hours.
  • Use HTTPS — All API calls must use HTTPS in production.
  • Handle errors gracefully — If the API is unreachable, fail open or use cached results.
  • Always check license status before attempting to download.
  • Never expose your API key in client-side code or public repositories.