API Documentation

Home
License Verification API

This documentation explains how to integrate our license verification system into your applications. The API is designed to be simple and straightforward, supporting all major programming languages.

Authentication

All API requests require authentication using an API key. You can create and manage your API keys in your user dashboard.

API Key Header

Include your API key in the request headers:

X-API-Key: your_api_key_here

License Verification Endpoint

URL https://getlicensetool.shop/api/verify.php
Method POST
Headers Content-Type: application/json
X-API-Key: your_api_key
Request Parameters
Parameter Type Required Description
license_key String Yes The license key to verify
machine_id String Yes A unique identifier for the machine/device
Response Format
Parameter Type Description
valid Boolean Indicates if the license is valid
message String A message describing the result
expires_in_days Integer Number of days until the license expires (only if valid)
Example Response (Success)
{
    "valid": true,
    "message": "License is valid",
    "expires_in_days": 365
}
Example Response (Error)
{
    "valid": false,
    "message": "License key not found"
}

Code Examples

/**
 * PHP License Verification Example
 */
function verifyLicense($licenseKey, $machineId, $apiKey) {
    // API endpoint URL
    $apiUrl = 'https://getlicensetool.shop/api/verify.php';
    
    // Prepare request data
    $data = json_encode([
        'license_key' => $licenseKey,
        'machine_id' => $machineId
    ]);
    
    // Initialize cURL session
    $ch = curl_init($apiUrl);
    
    // Set cURL options
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data),
        'X-API-Key: ' . $apiKey
    ]);
    
    // Execute cURL request
    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    
    // Close cURL session
    curl_close($ch);
    
    // Check for errors
    if ($response === false) {
        $curlError = curl_error($ch);
        return [
            'valid' => false,
            'message' => 'Failed to connect to license server: ' . $curlError
        ];
    } else if ($httpCode === 200) {
        return json_decode($response, true);
    } else if ($httpCode === 401) {
        return [
            'valid' => false,
            'message' => 'API key is invalid or missing'
        ];
    } else {
        return [
            'valid' => false,
            'message' => 'Failed to verify license. HTTP Code: ' . $httpCode
        ];
    }
}

// Usage example
$licenseKey = 'XXXX-XXXX-XXXX-XXXX'; // Your license key
$machineId = md5(php_uname('n')); // Generate machine ID based on hostname
$apiKey = 'your_api_key_here'; // Your API key

$result = verifyLicense($licenseKey, $machineId, $apiKey);

if ($result['valid']) {
    echo "License is valid! Expires in {$result['expires_in_days']} days.";
} else {
    echo "License verification failed: {$result['message']}";
}
/**
 * JavaScript License Verification Example (using Fetch API)
 */
async function verifyLicense(licenseKey, machineId, apiKey) {
    // API endpoint URL
    const apiUrl = 'https://getlicensetool.shop/api/verify.php';
    
    // Prepare request data
    const data = {
        license_key: licenseKey,
        machine_id: machineId
    };
    
    try {
        // Send request
        const response = await fetch(apiUrl, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
                'X-API-Key': apiKey
            },
            body: JSON.stringify(data)
        });
        
        // Check for HTTP errors
        if (!response.ok) {
            if (response.status === 401) {
                return {
                    valid: false,
                    message: 'API key is invalid or missing'
                };
            }
            return {
                valid: false,
                message: `HTTP error: ${response.status}`
            };
        }
        
        // Parse the JSON response
        return await response.json();
    } catch (error) {
        return {
            valid: false,
            message: `Error: ${error.message}`
        };
    }
}

// Generate a machine ID
function generateMachineId() {
    // In a real application, use something unique to the device
    // This is a simple example that uses browser and screen info
    const screenInfo = `${window.screen.width}x${window.screen.height}x${window.screen.colorDepth}`;
    const browserInfo = navigator.userAgent;
    
    // Create a simple hash of the combined information
    let hash = 0;
    const combined = screenInfo + browserInfo;
    
    for (let i = 0; i < combined.length; i++) {
        const char = combined.charCodeAt(i);
        hash = ((hash << 5) - hash) + char;
        hash = hash & hash; // Convert to 32bit integer
    }
    
    // Convert to hexadecimal and ensure positive number
    return Math.abs(hash).toString(16);
}

// Usage example
const licenseKey = 'XXXX-XXXX-XXXX-XXXX'; // Your license key
const machineId = generateMachineId(); // Generate a unique machine ID
const apiKey = 'your_api_key_here'; // Your API key

verifyLicense(licenseKey, machineId, apiKey)
    .then(result => {
        if (result.valid) {
            console.log(`License is valid! Expires in ${result.expires_in_days} days.`);
            // Enable features, allow access, etc.
        } else {
            console.log(`License verification failed: ${result.message}`);
            // Show error, disable features, etc.
        }
    });
"""
Python License Verification Example
"""
import json
import requests
import uuid
import socket
import hashlib

