License API Documentation

License API Documentation

Integrate, manage, and verify licenses seamlessly with our developer-friendly API.

Overview

The License API enables developers to manage applications, generate license keys, and verify usage for seamless integration into tools like Revit.

  • Single-device login with 30-minute auto-logout.
  • Manage licenses by application, category, and expiration.
  • Purchase license packages via PayPal.
  • RESTful API for creating and verifying licenses.

Developer Guide

1. Log In

Access the login page at /login. Sessions are limited to one device and auto-expire after 30 minutes of inactivity.

2. Manage Applications

At /developer/manage_applications, you can:

  • Create new applications (name, optional description).
  • Edit or delete applications (unless linked to active licenses).

3. Create Licenses

Use /developer/create_license to:

  • Select application and category (Web, Mobile, Desktop).
  • Assign an API key. Licenses are valid for one year.

4. Manage Licenses

At /developer/manage_licenses, you can:

  • View license details and metadata.
  • Filter by application, category, or date.
  • Delete licenses (requires confirmation).

5. Buy License Packages

Visit /developer/buy_package to:

  • Select a package (e.g., Starter, Small).
  • Complete payment via PayPal for automatic license allocation.

6. Manage API Keys

At /developer/api_keys, you can:

  • Generate API keys for license operations.
  • Use keys in create and verify API endpoints.

Revit API Integration

This section provides instructions to integrate the License API into Revit add-ins using C# or Python. For C#, use RevitLicenseChecker.dll for general compatibility or RevitLicenseApi.dll for Revit 2025 and later (.NET 8.0). For Python, follow the PyRevit-based approach. Verified licenses are cached locally to avoid repetitive prompts.

C# Integration

Integrate license verification into your Revit add-in using either RevitLicenseChecker.dll (compatible with older Revit versions using .NET Framework) or RevitLicenseApi.dll (designed for Revit 2025 and later using .NET 8.0). Both libraries handle license checks, UI prompts, and caching.

Option 1: Using RevitLicenseChecker.dll

Step 1: Prepare the Environment
  • Download RevitLicenseChecker.dll from here.
  • Copy RevitLicenseChecker.dll to the same directory as your add-in’s .dll and .addin files (e.g., %ProgramData%\Autodesk\Revit\Addins\2025).
  • Ensure your development environment (e.g., Visual Studio or Visual Studio Code) is set up for your Revit version (e.g., .NET Framework for Revit 2024 or earlier, .NET 8.0 for Revit 2025).
Step 2: Add Reference to RevitLicenseChecker.dll
  • In Visual Studio:
    • Right-click your Revit add-in project in Solution Explorer → Add Reference...Browse.
    • Select RevitLicenseChecker.dll from its location.
    • Click OK to add the reference.
  • In Visual Studio Code:
    • Edit your .csproj file to include a reference to RevitLicenseChecker.dll:
    • 
        
          path\to\RevitLicenseChecker.dll
          True
        
      
    • Run dotnet restore to update dependencies.
Step 3: Use LicenseHelper for Verification

Add the RevitLicenseChecker namespace and use LicenseHelper.EnsureValidLicense to verify the license. The method handles UI prompts (if needed) and caching to avoid repetitive dialogs.

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using RevitLicenseChecker; // Add this namespace
using System.Reflection;

namespace YourAddinNamespace
{
    [Transaction(TransactionMode.Manual)]
    public class ShowInfo : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string apiKey = "YOUR-API-KEY"; // Replace with your API key
            string addinName = Assembly.GetExecutingAssembly().GetName().Name;

            if (!LicenseHelper.EnsureValidLicense(apiKey, addinName))
            {
                TaskDialog.Show("License Error", "Access denied. Invalid license.");
                return Result.Failed;
            }

            // Proceed with add-in logic if license is valid
            TaskDialog.Show("Info", "License valid. Add-in authorized.");
            // Add your Revit API logic here (e.g., geometry creation, parameter modification)
            return Result.Succeeded;
        }
    }
}

