Skip to main content

🔑 Authenticate License

Authenticate a user's license key with TKI Auth API.

Endpoint​

POST /api/license/auth

Headers​

NameTypeRequiredDescription
AuthorizationstringYesYour API Key from config
Content-TypestringYesMust be application/json
User-AgentstringNoClient information (logged for analytics)

Request Body​

{
"data": {
"product": "string",
"version": "string",
"licensekey": "string",
"ip": "string",
"hwid": "string"
}
}

Parameters​

ParameterTypeRequiredDescription
data.productstringYesName of the product to authenticate for
data.versionstringYesVersion of the product
data.licensekeystringYesThe license key to authenticate
data.ipstringYesClient's IP address
data.hwidstringConditionalHardware ID (required if RequireHWID is enabled in config)

Response​

Success Response (200)​

{
"status_msg": "Successful Authentication!",
"status_overview": "success",
"status_code": 200,
"version": "1.0.0",
"discord_id": "123456789012345678",
"discord_username": "john_doe",
"discord_tag": "@john_doe#0001",
"expire_date": "12/31/2024",
"staff_license": false
}

Error Responses​

{
"message": "Authorization header is missing",
"status_overview": "failed"
}

Causes:

  • Missing Authorization header

Code Examples​

const response = await fetch('https://your-domain.com/api/license/auth', {
method: 'POST',
headers: {
'Authorization': 'your-api-key-here',
'Content-Type': 'application/json',
'User-Agent': 'MyApp/1.0.0'
},
body: JSON.stringify({
data: {
product: 'MyProduct',
version: '1.0.0',
licensekey: 'TKI-XXXXX-XXXXX',
ip: '192.168.1.1',
hwid: 'unique-hardware-id'
}
})
});

const result = await response.json();

if (result.status_overview === 'success') {
console.log('Authentication successful!');
console.log('User:', result.discord_username);
console.log('Expires:', result.expire_date);
} else {
console.error('Authentication failed:', result.message);
}

Special Features​

Staff Licenses​

Staff licenses bypass product validation and can authenticate against any product in your system. When a staff license is used:

  • Product and version validation is skipped
  • The requested product name is returned in the response
  • staff_license field in response will be true

Rate Limiting​

If rate limiting is enabled in your config, requests are limited per IP address. The limit resets every minute.

Advanced Logging​

All authentication attempts are logged to Discord channels (if configured) and stored in the database for analytics. Failed attempts include detailed error information for debugging.

Blacklist Protection​

The system automatically checks for blacklisted:

  • IP addresses
  • Hardware IDs (HWID)
  • License keys

Blacklisted items are automatically blocked and connection attempts are counted.

Response Fields Explained​

FieldDescription
status_msgHuman-readable status message
status_overviewEither "success" or "failed"
status_codeHTTP status code
versionProduct version (from database or requested version for staff licenses)
discord_idDiscord user ID associated with the license
discord_usernameDiscord username
discord_tagFull Discord tag with @ prefix
expire_dateLicense expiration date in MM/DD/YYYY format
staff_licenseBoolean indicating if this is a staff license

Important Notes​

IP and HWID Tracking

The first time a license is used from a new IP or HWID, it will be automatically added to the license's allowed lists (up to the configured limits).

Staff License Behavior

Staff licenses can authenticate against any product and bypass normal product/version validation. Use them carefully for administrative access.

Error Handling

Always check the status_overview field first to determine if the request was successful before processing other response data.