Activate License Endpoint

The activate endpoint is used to register a new device or instance with a valid license key. This is typically done when a user first sets up your application.

The activation endpoint is a crucial component of your license management system. Here’s a deeper look at how it works and its benefits:

Common Use Cases

  • Initial Software Setup: When users first install your application and enter their license key
  • Device Migration: When users need to activate your software on a new device
  • Multi-device Scenarios: For users who need to use your software across multiple machines
  • Cloud Instance Deployment: When spinning up new cloud instances that require license validation

Benefits of the Activation System

  • Prevents Unauthorized Usage: Each activation is tracked and counted against the license limit
  • User Flexibility: Allows users to manage their own device activations within their quota
  • Usage Analytics: Provides insights into how and where your software is being used
  • Fraud Prevention: Helps identify and prevent license key sharing or abuse

Activation Flow Example

Here’s how a typical activation flow works:

  1. User purchases your software and receives a license key
  2. User installs your application on their device
  3. Application prompts for license key during first launch
  4. Application generates a unique instance name (usually based on device characteristics)
  5. Activation request is sent to the API
  6. Upon successful activation, the instance ID is stored locally for future validation

The activation endpoint is designed to be both secure and user-friendly, providing a smooth experience for legitimate users while maintaining strong protection against unauthorized usage.

Endpoint Details

  • URL: https://test-api.creem.io/v1/licenses/activate
  • Method: POST
  • Authentication: Requires API key in headers

Request Parameters

The request body should include:

  • key (required): The license key to activate
  • instance_name (required): A unique identifier for the device/installation

Response Format

{
  "id": "<string>",
  "mode": "test",
  "object": "<string>",
  "status": "active",
  "key": "ABC123-XYZ456-XYZ456-XYZ456",
  "activation": 5,
  "activation_limit": 1,
  "expires_at": "2023-09-13T00:00:00Z",
  "created_at": "2023-09-13T00:00:00Z",
  "instance": [
    {
      "id": "<string>",
      "mode": "test",
      "object": "license-instance",
      "name": "My Customer License Instance",
      "status": "active",
      "created_at": "2023-09-13T00:00:00Z"
    }
  ]
}

Implementation Examples

  • cURL Example:

    curl -X POST https://test-api.creem.io/v1/licenses/activate \
      -H "accept: application/json" \
      -H "x-api-key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "key": "ABC123-XYZ456-XYZ456-XYZ456",
        "instance_name": "johns-macbook-pro"
      }'
    
  • Python Example:

    import requests
    
    def activate_license(license_key, instance_name):
        url = "https://test-api.creem.io/v1/licenses/activate"
        headers = {
            "accept": "application/json",
            "x-api-key": "YOUR_API_KEY",
            "Content-Type": "application/json"
        }
        data = {
            "key": license_key,
            "instance_name": instance_name
        }
        
        response = requests.post(url, json=data, headers=headers)
        return response.json()
    
  • JavaScript Example:

    const activateLicense = async (licenseKey, instanceName) => {
      const response = await fetch('https://test-api.creem.io/v1/licenses/activate', {
        method: 'POST',
        headers: {
          'accept': 'application/json',
          'x-api-key': 'YOUR_API_KEY',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          key: licenseKey,
          instance_name: instanceName
        })
      });
      return await response.json();
    }
    

Error Handling

Common error responses include:

  • 400 Bad Request: Invalid or missing parameters
  • 401 Unauthorized: Invalid API key
  • 403 Forbidden: License key has reached activation limit
  • 404 Not Found: Invalid license key