Notes:

  • Replace YOUR-API-KEY with the API key from your License API account (see /developer/api_keys).
  • addinName is automatically set to your add-in’s assembly name, ensuring uniqueness for caching and API tracking.
  • LicenseHelper.EnsureValidLicense automatically:
    • Checks for a cached license key in Windows Credential Manager.
    • Verifies the cached key against the License API (http://localhost:3000/api/license/verify).
    • Prompts the user with a WPF UI if no valid cached key exists.
    • Caches the new key on successful verification to skip future prompts.
Step 4: Build and Deploy
  • Build your project:
    • In Visual Studio: Build → Build Solution.
    • In Visual Studio Code: dotnet build.
  • Copy your add-in’s .dll, .addin file, and RevitLicenseChecker.dll to the Revit add-ins folder (e.g., %ProgramData%\Autodesk\Revit\Addins\2025).
  • Ensure the API key is securely stored (e.g., in a config file or environment variable).
Step 5: Test the Add-in
  • Launch Revit and run your add-in.
  • First run: A WPF UI will prompt the user to enter a license key.
  • Subsequent runs: If the cached license is valid, no UI will appear, and the add-in will run directly.
  • Error cases:
    • If the cached key is invalid or expired, the UI will reappear.
    • If the API call fails, a TaskDialog may show debug information (configured in RevitLicenseChecker.dll).
  • Verify your add-in’s logic executes only when the license is valid.

Option 2: Using RevitLicenseApi.dll (Revit 2025+)

For add-ins targeting Revit 2025 and later, use RevitLicenseApi.dll, which is optimized for .NET 8.0 (unlike earlier Revit versions that used .NET Framework). The integration process is similar to RevitLicenseChecker.dll.

Step 1: Prepare the Environment
  • Download RevitLicenseApi.dll from here.
  • Copy RevitLicenseApi.dll to the same directory as your add-in’s .dll and .addin files (e.g., %ProgramData%\Autodesk\Revit\Addins\2025).
  • Ensure your project targets .NET 8.0 in your development environment (e.g., Visual Studio or Visual Studio Code), as required for Revit 2025.
Step 2: Add Reference to RevitLicenseApi.dll
  • In Visual Studio:
    • Right-click your Revit add-in project in Solution Explorer → Add Reference...Browse.
    • Select RevitLicenseApi.dll from its location.
    • Click OK to add the reference.
  • In Visual Studio Code:
    • Edit your .csproj file to include a reference to RevitLicenseApi.dll:
    • 
        
          path\to\RevitLicenseApi.dll
          True
        
      
    • Run dotnet restore to update dependencies.
Step 3: Use LicenseHelper for Verification

Add the RevitLicenseApi namespace and use LicenseHelper.EnsureValidLicense to verify the license. The method handles UI prompts and caching, optimized for .NET 8.0.

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using RevitLicenseApi; // Add this namespace
using System.Reflection;

namespace YourAddinNamespace
{
    [Transaction(TransactionMode.Manual)]
    public class ShowInfo : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string apiKey = "YOUR-API-KEY"; // Replace with your API key
            string addinName = Assembly.GetExecutingAssembly().GetName().Name;

            if (!LicenseHelper.EnsureValidLicense(apiKey, addinName))
            {
                TaskDialog.Show("License Error", "Access denied. Invalid license.");
                return Result.Failed;
            }

            // Proceed with add-in logic if license is valid
            TaskDialog.Show("Info", "License valid. Add-in authorized.");
            // Add your Revit API logic here (e.g., geometry creation, parameter modification)
            return Result.Succeeded;
        }
    }
}

