This document provides details on the API endpoints for the self-hosted Flask license server.
The license system works by pairing a unique license_key
(the user's machine ID) with a specific tool_name
. A license is only considered valid if both the key and the tool name sent by the client application exist as a matching pair in the database.
The public API endpoint for the license server is:
http://technodepc.xyz/licenseserver
These endpoints are used by the admin dashboard and are intended for administrative use only.
Authenticates the admin user.
/api/login
POST
json
{
"username": "admin",
"password": "your_password"
}
200 OK
(Success):
json
{
"status": "success",
"message": "Login successful"
}
401 Unauthorized
(Failure):
json
{
"status": "error",
"message": "Invalid credentials"
}
Retrieves a list of all licenses in the database.
/api/licenses
GET
200 OK
(Success):json
[
{
"id": 1,
"created_at": "2023-10-27 10:00:00",
"tool_name": "Tool_A",
"license_key": "0a:1b:2c:3d:4e:5f",
"status": "activated",
"user_id": "user_001",
"expiration_date": "2024-12-31"
},
{ ... }
]
Creates a new license entry.
/api/licenses
POST
json
{
"tool_name": "Tool_B",
"license_key": "f5:e4:d3:c2:b1:a0",
"status": "activated",
"expiration_date": "2025-01-31",
"user_id": "user_002"
}
201 Created
(Success):
json
{
"status": "success",
"message": "License added"
}
409 Conflict
(Duplicate License):
json
{
"status": "error",
"message": "This license key already exists for this tool."
}
Removes a license from the database.
/api/licenses/<license_id>
DELETE
/api/licenses/1
200 OK
(Success):
json
{
"status": "success",
"message": "License deleted"
}
This is the public-facing endpoint that your Windows applications will use to validate their licenses.
Validates a license for a given tool and machine ID.
/api/check
POST
Request Body (JSON):
json
{
"tool_name": "Tool_A",
"license_key": "0a:1b:2c:3d:4e:5f"
}
Important: The
tool_name
is case-sensitive and must be an exact match to thetool_name
field created in the admin dashboard.
Responses:
200 OK
(Valid License):
json
{
"status": "valid",
"message": "License is active and valid."
}
404 Not Found
(Key Not Found):
json
{
"status": "invalid",
"message": "License key not found for this tool."
}
403 Forbidden
(Status Invalid):
json
{
"status": "invalid",
"message": "License status is 'revoked'."
}
403 Forbidden
(Expired):
json
{
"status": "expired",
"message": "License has expired."
}
This guide explains how to integrate the license checker into your Windows application.
Your application (the "client") will make a web request to the /api/check
endpoint on this server at startup. The server's response will determine if the application should run or exit.
Your application must be able to generate a consistent, unique identifier for the machine it's running on. The MAC address is a common and reliable method.
When your application starts, before loading the main user interface, it must perform the following action:
POST
request to the /api/check
endpoint of the license server.Content-Type
header to application/json
.json
{
"tool_name": "YourToolName",
"license_key": "the_machine_id_from_step_1"
}
Note: Replace
"YourToolName"
with the actual name of your tool as it appears in the admin dashboard.
CRITICAL NOTE: The value of the
TOOL_NAME
variable in your application's code must exactly match the value you enter in the "Tool Name" field in the admin dashboard. The check is case-sensitive. For example,"MyTool"
and"mytool"
are considered different names.
Your application must check the HTTP status code of the response from the server.
200 OK
:Your application should proceed to load its main functions and show the user interface.
If the status code is 403
or 404
(or any other error code):
message
from the JSON error response to the user in a popup or message box.If your Windows application is written in Python, you can use the provided license_client.py
module, which handles these steps for you.
```python
import sys from license_client import LicenseClient
LICENSE_SERVER_URL = "http://technodepc.xyz/licenseserver"
TOOL_NAME = "YourToolName"
def run_main_app(): """Placeholder for your app's main entry point.""" print("License is valid. Starting main application...") # Your application's main code goes here. # For a GUI app, you would initialize your main window here.
if name == "main": client = LicenseClient(LICENSE_SERVER_URL) is_valid, message = client.check_license(TOOL_NAME)
if is_valid:
run_main_app()
else:
# In a real GUI app, you would display this message in a popup dialog.
print(f"LICENSE VALIDATION FAILED: {message}")
input("Press Enter to exit.") # Pause to allow user to read the message
sys.exit(1)