Overzicht
Het licentiecontrole-endpoint is de belangrijkste toegangspoort tot Pro-functies. Roep het aan bij het opstarten van de app (en periodiek) om de sleutel te controleren, deze computer te activeren en de actuele licentiestatus op te halen.
Endpoint: POST /api/license/verify
Limiet: 10 verzoeken per minuut per IP
Verzoek
POST /api/license/verify
Content-Type: application/json
{
"licenseKey": "GRAV-XXXX-XXXX-XXXX-XXXX",
"machineId": "sha256-of-hardware-id",
"machineName": "DESKTOP-ABC123",
"appVersion": "1.2.3",
"ipAddress": "auto"
}
| Field | Required | Beschrijving |
|---|---|---|
| licenseKey | Ja | User's license key (format: GRAV-XXXX-XXXX-XXXX-XXXX) |
| machineId | Ja | Stable SHA-256 hash of hardware identifiers |
| machineName | Nee | Human-readable name (default: Environment.MachineName) |
| appVersion | Ja | Current app version for analytics |
| ipAddress | Nee | Client IP (server fills if omitted) |
Antwoord
Gelukt (200):
{
"valid": true,
"license": {
"plan": "Pro",
"maxMachines": 3,
"expiresAt": "2025-12-01T00:00:00Z",
"features": ["agents", "mcp", "rag", "priority-support"]
},
"machine": {
"id": "sha256-hash",
"name": "DESKTOP-ABC123",
"activatedAt": "2025-01-15T10:30:00Z",
"isCurrent": true
},
"gracePeriodDays": 7
}
Failure (200 with valid:false):
{
"valid": false,
"error": {
"code": "MACHINE_LIMIT_EXCEEDED",
"message": "Maximum machines (3) reached. Manage machines in your account."
},
"license": { "plan": "Pro", "maxMachines": 3 },
"gracePeriodDays": 7
}
Offline respijtperiode
Als het controleverzoek mislukt door netwerkproblemen, mag de client "offline" blijven werken tot gracePeriodDays (standaard 7) na de laatste geslaagde controle. Na afloop van de respijtperiode moeten Pro-functies vergrendeld blijven tot er weer verbinding is.
// Client-side offline logic
if (lastVerifiedAt != null && DateTime.UtcNow - lastVerifiedAt < TimeSpan.FromDays(gracePeriodDays))
{
// Allow Pro features
return LicenseState.ValidOffline;
}
else
{
// Lock Pro features
return LicenseState.Expired;
}