def verify_license(license_key, machine_id, api_key):
    """Verify license with the license server"""
    api_url = 'https://getlicensetool.shop/api/verify.php'
    
    # Prepare request data
    data = {
        'license_key': license_key,
        'machine_id': machine_id
    }
    
    try:
        # Send POST request to license server
        response = requests.post(
            api_url,
            data=json.dumps(data),
            headers={
                'Content-Type': 'application/json',
                'X-API-Key': api_key
            }
        )

        # Check if request was successful
        if response.status_code == 200:
            return response.json()
        elif response.status_code == 401:
            return {
                'valid': False,
                'message': 'API key is invalid or missing'
            }
        else:
            return {
                'valid': False,
                'message': f'Failed to verify license. HTTP Code: {response.status_code}'
            }
    except Exception as e:
        return {
            'valid': False,
            'message': f'Error: {str(e)}'
        }

def get_machine_id():
    """Generate a unique machine ID"""
    # Get hostname and MAC address
    hostname = socket.gethostname()
    mac_address = uuid.getnode()

    # Combine them and create an MD5 hash
    machine_str = f"{hostname}:{mac_address}"
    machine_id = hashlib.md5(machine_str.encode()).hexdigest()
    return machine_id

# Usage example
if __name__ == '__main__':
    license_key = 'XXXX-XXXX-XXXX-XXXX'  # Your license key
    machine_id = get_machine_id()  # Generate a unique machine ID
    api_key = 'your_api_key_here'  # Your API key

    result = verify_license(license_key, machine_id, api_key)

    if result['valid']:
        print(f"License is valid! Expires in {result['expires_in_days']} days.")
        # Enable features, allow access, etc.
    else:
        print(f"License verification failed: {result['message']}")
        # Show error, disable features, etc.
/**
 * Node.js License Verification Example
 */
const axios = require('axios');
const os = require('os');
const crypto = require('crypto');

/**
 * Verify license with the license server
 */
async function verifyLicense(licenseKey, machineId, apiKey) {
    // API endpoint URL
    const apiUrl = 'https://getlicensetool.shop/api/verify.php';

    // Prepare request data
    const data = {
        license_key: licenseKey,
        machine_id: machineId
    };

    try {
        // Send POST request to license server
        const response = await axios.post(apiUrl, data, {
            headers: { 
                'Content-Type': 'application/json',
                'X-API-Key': apiKey
            }
        });

        // Return the response data
        return response.data;
    } catch (error) {
        // Check for specific error codes
        if (error.response && error.response.status === 401) {
            return {
                valid: false,
                message: 'API key is invalid or missing'
            };
        }
        
        return {
            valid: false,
            message: `Error: ${error.message}`
        };
    }
}

/**
 * Generate a unique machine ID
 */
function getMachineId() {
    // Get hostname and network interfaces
    const hostname = os.hostname();
    const networkInterfaces = os.networkInterfaces();

    // Get the first MAC address we can find
    let macAddress = '';
    Object.keys(networkInterfaces).forEach((ifaceName) => {
        if (macAddress) return;

        networkInterfaces[ifaceName].forEach((iface) => {
            if (macAddress) return;
            if (iface.mac && iface.mac !== '00:00:00:00:00:00') {
                macAddress = iface.mac;
            }
        });
    });

    // Combine hostname and MAC address and create MD5 hash
    const machineStr = `${hostname}:${macAddress}`;
    const machineId = crypto.createHash('md5').update(machineStr).digest('hex');
    return machineId;
}

// Usage example
const licenseKey = 'XXXX-XXXX-XXXX-XXXX'; // Your license key
const machineId = getMachineId(); // Generate a unique machine ID
const apiKey = 'your_api_key_here'; // Your API key

verifyLicense(licenseKey, machineId, apiKey)
    .then(result => {
        if (result.valid) {
            console.log(`License is valid! Expires in ${result.expires_in_days} days.`);
            // Enable features, allow access, etc.
        } else {
            console.log(`License verification failed: ${result.message}`);
            // Show error, disable features, etc.
        }
    })
    .catch(error => {
        console.error('Error:', error);
    });

Error Handling

HTTP Status Description
200 OK The request was successful. Check the valid field in the response to determine if the license is valid.
400 Bad Request The request was invalid or missing required parameters.
401 Unauthorized The API key was missing, invalid, or has expired.
429 Too Many Requests Rate limit exceeded. Please slow down your API requests.
500 Server Error An error occurred on the server. Please try again later.

Best Practices

Security
  • Store your API key securely
  • Use HTTPS for all API requests
  • Don't expose your API key in client-side code
  • Implement a server-side proxy for web applications
Activation Flow
  • Generate a unique machine ID that persists across app restarts
  • Cache successful license verifications locally
  • Implement offline grace periods for temporary connection issues
  • Periodically re-verify the license (e.g., daily or weekly)
Device Handling
  • Use consistent machine ID generation across all platforms
  • Provide a way for users to deactivate devices they no longer use
  • Handle device identifier changes gracefully
  • Consider hardware-specific identifiers when available
User Experience
  • Provide clear error messages when license verification fails
  • Notify users before their license expires
  • Include renewal options within your application
  • Handle network connectivity issues gracefully