Quick Start — Integrate in 5 Minutes

Follow these steps to protect any tool with a BayonKeys license gate. Each product gets its own pool of keys and its own API key.

Step 1 — Create a Product & Get an API Key

Go to Dashboard → My Products → New Product. Give it a name (e.g. PDF Converter), add at least one plan (e.g. Lifetime), then go to Dashboard → API Keys → Create Key and select that product. Copy the ak_xxx… key — you will embed it in license.py.

Step 2 — Add license.py to Your Tool

Download license.py and place it in the same folder as your tool's main script. Then open the file and set your product's API key at the top:

license.py — set your API key
# At the top of license.py
_API_KEY  = "ak_your_product_api_key_here"   # <-- paste your key here
_API_BASE = "https://bayonkeys.site/api/v1"
Step 3 — Gate Your Tool (3 Lines)

Import require_license and call it right after creating your Tkinter root window. If the license is invalid the window is destroyed before the UI loads.

Python — main.py
import tkinter as tk
from license import require_license

class MyApp:
    def __init__(self, root):
        # ✅ License gate — MUST be the first thing called
        if not require_license(root, "Your Tool Name"):
            root.destroy()
            return

        # ... rest of your app init
        self._setup_ui()

if __name__ == "__main__":
    root = tk.Tk()
    app  = MyApp(root)
    root.mainloop()
Step 4 — Generate & Distribute Keys

Go to Dashboard → My Keys → Generate Keys, select your product and plan, enter a count, and click Generate. You can export as CSV to send keys to your users. Each key is:

PropertyValue
Bound toOne device per activation (configurable per plan)
ValidatedOn every tool launch against the BayonKeys API
RevocableInstantly from Dashboard → My Keys → Revoke
Offline24-hour grace period if API is unreachable
Step 5 — Build Your EXE

Bundle your tool with PyInstaller. Include license.py and any assets (logo, icons) as additional data:

Terminal — Build command
pyinstaller --onefile --noconsole \
  --add-data "license.py;." \
  --add-data "logo.png;." \
  --icon="logo.ico" \
  main.py

The compiled .exe will show the activation dialog on first launch. Once a key is entered and validated, it is cached encrypted on disk — users won't be prompted again on subsequent runs (only silently re-validated).

Each product needs its own license.py with its own _API_KEY. Never share API keys across products — keys from Product A will be rejected by Product B.