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.
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.
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:
# 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"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.
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()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:
| Property | Value |
|---|---|
| Bound to | One device per activation (configurable per plan) |
| Validated | On every tool launch against the BayonKeys API |
| Revocable | Instantly from Dashboard → My Keys → Revoke |
| Offline | 24-hour grace period if API is unreachable |
Bundle your tool with PyInstaller. Include license.py and any assets (logo, icons) as additional data:
pyinstaller --onefile --noconsole \
--add-data "license.py;." \
--add-data "logo.png;." \
--icon="logo.ico" \
main.pyThe 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).
license.py with its own _API_KEY. Never share API keys across products — keys from Product A will be rejected by Product B.