keymelon

DEVELOPER DOCUMENTATION

Licensing API v1

Send a JSON body with the buyer’s licence key and a stable installation identifier. Activate once, validate on subsequent runs and deactivate when the user removes a device. Keep licence keys and administrative credentials out of URLs and logs.

Application endpoints

POST /api/v1/licences/activate
POST /api/v1/licences/validate
POST /api/v1/licences/deactivate

Success returns valid, licenceId and expiresAt. A deactivation returns valid=false. Errors contain an error.code such as activation_limit, licence_expired, licence_revoked or device_inactive. Retry a 429 after the current minute.

JavaScript

const response = await fetch(base + '/api/v1/licences/activate', {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({key: licenceKey, deviceId: installationId})
})
const result = await response.json()
if (!response.ok) throw new Error(result.error.code)

Python

import requests
r = requests.post(base + "/api/v1/licences/validate",
    json={"key": licence_key, "deviceId": installation_id}, timeout=10)
r.raise_for_status()
valid = r.json()["valid"]

C#

using System.Net.Http.Json;
var response = await client.PostAsJsonAsync(
    baseUrl + "/api/v1/licences/deactivate",
    new { key = licenceKey, deviceId = installationId });
response.EnsureSuccessStatusCode();

Seller administration

Create a key in the seller workspace’s API Keys section. Use it only on a trusted server. GET /api/v1/seller/licences lists up to 100 masked assignments. Pass after with the last record ID to paginate. POST to the same path with action=issue or action=revoke.

Authorization: Bearer <seller-api-key>

POST /api/v1/seller/licences?action=issue
{"productId":"<product-id>","name":"Example buyer","email":"[email protected]"}

POST /api/v1/seller/licences?action=revoke
{"id":"<licence-id>"}