Notes:

  • Replace YOUR-API-KEY with the API key from your License API account (see /developer/api_keys).
  • addinName is automatically set to your add-in’s assembly name, ensuring uniqueness for caching and API tracking.
  • LicenseHelper.EnsureValidLicense automatically:
    • Checks for a cached license key in Windows Credential Manager.
    • Verifies the cached key against the License API (http://localhost:3000/api/license/verify).
    • Prompts the user with a WPF UI if no valid cached key exists.
    • Caches the new key on successful verification to skip future prompts.
  • Ensure your project targets .NET 8.0, as RevitLicenseApi.dll is not compatible with .NET Framework used in Revit 2024 or earlier.
Step 4: Build and Deploy
  • Build your project:
    • In Visual Studio: Build → Build Solution.
    • In Visual Studio Code: dotnet build.
  • Copy your add-in’s .dll, .addin file, and RevitLicenseApi.dll to the Revit add-ins folder (e.g., %ProgramData%\Autodesk\Revit\Addins\2025).
  • Ensure the API key is securely stored (e.g., in a config file or environment variable).
Step 5: Test the Add-in
  • Launch Revit 2025 and run your add-in.
  • First run: A WPF UI will prompt the user to enter a license key.
  • Subsequent runs: If the cached license is valid, no UI will appear, and the add-in will run directly.
  • Error cases:
    • If the cached key is invalid or expired, the UI will reappear.
    • If the API call fails, a TaskDialog may show debug information (configured in RevitLicenseApi.dll).
  • Verify your add-in’s logic executes only when the license is valid.

Python Integration

Follow these steps to create a PyRevit script that verifies licenses using a tkinter UI for user input. This is ideal for Python-based Revit workflows.

Step 1: Set Up the Environment

  • Install PyRevit for Revit 2025.
  • Install the requests library: pip install requests.
  • Ensure tkinter is available (included with Python).
  • Create a PyRevit bundle (e.g., license.bundle) with a script file (e.g., script.py).
# Example bundle structure
license.bundle/
├── lib/
│   └── requests/ # Copy requests library here
├── script.py
└── bundle.yaml

bundle.yaml

---
title: License Verification
author: YourName
engines:
  - revit: 2025
...

Step 2: Create the License Manager

Implement a LicenseManager class to handle license verification.

import requests
from datetime import datetime

class LicenseManager:
    def __init__(self, api_key):
        self.api_key = api_key
        self.api_base_url = "http://localhost:3000/api/license"

    def verify_license(self, license_key):
        payload = {
            "license_key": license_key,
            "api_key": self.api_key
        }
        try:
            response = requests.post(f"{self.api_base_url}/verify", json=payload)
            response.raise_for_status()
            result = response.json()
            if result["success"]:
                expires_at = datetime.strptime(result["license"]["expires_at"], "%Y-%m-%d %H:%M:%S")
                return expires_at > datetime.utcnow()
            return False
        except Exception:
            return False

Step 3: Create the UI

Use tkinter to create a dialog for license key input.

import tkinter as tk
from tkinter import messagebox

class LicenseDialog:
    def __init__(self, api_key):
        self.manager = LicenseManager(api_key)
        self.root = tk.Tk()
        self.root.title("License Verification")
        self.root.geometry("300x150")

        tk.Label(self.root, text="Enter License Key:").pack(pady=10)
        self.entry = tk.Entry(self.root, width=30)
        self.entry.pack(pady=5)

        tk.Button(self.root, text="Verify", command=self.verify).pack(pady=10)
        self.result = False

    def verify(self):
        license_key = self.entry.get().strip()
        if not license_key:
            messagebox.showwarning("Warning", "Please enter a license key.")
            return

        if self.manager.verify_license(license_key):
            messagebox.showinfo("Success", "License verified successfully!")
            self.result = True
            self.root.destroy()
        else:
            messagebox.showerror("Error", "Invalid license key.")

    def show(self):
        self.root.mainloop()
        return self.result

Step 4: Integrate with PyRevit Script

Create the main script to prompt for the license key and run Revit logic.

from pyrevit import script

def main():
    api_key = "your_api_key_here"  # Store securely, e.g., in config
    dialog = LicenseDialog(api_key)
    output = script.get_output()
    if dialog.show():
        output.print_md("**Access granted.** Running Revit script...")
        # Add your Revit API logic here
    else:
        output.print_md("**Access denied.** Invalid license.")
        script.exit()

if __name__ == "__main__":
    main()

Step 5: Deploy and Test

  • Place the bundle in the PyRevit extensions folder (e.g., ~/.pyrevit/extensions).
  • Copy the requests library to the bundle’s lib folder.
  • Store the api_key securely (e.g., in a config file).
  • Reload PyRevit, run the script, and test the license verification UI.
  • Add your Revit API logic (e.g., element creation, analysis) to the main function.

API Reference

Create License

Endpoint: POST /api/license/create

Request Body:

{
  "api_key": "your_api_key_here"
}

Success Response:

{
  "success": true,
  "license_key": "generated_license_key"
}

Verify License

Endpoint: POST /api/license/verify

Request Body:

{
  "license_key": "your_license_key_here",
  "api_key": "your_api_key_here"
}

Success Response:

{
  "success": true,
  "license": {
    "license_key": "your_license_key_here",
    "application": "App Name",
    "category": "Web",
    "expires_at": "2026-05-21 09:35:00"
  }
}

Search Results

No results found for "".

License API Platform