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
- Register as a developer and get approved.
- Generate an API Key from the Developer Dashboard.
- Use the API Key in the
X-API-KEYrequest header. - 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"
| Header | Description |
|---|---|
| X-API-KEY | Your developer API key |
| Content-Type | application/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
| Parameter | Type | Required | Description |
|---|---|---|---|
| license_key | string | Yes | License key (format: XXXX-XXXX-XXXX-XXXX) |
| domain | string | Yes | Domain to activate (e.g. example.com) |
| product | string | No | Product 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
| Status | Description |
|---|---|
| valid | License is active and not expired |
| expired | License has passed its expiry date |
| inactive | License has been deactivated by admin |
| invalid | License 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
| Parameter | Type | Description |
|---|---|---|
| product | string | Product slug |
| version | string | Current version for comparison |
| license_key | string | License 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
- Download
licenseos-sdk.phpfrom your Developer Dashboard. - Place the file in your plugin's root directory.
- 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
| Method | Description |
|---|---|
| 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
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad request (missing/invalid parameters) |
| 401 | Invalid or missing API key |
| 403 | Unauthorized (invalid license for download) |
| 404 | Product not found |
| 429 | Rate limit exceeded |
| 500 | Server 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.